【问题标题】:Visual c++ CLR how to send windows message?Visual c++ CLR如何发送windows消息?
【发布时间】:2013-03-27 05:53:29
【问题描述】:
private:
    #define WM_SETTEXT                      0x000C

    void doSomethinggToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) 
    {
         SendMessage(this->Handle, WM_SETTEXT, (wPARAM)"Some Window Title", 0);
    }

导致以下错误:

error C2065: 'wPARAM' : undeclared identifier
error C2143: syntax error : missing ')' before 'string'
error C2059: syntax error : ')'

this->Handle

【问题讨论】:

  • 您是否加入了<windows.h>
  • 是的,乔伊 .... 包括在内。当我将鼠标悬停在它上面时,会显示函数(LRESULT)。

标签: .net winapi c++-cli


【解决方案1】:

您需要的符号是WPARAM(全部大写),而不是“wPARAM”。

还要注意WM_SETTEXT实际上将字符串参数作为lParam的值,而不是wParam

SendMessage(this->Handle, WM_SETTEXT, 0, (LPARAM)"Some Window Title");

【讨论】:

  • 谢谢你,但是……error C2065: 'WPARAM' : undeclared identifier,也许我太困了……但我已经想了很久了:)
猜你喜欢
  • 2012-12-07
  • 1970-01-01
  • 1970-01-01
  • 2012-07-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多