Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4051662
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:13:21+00:00 2026-05-20T14:13:21+00:00

According to my research, when I run C# executable which opens WinForm, within .NET,

  • 0

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.

Then I came across 3 functions from API.

FindWindow();
GetWindowLong();
CallWindowProc()

I need to call it from top down to the bottom but then I got stuck by CallWIndowProc() because
I can’t figure what I should pass for last 3 arguments.

private static extern UIntPtr CallWindowProc(IntPtr a, IntPtr b, uint c, IntPtr d, IntPtr e);

c, d and e

According to the doc, it should be some sort of “message” which is int. But where can I get such value???

http://msdn.microsoft.com/en-us/library/ms633571(v=vs.85).aspx

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);
 }

Clarification

OK.. I should have made it clear.. my goal is to run following chunk of code against the WebForm being executed. (I’ts WatiN)

var t = new Thread(() =>
{
  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();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:13:22+00:00Added an answer on May 20, 2026 at 2:13 pm

    What message you are trying to send to callWinProc?

    Arguments are

    nProc is a value returned previously by SubClassWindow() (Source Window).

    hWnd is the handle to the window that was subclassed (target window).

    nMsg is the message (one of the WM_* values defined in WINDOWS.CH, basically kind of event or message like click is one message). For complete system messages see http://msdn.microsoft.com/en-us/library/ms644927(v=vs.85).aspx#system_defined

    wParam depends on nMsg. For click, it takes left or right click

    lParam depends on nMsg. for click it takes the location as lparam

    you can see wparam and lparam defination for each message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I developed app using JPA Toplink which uses JPQL. According to my research JPA
According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to
according to my research, it isn't possible... unless i write one big hack (erk)
According to my research whilst trying to solve this problem, it turns out that
I'm starting my research on web application frameworks and according to what I've read,
According to this answer ,it should print all function names: [root@ test]# cat hw.c
According to this discussion , the iphone agreement says that it doesn't allow loading
According to the manual , git dcommit will create a revision in SVN for
According to MSDN form.RightToLeftLayout = True; form.RightToLeft = ifWeWantRTL() ? RightToLeft.True : RightToLeft.False; is
According to select name from system_privilege_map System has been granted: SELECT ANY TABLE ...and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.