首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VC >

API常量有关问题

2011-12-17 
API常量问题.C/C++ codeprivate: System::Void button1_Click(System::Object^sender, System::EventArgs^

API常量问题.

C/C++ code
    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e)              {                    HWND hwnd;                    hwnd=::FindWindow("ThunderRT6FormDC","Form1");                    char c[255];                    ::GetWindowTextA(hwnd,c,255);    //这里可以正常取得窗体的名字                    ::PostMessage(hwnd,BM_CLICK,0,0);        //这里怎么发送不了BM_CLICK             }


请问一下,BM_CLICK用定义吗?如果用的话请问怎么定义.如果不用的话,为什么PostMessage没有成功!

[解决办法]
http://msdn.microsoft.com/en-us/library/bb775985(VS.85).aspx

Remarks

If the button is in a dialog box and the dialog box is not active, the BM_CLICK message might fail. To ensure success in this situation, call the SetActiveWindow function to activate the dialog box before sending the BM_CLICK message to the button.

热点排行