NaturalDemon
NaturalDemon

Reputation: 1014

Visual c++ CLR how to send windows message?

private:
    #define WM_SETTEXT                      0x000C

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

results in the following errors:

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

this->Handle <--- (error) no suiteble conversion from System::IntPtr to HWND

Upvotes: 1

Views: 1273

Answers (1)

Jonathan Potter
Jonathan Potter

Reputation: 37202

The symbol you need is WPARAM (all uppercase), not 'wPARAM'.

Also note that WM_SETTEXT actually takes the string parameter as the lParam value, not wParam:

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

Upvotes: 1

Related Questions