:D
I did it myself using WM_PAINT. But the answer is upto the mark.
Thank you.
Main Topics
Browse All TopicsHi all,
I am developing a button class using the OWNERDRAW property. I need to handle the WM_DRAWITEM inside the Button class itself. Actually it goes to the parents' WndProc. How to go about this?
TIA.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: AvdeyPosted on 2003-01-14 at 11:21:54ID: 7726878
Hi!
CEDGE, "BUTTON",
dButton, GWL_WNDPROC, (LONG)(FARPROC)NewButtonWn dProc);
dProc, hwndButton, uMsg, wParam, lParam);
You can change default button WndProc to your own, and process WM_PAINT message :
//Create button and change default WndProc
hwndButton = CreateWindowEx(WS_EX_STATI
"Button text",
WS_VISIBLE | WS_CHILD | BS_OWNERDRAW,
5, 175, 70, 25,
hwndOwner, (HMENU)IDB_BUTTONID,
hInstance, NULL);
OldButtonWndProc = (FARPROC)SetWindowLong(hwn
//NewButtonWndProc
LRESULT CALLBACK NewButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_PAINT:
//place your painting code here
return 0;
default://process other messages
return CallWindowProc(OldButtonWn
}
}
Enjoy!
Avdey.