Nikil
Nikil

Reputation: 369

How to pass the handle fetched from spy++ in sendmessage using c#?

How to pass the handle which I got using spy++ tool in sendmessage? ie. I want to pass this handle

Handle Got from spy++ 00010540

in this function

SendMessage(buttonHandle, WM_HSCROLL, (IntPtr)SB_LINERIGHT, IntPtr.Zero);

where button handle is of type IntPtr.I want to substitute buttonhandle with the above value. Thanks

Upvotes: 1

Views: 2222

Answers (1)

detunized
detunized

Reputation: 15289

Just new IntPtr(0x00010540) should work. For example like this:

[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr SendMessage(
    IntPtr hWnd, 
    UInt32 Msg, 
    IntPtr wParam, 
    IntPtr lParam);

SendMessage(
    new IntPtr(0x00010540), 
    0x0112,                 // WM_SYSCOMMAND
    new IntPtr(0xF020),     // SC_MINIMIZE
    IntPtr.Zero);

Upvotes: 1

Related Questions