Jump to content
Tuts 4 You

how to draw MessageBox buttons


alaphate

Recommended Posts

Posted (edited)

I found a article about how to change the button text of MessageBox.

http://www.codeguru.com/cpp/w-p/win32/mess...icle.php/c10873

Could Any buddy tell me how to draw MessageBox buttons?

Such as IDOK button IDCANCEL button

I know how to make these buttons to OWNERDRAW buttons in CBTProc hook procedure.

i.e. SendMessage(hMB,BM_SETSTYLE,BS_OWNERDRAW,TRUE);

However, I don't figure out how to draw these buttons.

Thanks for help.

Edited by alaphate
Posted (edited)

mudlord, you might misunderstand my opinion.

Here's a example of my application.

cpp, c language is perferred. Thanks a lot.

bmpBtn.zip

Edited by alaphate
Posted

I see what you want to do now. Thanks for the example.

Posted

I figured out how to change the MessageBox's button style.

Use:

SetWindowsHookEx(WH_CALLWNDPROC, &CallWndProc, 0, GetCurrentThreadId());

LRESULT CALLBACK CallWndProc(INT nCode, WPARAM wParam, LPARAM lParam) {

CWPSTRUCT *pMsg= (CWPSTRUCT *)lParam;

switch (pMsg->message) {

case WM_DRAWITEM:

//draw Buttons here

}

}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...