Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows API Functions in C#

Status
Not open for further replies.

Doughy

Technical User
Mar 21, 2005
1
US
Does anyone know how to use simple windows API functions such as "Findwindow" using C#.net?
 
[DllImport("user32.dll",EntryPoint="FindWindow",CharSet=CharSet.UNICODE)]
Public static extern int MyFindWindow(string _WindowClassName, string _WindowName);

Using g**gle won't hurt you, you know?
 
I am capturing the window handle of an external application (or any external app) using the GetForegroundWindow() api function. Once I have the handle I want to locate a field and send write text to that field. It seems that in VB6 there was a way to locate what the field of a window was after you grabbed the handle for that window. Does anyone know of a way to do this in C#?

Thank you
 
I can sort of fake this using the SetActiveWindow(int hWnd) function and then using SendKeys.Send() to send the text. Kind of dirty but it is working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top