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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open MS Access using FindWindow

Status
Not open for further replies.

pullingteeth

Programmer
Sep 26, 2003
128
US
Hello, I'm attempting to open MS Access using some EXTRA Basic commands:


Declare Function ShowWindow Lib "User" (ByVal hWnd As Integer, ByVal nCmdShow As Integer) As Integer

Declare Function FindWindow Lib "User" (ByVal szClass$, ByVal lpsz As Long) as Integer


...


Hwnd% = FindWindow("hWndAccessApp",0)
x% = ShowWindow(Hwnd%,1)



I'm unsure of two things: should Lib be "User" or "User.exe", and what is the name of MS Access's window?

Thanks!
 
And what about the AppActivate function ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hello, I'm a beginner to windows APIs. If your suggestion is better than FindWindow, where can I find reference to AppActivate, and what should I pass it so that it can find Access?

Thanks
 
Simply in your VBA help file.
You're in a VBA forum here, not a Win32API one.
Go to VBE [Alt-F11), open the immediate (debug) window (Ctrl-G), type appactivate and press F1
Note: sorry for the typo, AppActivate is an instruction, not a function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
The FindWindow API searches all of the Open Top Level Windows, and returns the handle to the one which matches the classname/windowname specified in the parameters. It will not find the Access window, unless Access is already open.

The Name of the Access Window is "Microsoft Access", provided it has not been changed by a running application.

hWndAccessApp is the handle to the Access Window. In other words, if Access is running, and you issued the following FindWindow command:

hWnd = FindWindow ("", "Microsoft Access")

the value returned will be the same as hWndAccessApp (assuming only 1 copy of Access is running).

If what you trying to do is open a new Access window, then I would look at the ShellExecute API.

Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top