开发者

How to start programming with threads in MFC C++? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical开发者_运维问答 and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

i need to create new thread (diffrent class) using cwinthread or afxbeginthreads. i have no idea how to start and which one of them i need to use. help please... thanks


There are two types of thread in MFC:

  • worker threads simply perform a task in the background then exit
  • user-interface threads which have a message pump i.e. you can PostMessage to it

When I used it in MFC a long time ago I very much disliked not being able to create the class because they force you to do it with their factory, and thus you cannot initialise it with parameters it needs to use to execute, as InitInstance() on it also takes no parameters (I think). In other words you really cannot pass them any context data unless you create them suspended, which I found I always had to do.

Worker-threads are the kind of thing I also would prefer to do without MFC since I intensely disliked the intrusiveness of MFC into non-GUI code, i.e. I didn't mind it so much as a Widgets library but found once you put it your project you were "stuck" with it.

I have had to support MFC projects but any new code areas within the project I would stay away from MFC and even use Win32API if possible.


Hi you can read this article http://msdn.microsoft.com/en-us/library/69644x60(v=vs.80).aspx and this one in class

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜