By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,493 Members | 1,179 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,493 IT Pros & Developers. It's quick & easy.

Problem with Shell32 and filehandle

P: n/a
Hi All,

I'm having a problem with the Shell32.dll when I try to open a program
from my Access db.
When I try to open a program called FalconViewLite from my access
database I get an error in the FileHandle function. The message is
something like: Shell32.dll missing entry OpenAS_RunDLL!.
On another machine, also running WinXP the problem doesn't occur.

This is the code I use:

Private 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

Function fHandleFile(strFile As String, IShowHow As Long)
Dim IRet As Long, varTaskID As Variant
Dim stRet As String
'First try to shell execute
IRet = apiShellExecute(hWndAccessApp, vbNullString, _
strFile, vbNullString, vbNullString, IShowHow)
If IRet ERROR_SUCCESS Then
stRet = vbNullString
IRet = -1
Else
Select Case IRet
Case ERROR_NO_ASSOC:
'Try the OpenWith dialog
varTaskID = Shell("rundll32.exe shell32.dll,
OpenAS_RunDLL " _
& stFile, WIN_NORMAL)
IRet = (varTaskID <0)
Case ERROR_OUT_OF_MEM:
stRet = "Error: Out of memory. Could not execute!"
Case ERROR_FILE_NOT_FOUND:
stRet = "Error: File not found. Could not execute!"
Case ERROR_PATH_NOT_FOUND:
stRet = "Error: Path not found. Could not execute!"
Case ERROR_BAD_FORMAT:
stRet = "Error: Bad format. Could not execute!"
Case Else:
End Select
End If
fHandleFile = IRet & IIf(stRet = "", vbNullString, ", " & stRet)

End Function

Regards
Marco

Feb 21 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Feb 21, 12:25 am, Zai...@gmail.com wrote:
Hi All,

I'm having a problem with the Shell32.dll when I try to open a program
from my Access db.
When I try to open a program called FalconViewLite from my access
database I get an error in the FileHandle function. The message is
something like: Shell32.dll missing entry OpenAS_RunDLL!.
On another machine, also running WinXP the problem doesn't occur.

This is the code I use:

Private 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

Function fHandleFile(strFile As String, IShowHow As Long)
Dim IRet As Long, varTaskID As Variant
Dim stRet As String
'First try to shell execute
IRet = apiShellExecute(hWndAccessApp, vbNullString, _
strFile, vbNullString, vbNullString, IShowHow)
If IRet ERROR_SUCCESS Then
stRet = vbNullString
IRet = -1
Else
Select Case IRet
Case ERROR_NO_ASSOC:
'Try the OpenWith dialog
varTaskID = Shell("rundll32.exe shell32.dll,
OpenAS_RunDLL " _
& stFile, WIN_NORMAL)
IRet = (varTaskID <0)
Case ERROR_OUT_OF_MEM:
stRet = "Error: Out of memory. Could not execute!"
Case ERROR_FILE_NOT_FOUND:
stRet = "Error: File not found. Could not execute!"
Case ERROR_PATH_NOT_FOUND:
stRet = "Error: Path not found. Could not execute!"
Case ERROR_BAD_FORMAT:
stRet = "Error: Bad format. Could not execute!"
Case Else:
End Select
End If
fHandleFile = IRet & IIf(stRet = "", vbNullString, ", " & stRet)

End Function

Regards
Marco
Typically one opens a program from an Access db with

Shell "FalconViewLite"

or

Shell "C:\Program Files\Path\FalconViewLite", vbNormal

Of course, you may have good reasons for being elaborate.

Feb 21 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.