Click here to Skip to main content
15,913,242 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Maximaze window ??? Pin
Larsson7-Jul-04 7:04
Larsson7-Jul-04 7:04 
GeneralRe: Maximaze window ??? Pin
jmkhael7-Jul-04 7:08
jmkhael7-Jul-04 7:08 
Generaluser mapping of shortcut keys Pin
John R. Shaw7-Jul-04 6:38
John R. Shaw7-Jul-04 6:38 
GeneralRe: user mapping of shortcut keys Pin
DavidR_r7-Jul-04 8:49
DavidR_r7-Jul-04 8:49 
GeneralRe: user mapping of shortcut keys Pin
John R. Shaw7-Jul-04 9:47
John R. Shaw7-Jul-04 9:47 
GeneralChging default printers Pin
Jim Barrett7-Jul-04 6:28
Jim Barrett7-Jul-04 6:28 
Generalsubclassing in win32 Pin
Manu817-Jul-04 6:14
Manu817-Jul-04 6:14 
GeneralRe: subclassing in win32 Pin
Antti Keskinen7-Jul-04 10:54
Antti Keskinen7-Jul-04 10:54 
Subclassing is quite powerful, actually. Not only can you get a pre-sniff on what is going to happen, you can get a post-sniff as well.

The trick with post-sniffing is that you call the original window procedure first and save it's return value into a local variable. When this is done, check the uMsg parameter. If it is 'WM_PAINT', then enter a handler. In this handler, get the button's DC (You have the HWND, so just use GetDC).

Then create a compatible DC with this one. Load the bitmap from file/resource. Select the bitmap into the memory DC. Blit from the memory DC into the button's DC so, that the starting point of the blit operation is NOT in point 0,0, but somewhere more to the middle. How middle it is is determined by the size of the bitmap and where you want it on the button. Use GetWindowRect to get the bouding rectangle of the button's DC. Then do math Smile | :)

But, all in all, the idea is to first allow the original window procedure to run, then do post-processing by applying the bitmap. Allowing the original procedure to run first ensures that the borders and the button state (normal/sunken) are drawn correctly.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralHooK API Problem Pin
cyberkit7-Jul-04 5:19
cyberkit7-Jul-04 5:19 
GeneralHyper-threading and MSDev6 Pin
[d3m0n]7-Jul-04 4:55
[d3m0n]7-Jul-04 4:55 
GeneralInstalling fonts .ttf and Type 1 Pin
Anonymous7-Jul-04 4:15
Anonymous7-Jul-04 4:15 
GeneralInstalling fonts .ttf and Type 1 Pin
Anonymous7-Jul-04 4:13
Anonymous7-Jul-04 4:13 
GeneralRe: Installing fonts .ttf and Type 1 Pin
David Crow7-Jul-04 4:47
David Crow7-Jul-04 4:47 
GeneralRe: Installing fonts .ttf and Type 1 Pin
Anonymous7-Jul-04 6:11
Anonymous7-Jul-04 6:11 
GeneralAccessing a web Service from VC++ application Pin
Member 5343577-Jul-04 3:51
Member 5343577-Jul-04 3:51 
GeneralRe: Accessing a web Service from VC++ application Pin
Antti Keskinen7-Jul-04 12:27
Antti Keskinen7-Jul-04 12:27 
GeneralRe: Accessing a web Service from VC++ application Pin
Member 5343578-Jul-04 3:13
Member 5343578-Jul-04 3:13 
GeneralRe: Accessing a web Service from VC++ application Pin
Antti Keskinen8-Jul-04 9:48
Antti Keskinen8-Jul-04 9:48 
QuestionAny suggestions on a parser? Pin
prcarp7-Jul-04 3:16
prcarp7-Jul-04 3:16 
AnswerRe: Any suggestions on a parser? Pin
siggapet7-Jul-04 3:26
siggapet7-Jul-04 3:26 
AnswerRe: Any suggestions on a parser? Pin
palbano7-Jul-04 4:00
palbano7-Jul-04 4:00 
AnswerRe: Any suggestions on a parser? Pin
Andrew Walker7-Jul-04 14:21
Andrew Walker7-Jul-04 14:21 
GeneralRe: Any suggestions on a parser? Pin
prcarp25-Jul-04 20:39
prcarp25-Jul-04 20:39 
QuestionMaking an Edit multiline? Pin
steven117-Jul-04 1:56
steven117-Jul-04 1:56 
AnswerRe: Making an Edit multiline? Pin
siggapet7-Jul-04 3:49
siggapet7-Jul-04 3: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.