读书人

最后的分所有给你

发布时间: 2012-06-30 17:20:12 作者: rapoo

最后的分,全部给你!
请各位亲们帮我看看我这个程序,为什么总是在出现这一个端点,我真的没折了,最后的分数只给一位亲哈!希望大家多多帮忙哈!

case WM_COMMAND:(主要是为了响应BUTTON按钮)
if((HIWORD(wParam)==BN_CLICKED)&&((HWND)lParam==hButton))//////////////////////////(就是这里老是中断哈)!
{
HDC hdc3,hdc4;

HBITMAP kaishi;

hdc3=GetDC(hwnd);

kaishi=(HBITMAP)LoadImage(NULL,TEXT("白纸一张"),IMAGE_BITMAP,1050,630,LR_DEFAULTCOLOR|LR_LOADFROMFILE);

hdc4=CreateCompatibleDC(NULL);

SelectObject(hdc4,kaishi);

BitBlt(hdc3,0,0,1050,630,hdc4,0,0,SRCCOPY);

ReleaseDC(hwnd,hdc3);

DeleteDC(hdc4);
}
break;

[解决办法]
WM_COMMAND
wNotifyCode = HIWORD(wParam); // notification code
wID = LOWORD(wParam); // item, control, or accelerator identifier
hwndCtl = (HWND) lParam;

//
wNotifyCode
Value of the high-order word of wParam. Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0.


#define BN_CLICKED 0
用:
wID = LOWORD(wParam);
试试
[解决办法]
if((HIWORD(wParam)==BN_CLICKED)&&((HWND)lParam==hButton))//////////////////////////(就是这里老是中断哈)!
========
wParam和lParam用的都没有问题,hButton有没有错呢?

读书人网 >VC/MFC

热点推荐