- 864 名前:いのぶー mailto:sage [2008/06/05(木) 22:58:59 ]
- ペイントを操作して、絵を描こうとしているのですが、ウィンドウをポップアップできてもドローイングエリアを
クリックできません。 C#の板でスルーされたのでやってきました、お願いいたします、教えていただけませんでしょうか? 。 [DllImport("USER32.DLL")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("USER32.DLL")] public static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern IntPtr FindWindowEx(IntPtr hWnd, IntPtr hwndChildAfter, String lpszClass, String lpszWindow); [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, Int32 wParam, Int32 lParam); [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect); [StructLayout(LayoutKind.Sequential)] public struct RECT { public int left; public int top; public int right; public int bottom; } const uint WM_LBUTTONDOWN = 0x201; const uint WM_LBUTTONUP = 0x202; public void RemotePaint() { IntPtr hWnd = FindWindow("MSPaintApp", null); SetForegroundWindow(hWnd); hWnd = FindWindowEx(hWnd, IntPtr.Zero, "AfxFrameOrView42u", null); RECT winRect = new RECT(); GetWindowRect(hWnd, ref winRect); PostMessage(hWnd, WM_LBUTTONDOWN, winRect.right - winRect.left, winRect.bottom - winRect.top); PostMessage(hWnd, WM_LBUTTONUP, winRect.right - winRect.left, winRect.bottom - winRect.top); }
|

|