Note that there are some explanatory texts on larger screens.

plurals
  1. POwhere do I get arguments of win32 API function CallWindowProc()?
    primarykey
    data
    text
    <p>According to my research, when I run C# executable which opens WinForm, within .NET, they don't offer the function to access those WinForm object from separate c# process (separate file I mean) but win32 API does.</p> <p>Then I came across 3 functions from API.</p> <pre><code>FindWindow(); GetWindowLong(); CallWindowProc() </code></pre> <p>I need to call it from top down to the bottom but then I got stuck by <code>CallWIndowProc()</code> because I can't figure what I should pass for last 3 arguments.</p> <pre><code>private static extern UIntPtr CallWindowProc(IntPtr a, IntPtr b, uint c, IntPtr d, IntPtr e); c, d and e </code></pre> <p>According to the doc, it should be some sort of "message" which is int. But where can I get such value???</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms633571(v=vs.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms633571(v=vs.85).aspx</a></p> <p><strong>Code:</strong></p> <pre><code> [DllImportAttribute("User32.dll")] private static extern IntPtr FindWindow(String ClassName, String WindowName); [DllImportAttribute("User32.dll")] private static extern long GetWindowLong(IntPtr a, int b); [DllImportAttribute("User32.dll")] private static extern UIntPtr CallWindowProc(IntPtr a, IntPtr b, uint c, IntPtr d, IntPtr e); [STAThread] static void Main(string[] args) { IntPtr lResult; uint lMsg = 0; IntPtr HWND = FindWindow("WindowsFormsApplication1.Form1", "Form1"); int GWL_WNDPROC = -4; long WNDPROC = GetWindowLong(HWND, GWL_WNDPROC); lResult = CallWindowProc(WNDPROC, HWND, lMsg, 0, 0); } </code></pre> <p><strong>Clarification</strong></p> <p>OK.. I should have made it clear.. my goal is to run following chunk of code against the WebForm being executed. (I'ts WatiN)</p> <pre><code>var t = new Thread(() =&gt; { Settings.AutoStartDialogWatcher = false; var ie = new IE(form1.webBrowser1.ActiveXInstance); ie.GoTo("http://www.google.com"); ie.TextField(Find.ByClass("lst")).TypeText("this is awesome!!"); ie.Button(Find.ByName("btnG")).Click(); }); t.SetApartmentState(ApartmentState.STA); t.Start(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload