Click here to Skip to main content
15,911,646 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Handling Window restore Pin
sheetal_0622-Nov-06 17:01
sheetal_0622-Nov-06 17:01 
QuestionWildcards in VC++ Pin
Programm3r22-Nov-06 1:42
Programm3r22-Nov-06 1:42 
AnswerRe: Wildcards in VC++ Pin
Chris Losinger22-Nov-06 2:19
professionalChris Losinger22-Nov-06 2:19 
QuestionRe: Wildcards in VC++ Pin
Programm3r22-Nov-06 2:37
Programm3r22-Nov-06 2:37 
AnswerRe: Wildcards in VC++ Pin
Chris Losinger22-Nov-06 2:59
professionalChris Losinger22-Nov-06 2:59 
GeneralRe: Wildcards in VC++ Pin
Programm3r22-Nov-06 3:03
Programm3r22-Nov-06 3:03 
QuestionWindowProc and window class registration issue Pin
Tnarol22-Nov-06 1:41
Tnarol22-Nov-06 1:41 
AnswerRe: WindowProc and window class registration issue Pin
Cedric Moonen22-Nov-06 2:25
Cedric Moonen22-Nov-06 2:25 
This is because the functions don't have the same prototype: for the member function, there is a implicit parameter passed, the this parameter (allowing the function to know to which instance it belongs to).

To overcome this problem, when you create your window (use CreateWindow), you can pass a pointer to user data. Pass the this parameter, so that the first time your static window procedure gets called, it will receive the instance of the class. Then, register this pointer with SetWindowLong (it will associate the instance pointer with the handle of the window):

if (Msg == WM_CREATE)<br />
   SetWindowLong(hWnd, GWL_USERDATA,(long) ( (LPCREATESTRUCT(lParam))->lpCreateParams));


Then, after each call of your static procedure, you are able to retrieve the class instance and call a public non-static window procedure:

CMyClass* pClass = (CMyClass*)GetWindowLong(hWnd,GWL_USERDATA);

hWnd is the handle of the window passed as parameter to the procedure. Check the different functions in the doc for more details.

Hope this helps


Cédric Moonen
Software developer

Charting control [v1.1]

GeneralRe: WindowProc and window class registration issue Pin
Tnarol22-Nov-06 5:12
Tnarol22-Nov-06 5:12 
GeneralRe: WindowProc and window class registration issue Pin
Cedric Moonen22-Nov-06 5:44
Cedric Moonen22-Nov-06 5:44 
GeneralRe: WindowProc and window class registration issue Pin
Tnarol22-Nov-06 21:28
Tnarol22-Nov-06 21:28 
QuestionFFT(Fast Fourier) to find frequencies Pin
Mikaa12322-Nov-06 1:21
Mikaa12322-Nov-06 1:21 
QuestionDraw controls in Property Sheet Pin
Susanmat22-Nov-06 1:20
Susanmat22-Nov-06 1:20 
AnswerRe: Draw controls in Property Sheet Pin
Galatei22-Nov-06 3:42
Galatei22-Nov-06 3:42 
GeneralRe: Draw controls in Property Sheet Pin
Susanmat22-Nov-06 20:37
Susanmat22-Nov-06 20:37 
Questioncomponent(Borland C++) Pin
lightchin22-Nov-06 1:15
lightchin22-Nov-06 1:15 
QuestionSending mail without specifying SMTP server [modified] Pin
Mahesh Kulkarni22-Nov-06 1:05
Mahesh Kulkarni22-Nov-06 1:05 
AnswerRe: Sending mail without specifying SMTP server Pin
Galatei22-Nov-06 3:55
Galatei22-Nov-06 3:55 
GeneralRe: Sending mail without specifying SMTP server Pin
Mahesh Kulkarni22-Nov-06 17:49
Mahesh Kulkarni22-Nov-06 17:49 
QuestionSCROLLINFO.nPage Pin
cartman0921-Nov-06 23:32
cartman0921-Nov-06 23:32 
AnswerRe: SCROLLINFO.nPage Pin
CPallini21-Nov-06 23:57
mveCPallini21-Nov-06 23:57 
GeneralRe: SCROLLINFO.nPage Pin
cartman0922-Nov-06 3:11
cartman0922-Nov-06 3:11 
GeneralRe: SCROLLINFO.nPage Pin
CPallini22-Nov-06 4:05
mveCPallini22-Nov-06 4:05 
QuestionProgram release with CRT library problem Pin
LiYS21-Nov-06 23:20
LiYS21-Nov-06 23:20 
Questionis this the right way or is there any other better way??? Pin
vijay_aroli21-Nov-06 22:41
vijay_aroli21-Nov-06 22:41 

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.