Tips Forum Logo
Tips Forum Home PageSpacerVisit Microsoft Knowledge BaseMAUG Home PageMAUG Russian Home Page

INF:Вызов функции ShellExecute, имеет больше возможностей для запуска программ, чем Shell в Access
INF: Using function ShellExecute to run applications

Applies to: Access 32 bit (95,97, 2000, XP & 2003)


Declare Function apiShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal Hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Declare Function GetDesktopWindow Lib "user32" () As Long

Public Const SW_NORMAL = 1
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_SHOWDEFAULT = 10
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOWNORMAL = 1

lResult = apiShellExecute(frmSplash.hwnd, vbNullString, "TEST.XLS",_
vbnullstring, App.Path, SW_SHOWMAXIMIZED)

lResult = apiShellExecute(GetDesktopWindow(), "open", "http://www.arimsoft.ru"_
, "", 0&, SW_SHOWMAXIMIZED)

Where
frmSplash.hwnd is the calling form's handle
the second param indicates to open the file (you can use "Open" or "Print" as well)
the third is the file name to open
the next is to show I'm not passing any parameters
Then there's the default directory to use
And finally to maiximize it (value 3)

From  MAUG , Entry Date 29.05.97



Microsoft Access Solutions

Written and designed by
Alex Dybenko
Send us your comments
Last Update: 2007-10-15
Copyright © 1998-2007 by MAUG

Alex & Access