Click here to Skip to main content
15,906,947 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHelp converting a demo project? Pin
DanYELL6-Feb-04 11:09
DanYELL6-Feb-04 11:09 
GeneralWINHTTP Pin
Jack Reed6-Feb-04 10:53
Jack Reed6-Feb-04 10:53 
GeneralRe: WINHTTP Pin
Gerald Schwab6-Feb-04 11:18
Gerald Schwab6-Feb-04 11:18 
GeneralRe: WINHTTP Pin
Jack Reed6-Feb-04 11:33
Jack Reed6-Feb-04 11:33 
GeneralCallback function within a class Pin
Cael6-Feb-04 9:58
Cael6-Feb-04 9:58 
GeneralRe: Callback function within a class Pin
Antti Keskinen6-Feb-04 11:12
Antti Keskinen6-Feb-04 11:12 
GeneralRe: Callback function within a class Pin
Cael6-Feb-04 13:20
Cael6-Feb-04 13:20 
GeneralRe: Callback function within a class Pin
Antti Keskinen8-Feb-04 9:59
Antti Keskinen8-Feb-04 9:59 
The option number two is correct.

However, I wouldn't recommend replacing the original window procedure. Instead, register a new window class, call it "MyButton", for example. Implement a handler for WM_PAINT, then use DrawEdge SDK function to draw the button edges and place the text on the button. This allows a much greater degree of control on how the button looks and behaves.

I suggest this method mainly because if you replace the original procedure, you must restore it as well when a WM_DESTROY message comes, otherwise the button control might not get freed properly, thus resulting a memory leak.

Here is an article I found while surfing the web. It gives you a basic idea on how to implement an MFC-style window class wrapper. Basically, it has a window procedure method as a non-static function, then it has a static message router function, which is passed to the window class registration. The router, on the other hand, is able to get the correct instance of the class from the passed variables (WPARAM and LPARAM) and then call the appropriate message handler. This behaviour is required if you create multiple objects from the same class.

The article itself can be found here[^].

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: Callback function within a class Pin
Cael8-Feb-04 16:32
Cael8-Feb-04 16:32 
GeneralHelp with MFC forms Pin
iboux6-Feb-04 9:52
iboux6-Feb-04 9:52 
GeneralRe: Help with MFC forms Pin
David Crow6-Feb-04 10:52
David Crow6-Feb-04 10:52 
QuestionUse CreateThread or _beginthreadex? Pin
xatanu6-Feb-04 9:41
xatanu6-Feb-04 9:41 
AnswerRe: Use CreateThread or _beginthreadex? Pin
Andrew Walker6-Feb-04 17:48
Andrew Walker6-Feb-04 17:48 
AnswerRe: Use CreateThread or _beginthreadex? Pin
Alexander M.,7-Feb-04 3:04
Alexander M.,7-Feb-04 3:04 
GeneralCMainFrame in DLL Pin
sjcomp6-Feb-04 9:04
sjcomp6-Feb-04 9:04 
GeneralImage processing! Pin
tuantt6-Feb-04 8:42
tuantt6-Feb-04 8:42 
GeneralRe: Image processing! Pin
sjcomp6-Feb-04 9:11
sjcomp6-Feb-04 9:11 
GeneralRe: Image processing! Pin
l a u r e n6-Feb-04 15:32
l a u r e n6-Feb-04 15:32 
General(Newbie) Outlining in VC7 IDE Pin
Ravi Bhavnani6-Feb-04 8:31
professionalRavi Bhavnani6-Feb-04 8:31 
GeneralRe: (Newbie) Outlining in VC7 IDE - edited Pin
Michael P Butler6-Feb-04 8:47
Michael P Butler6-Feb-04 8:47 
GeneralRe: (Newbie) Outlining in VC7 IDE - edited Pin
Ravi Bhavnani6-Feb-04 8:53
professionalRavi Bhavnani6-Feb-04 8:53 
GeneralRe: (Newbie) Outlining in VC7 IDE - edited Pin
l a u r e n6-Feb-04 15:33
l a u r e n6-Feb-04 15:33 
GeneralRe: (Newbie) Outlining in VC7 IDE - edited Pin
Ravi Bhavnani6-Feb-04 15:44
professionalRavi Bhavnani6-Feb-04 15:44 
GeneralRe: (Newbie) Outlining in VC7 IDE - edited Pin
l a u r e n6-Feb-04 15:47
l a u r e n6-Feb-04 15:47 
GeneralRe: (Newbie) Outlining in VC7 IDE - edited Pin
Ravi Bhavnani6-Feb-04 15:57
professionalRavi Bhavnani6-Feb-04 15:57 

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.