Click here to Skip to main content
16,012,034 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Ruler Control Pin
26-Feb-01 8:24
suss26-Feb-01 8:24 
GeneralRe: Ruler Control Pin
l a u r e n26-Feb-01 10:41
l a u r e n26-Feb-01 10:41 
GeneralRe: Ruler Control Pin
26-Feb-01 22:56
suss26-Feb-01 22:56 
GeneralRe: Ruler Control Pin
Erik Funkenbusch26-Feb-01 12:43
Erik Funkenbusch26-Feb-01 12:43 
GeneralRe: Ruler Control Pin
26-Feb-01 23:26
suss26-Feb-01 23:26 
GeneralCasting thread functions Pin
Joe Moldovan23-Feb-01 23:53
Joe Moldovan23-Feb-01 23:53 
GeneralRe: Casting thread functions Pin
Tim Deveaux24-Feb-01 3:57
Tim Deveaux24-Feb-01 3:57 
GeneralRe: Casting thread functions Pin
Joe Moldovan24-Feb-01 9:32
Joe Moldovan24-Feb-01 9:32 
Thanks for your thoughts Tim. The problem with static member functions is that you have the same function for each instance. This means that there can only be a single thread running for all of my read processes. This is not suitable for my application. I need a unique thread function in each class instance for a number of reasons.

Now comes the interesting part. My little "cast" definitely works for compiling a member function to be the thread procedure. However, class members are ONLY visible if a pointer to the class is passed as the thread parameter. For example (called from my object initialisation routine),

m_thread = CreateThread( NULL, 0, z.y, this, 0, &m_threadId );

NOTE that I do not use the lpParameter at all, I just pass it. I acces members without a pointer i.e. m_count not ((int *)lpParameter)->m_count. If lpParameter is set to null, the function is still started by the CreateThread but "this" is seen as NULL and the member functions are not visible. I read the doco to mean that the lpParameter is passed for my use but it seems that Windows is using it to overwrite "this" somehow. Go figure....



GeneralRe: Casting thread functions Pin
aes24-Feb-01 10:49
aes24-Feb-01 10:49 
GeneralRe: Casting thread functions Pin
Joe Moldovan24-Feb-01 14:34
Joe Moldovan24-Feb-01 14:34 
GeneralRe: Casting thread functions Pin
Tim Deveaux24-Feb-01 15:07
Tim Deveaux24-Feb-01 15:07 
GeneralRe: Casting thread functions Pin
Joe Moldovan24-Feb-01 18:21
Joe Moldovan24-Feb-01 18:21 
GeneralRe: Casting thread functions Pin
NormDroid25-Feb-01 5:41
professionalNormDroid25-Feb-01 5:41 
GeneralRe: Casting thread functions Pin
Tim Deveaux24-Feb-01 14:58
Tim Deveaux24-Feb-01 14:58 
GeneralRe: Casting thread functions Pin
Todd Wilson24-Feb-01 15:20
Todd Wilson24-Feb-01 15:20 
GeneralRe: Casting thread functions Pin
Tim Deveaux24-Feb-01 15:32
Tim Deveaux24-Feb-01 15:32 
GeneralRe: Casting thread functions Pin
Erik Funkenbusch26-Feb-01 12:55
Erik Funkenbusch26-Feb-01 12:55 
GeneralRe: Casting thread functions Pin
Todd Wilson26-Feb-01 13:13
Todd Wilson26-Feb-01 13:13 
GeneralRe: Casting thread functions Pin
Erik Funkenbusch26-Feb-01 13:32
Erik Funkenbusch26-Feb-01 13:32 
GeneralRe: Casting thread functions Pin
Joe Moldovan24-Feb-01 17:44
Joe Moldovan24-Feb-01 17:44 
GeneralRe: Casting thread functions Pin
Tim Deveaux25-Feb-01 5:13
Tim Deveaux25-Feb-01 5:13 
GeneralRe: Casting thread functions Pin
Erik Funkenbusch26-Feb-01 13:11
Erik Funkenbusch26-Feb-01 13:11 
GeneralRe: Casting thread functions Pin
Joe Moldovan26-Feb-01 19:45
Joe Moldovan26-Feb-01 19:45 
QuestionHow to use handle_wm_notify macro which comes with win32? Pin
Sachin23-Feb-01 23:04
Sachin23-Feb-01 23:04 
AnswerRe: How to use handle_wm_notify macro which comes with win32? Pin
Sardaukar24-Feb-01 1:23
Sardaukar24-Feb-01 1:23 

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.