DoronAviad
asked on
hWndAccessApp in .Net
How can I change vb code with hWndAccessApp
to VB Dot Net code ?
what is the command that replace hWndAccessApp
to VB Dot Net code ?
what is the command that replace hWndAccessApp
I don't understand your question. hWndAccessApp is a VBA command to get a handle to the main Access window. What is the context for this question? What do you need the main window handle? Are you using Access COM interop?
ASKER
There are some API that neeed the application hWnd
How can I return it from Dor Net VB Forms ?
How can I return it from Dor Net VB Forms ?
There is a Handle property on forms.
ASKER
Sorry I need the hWnd
Can you please show me code example
Can you please show me code example
If you need to find a window handle, then you can use FindWindow API call.
FindWindow (user32)
http://www.pinvoke.net/default.aspx/user32.FindWindow
FindWindow (user32)
http://www.pinvoke.net/default.aspx/user32.FindWindow
'// VB (chellios at gmail dot com)
'// Open up a blank Notepad!
Dim lpszParentClass As String = "Notepad"
Dim lpszParentWindow As String = "Untitled - Notepad"
Dim lpszClass As String = "Edit"
Dim ParenthWnd As New IntPtr(0)
Dim hWnd As New IntPtr(0)
ParenthWnd = FindWindow(lpszParentClass, lpszParentWindow)
If ParenthWnd.Equals(IntPtr.Zero) Then
Debug.WriteLine("Notepad Not Running!")
Else
hWnd = FindWindowEx(ParenthWnd, hWnd, lpszClass, "")
If hWnd.Equals(IntPtr.Zero)
Debug.WriteLine("Notepad doesn't have an Edit component, how strange.")
Else
Debug.WriteLine("Notepad Window: " & ParenthWnd.ToString())
Debug.WriteLine("Edit Control: " & hWnd.ToString())
End If
End If
ASKER
if I have Form1 in Dot Net WinForms application
How can I get the hWnd ?
How can I know the Class and Window ?, Do I need them or there is a way to get it from
Form1.handle ?
How can I get the hWnd ?
How can I know the Class and Window ?, Do I need them or there is a way to get it from
Form1.handle ?
Are you talking about the window handle inside of your application, or outside? If it is outside, you can enumerate the windows, or use something like Spy++ to examine the details of the open windows.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.