Click here to Skip to main content
15,916,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWM_HSCROLL doesn't work on custom sliders Pin
Budric B.8-Sep-04 6:05
Budric B.8-Sep-04 6:05 
GeneralRe: WM_HSCROLL doesn't work on custom sliders Pin
Anonymous8-Sep-04 6:44
Anonymous8-Sep-04 6:44 
GeneralADO, Winsock, Client/Server Pin
Kudakwashe Mafutah8-Sep-04 5:58
Kudakwashe Mafutah8-Sep-04 5:58 
QuestionHow can I show a dialog on top of a screensaver? Pin
BlackDice8-Sep-04 4:20
BlackDice8-Sep-04 4:20 
GeneralSingle thread to multi-thread conversion problem Pin
vineas8-Sep-04 4:02
vineas8-Sep-04 4:02 
GeneralRe: Single thread to multi-thread conversion problem Pin
Neville Franks8-Sep-04 10:32
Neville Franks8-Sep-04 10:32 
GeneralRe: Single thread to multi-thread conversion problem Pin
vineas8-Sep-04 11:10
vineas8-Sep-04 11:10 
GeneralRe: Single thread to multi-thread conversion problem Pin
Neville Franks8-Sep-04 11:28
Neville Franks8-Sep-04 11:28 
If the thread doesn't do UI I'd definitely use a worker thread. Then use PostMessage() to communicate with the main app thread. If you can add a flag param to the common code functions that do the message pump that says whether to pump or not you can set this to false for your thread. Alternatively use this:

/** Returns true if the current thread is the main application thread.
 */
BOOL
InAppThread()
{
    return ( AfxGetApp() eq AfxGetThread() );
}


and then:

if ( InAppThread() )
  do message pump ..


Also look at http://www.codeproject.com/threads/threadlibrary.asp[^] which is very nice and also simple.

Threads are way better and cleaner for CPU intensive tasks than trying to do this in message pumps. Of course you have to consider sychronization and potential deadlock issues as well. Welcome to the world of multithreading.Big Grin | :-D

Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
GeneralRe: Single thread to multi-thread conversion problem Pin
vineas9-Sep-04 3:29
vineas9-Sep-04 3:29 
GeneralRe: Single thread to multi-thread conversion problem Pin
Neville Franks9-Sep-04 10:23
Neville Franks9-Sep-04 10:23 
GeneralPhilosophical question :-) Pin
Cedric Moonen8-Sep-04 3:35
Cedric Moonen8-Sep-04 3:35 
GeneralRe: Philosophical question :-) Pin
Ryan Binns8-Sep-04 4:07
Ryan Binns8-Sep-04 4:07 
GeneralRe: Philosophical question :-) Pin
Cedric Moonen8-Sep-04 4:31
Cedric Moonen8-Sep-04 4:31 
GeneralRe: Philosophical question :-) Pin
Ryan Binns8-Sep-04 13:24
Ryan Binns8-Sep-04 13:24 
GeneralDetect current language Pin
Anonymous8-Sep-04 3:33
Anonymous8-Sep-04 3:33 
GeneralRe: Detect current language Pin
Ivan Cachicatari8-Sep-04 5:43
Ivan Cachicatari8-Sep-04 5:43 
GeneralRe: Detect current language Pin
David Crow8-Sep-04 5:47
David Crow8-Sep-04 5:47 
GeneralRe: Detect current language Pin
Moak24-Sep-04 1:33
Moak24-Sep-04 1:33 
Generalabout using vmr9 Pin
yingkou8-Sep-04 3:29
yingkou8-Sep-04 3:29 
QuestionHow can I push out my app Pin
Larsson8-Sep-04 2:18
Larsson8-Sep-04 2:18 
Generalconvert bmp to 2-D array Pin
hanivoo8-Sep-04 1:49
hanivoo8-Sep-04 1:49 
GeneralRe: convert bmp to 2-D array Pin
Bob Stanneveld8-Sep-04 6:29
Bob Stanneveld8-Sep-04 6:29 
GeneralCannot find header file compile time Pin
intrigued8-Sep-04 1:40
intrigued8-Sep-04 1:40 
GeneralRe: Cannot find header file compile time Pin
P-Rex8-Sep-04 3:19
P-Rex8-Sep-04 3:19 
GeneralRe: A problem with multi line edit box and check box Pin
David Crow8-Sep-04 5:49
David Crow8-Sep-04 5:49 

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.