Click here to Skip to main content
15,913,055 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A crashing DC... Pin
0v3rloader17-Jul-04 21:23
0v3rloader17-Jul-04 21:23 
GeneralRe: A crashing DC... Pin
Jörgen Sigvardsson18-Jul-04 0:03
Jörgen Sigvardsson18-Jul-04 0:03 
GeneralAffine Transformation Pin
wyoung17-Jul-04 11:20
wyoung17-Jul-04 11:20 
GeneralRe: Affine Transformation Pin
Andrew Walker17-Jul-04 18:27
Andrew Walker17-Jul-04 18:27 
GeneralAC-3 Pin
Alexander M.,17-Jul-04 10:03
Alexander M.,17-Jul-04 10:03 
GeneralRe: AC-3 Pin
bikram singh17-Jul-04 10:06
bikram singh17-Jul-04 10:06 
GeneralThreading and non User-Interface Classes Pin
0v3rloader17-Jul-04 6:35
0v3rloader17-Jul-04 6:35 
GeneralRe: Threading and non User-Interface Classes Pin
Antti Keskinen17-Jul-04 7:04
Antti Keskinen17-Jul-04 7:04 
Straight answer: Yes, it is alright. Creating and executing objects in the CWinThread::InitInstance is ok as well.

Detailed:
To create a non-GUI (worker) thread, just create a function that will run on the thread (just like WinMain runs on the primary thread). Then call AfxBeginThread a pass it a pointer to the function. When you wish to end the thread execution, just return from the function.

You should use CWinThread objects only when you have a GUI thread. Although it is safe to use a CWinThread object with a worker thread, it's a waste of resources. Only use a CWinThread object if your new thread requires a message pump. If it doesn't need it, just create a function that executes on the new thread.

For more information, see AfxBeginThread in MSDN.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: Threading and non User-Interface Classes Pin
0v3rloader17-Jul-04 7:30
0v3rloader17-Jul-04 7:30 
GeneralRe: Threading and non User-Interface Classes Pin
PJ Arends17-Jul-04 7:39
professionalPJ Arends17-Jul-04 7:39 
GeneralRe: Threading and non User-Interface Classes Pin
Antti Keskinen18-Jul-04 3:29
Antti Keskinen18-Jul-04 3:29 
GeneralStatic lib Pin
Atlence17-Jul-04 5:46
Atlence17-Jul-04 5:46 
GeneralRe: Static lib Pin
Antti Keskinen17-Jul-04 7:09
Antti Keskinen17-Jul-04 7:09 
GeneralControl similar to Windows 2000 peroformance tab Pin
Azghar Hussain17-Jul-04 5:00
professionalAzghar Hussain17-Jul-04 5:00 
GeneralRe: Control similar to Windows 2000 peroformance tab Pin
Johan Rosengren17-Jul-04 5:22
Johan Rosengren17-Jul-04 5:22 
Generalabout using ActiveX in dll Pin
yingkou17-Jul-04 3:06
yingkou17-Jul-04 3:06 
GeneralRe: about using ActiveX in dll Pin
bikram singh17-Jul-04 9:01
bikram singh17-Jul-04 9:01 
GeneralRe: about using ActiveX in dll Pin
yingkou17-Jul-04 14:15
yingkou17-Jul-04 14:15 
GeneralRe: about using ActiveX in dll Pin
bikram singh17-Jul-04 22:35
bikram singh17-Jul-04 22:35 
GeneralRe: about using ActiveX in dll Pin
yingkou18-Jul-04 3:06
yingkou18-Jul-04 3:06 
GeneralRe: about using ActiveX in dll Pin
yingkou18-Jul-04 3:13
yingkou18-Jul-04 3:13 
GeneralRe: about using ActiveX in dll Pin
bikram singh18-Jul-04 3:37
bikram singh18-Jul-04 3:37 
GeneralRe: about using ActiveX in dll Pin
yingkou18-Jul-04 14:12
yingkou18-Jul-04 14:12 
QuestionHow to create a window like the Longhorn desktop sidebar? Pin
Anonymous17-Jul-04 2:48
Anonymous17-Jul-04 2:48 
AnswerDesktop Bands Pin
bikram singh17-Jul-04 9:06
bikram singh17-Jul-04 9:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.