Click here to Skip to main content
15,891,529 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionproblem to run Multy thread program on specific PC Pin
Michae_geffen14-Apr-08 19:04
Michae_geffen14-Apr-08 19:04 
QuestionRe: problem to run Multy thread program on specific PC Pin
Rajesh R Subramanian14-Apr-08 19:28
professionalRajesh R Subramanian14-Apr-08 19:28 
GeneralRe: problem to run Multy thread program on specific PC Pin
Jonathan [Darka]14-Apr-08 21:24
professionalJonathan [Darka]14-Apr-08 21:24 
QuestionChanging printer settings Pin
SquirrelEx14-Apr-08 17:51
SquirrelEx14-Apr-08 17:51 
GeneralRe: Changing printer settings Pin
Krishnakumartg14-Apr-08 18:37
Krishnakumartg14-Apr-08 18:37 
GeneralRe: Changing printer settings Pin
SquirrelEx14-Apr-08 23:17
SquirrelEx14-Apr-08 23:17 
General_beginthreadex VS CreateThread and, ThreadId vs Thread Handle Pin
ForNow14-Apr-08 17:40
ForNow14-Apr-08 17:40 
GeneralRe: _beginthreadex VS CreateThread and, ThreadId vs Thread Handle Pin
Naveen14-Apr-08 17:53
Naveen14-Apr-08 17:53 
ForNow wrote:
_beginthreadex instead of CreateThread or visa versa


_beginthreadex() internally calls CreateThread for creating thread. In addition to creating thread, it will perform some CRT initializations also. So if you want to call some CRT functions inside the new thread, its better to use the _beginthreadex() function.

ForNow wrote:
The Value return from GetCurrentthreadId and GetCurrentThread


GetCurrentthreadId return the current thread ID where GetCurrentThread return the handle to current Thread.


ForNow wrote:
handle The GetCurrentthread API returns -1


If you call the GetCurrentthread(), it will always return 0xfffffffe. Actually this is a pseudo handle to the current thread. This value can be used only in that thread. The GetCurrentProcess() also returns a similar value - 0xffffffff.

If you want to get the correct handle value, you need to use the DuplicateHandle() function

HANDLE hRealHandle = 0;
DuplicateHandle( GetCurrentProcess(), // Source Process Handle.
                 GetCurrentThread(),  // Source Handle to dup.
                 GetCurrentProcess(), // Target Process Handle.
                 &hRealHandle,    // Target Handle pointer.
                 0,                   // Options flag.
                 TRUE,                // Inheritable flag
                 DUPLICATE_SAME_ACCESS );// Options



GeneralRe: _beginthreadex VS CreateThread and, ThreadId vs Thread Handle Pin
ForNow14-Apr-08 20:56
ForNow14-Apr-08 20:56 
GeneralDetecting if a message was simulated using SendInput Pin
bob1697214-Apr-08 11:10
bob1697214-Apr-08 11:10 
GeneralRe: Detecting if a message was simulated using SendInput Pin
Randor 14-Apr-08 16:06
professional Randor 14-Apr-08 16:06 
GeneralRe: Detecting if a message was simulated using SendInput Pin
bob1697214-Apr-08 17:25
bob1697214-Apr-08 17:25 
QuestionWM_MOUSEWHEEL Message Problem Pin
sdfghjkqwer14-Apr-08 8:00
sdfghjkqwer14-Apr-08 8:00 
QuestionRe: WM_MOUSEWHEEL Message Problem Pin
CPallini14-Apr-08 8:53
mveCPallini14-Apr-08 8:53 
GeneralRe: WM_MOUSEWHEEL Message Problem Pin
sdfghjkqwer14-Apr-08 9:00
sdfghjkqwer14-Apr-08 9:00 
GeneralRe: WM_MOUSEWHEEL Message Problem Pin
Graham Bradshaw14-Apr-08 9:36
Graham Bradshaw14-Apr-08 9:36 
GeneralRe: WM_MOUSEWHEEL Message Problem Pin
sdfghjkqwer14-Apr-08 9:39
sdfghjkqwer14-Apr-08 9:39 
GeneralRe: WM_MOUSEWHEEL Message Problem Pin
David Crow14-Apr-08 10:39
David Crow14-Apr-08 10:39 
GeneralRe: WM_MOUSEWHEEL Message Problem Pin
sdfghjkqwer14-Apr-08 10:56
sdfghjkqwer14-Apr-08 10:56 
GeneralRe: WM_MOUSEWHEEL Message Problem [modified] Pin
bob1697214-Apr-08 11:32
bob1697214-Apr-08 11:32 
GeneralRe: WM_MOUSEWHEEL Message Problem Pin
sdfghjkqwer14-Apr-08 12:07
sdfghjkqwer14-Apr-08 12:07 
GeneralRe: WM_MOUSEWHEEL Message Problem Pin
bob1697214-Apr-08 17:14
bob1697214-Apr-08 17:14 
QuestionProgrammatic (API) access to ISO files? Pin
MarkLTX14-Apr-08 5:59
MarkLTX14-Apr-08 5:59 
GeneralRe: Programmatic (API) access to ISO files? Pin
Jonathan [Darka]14-Apr-08 6:49
professionalJonathan [Darka]14-Apr-08 6:49 
GeneralRe: Programmatic (API) access to ISO files? Pin
MarkLTX14-Apr-08 7:39
MarkLTX14-Apr-08 7:39 

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.