gumble gubbins
New member
- Local time
- Today, 19:33
- Joined
- Dec 27, 2010
- Messages
- 2
I'm retired and haven't used Access for some time. I last used a little VBA about ten years ago so please bear with me.
I now have a personal database of Morris Dances that I would like to connect to my collection of abc notated music. This requires running abc2midi.exe or abc2ps.exe from within the database using parameters held there. Here is the code I'm trying to use for abc2ps:
Option Compare Database
'ShellExecute
Public Declare Function ShellExecute 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
'Public Const SW_HIDE = 0
'Public Const SW_NORMAL = 1
'Public Const SW_MAXIMIZE = 3
'Public Const SW_MINIMIZE = 6
'ShellExecuteEx
Private Declare Function ShellExecuteEx Lib "shell32.dll" _
Alias "ShellExecuteExA" ( _
lpExecInfo As SHELLEXECUTEINFO) As Long
Private Declare Function WaitForSingleObject Lib "kernel32.dll" ( _
ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long
Private Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
'einde ShellexecuteEX
Sub abcps()
'MAke POSTSCRIPT FILE
lpOperation = "Open"
lpFile = "ABCM2PS.exe"
lpParameters = "D:\MyMusic\ABCmusic\Braybrooke.abc"
lpDirectory = "C:\Program Files\ABCedit"
nShowCmd = 0
hwnd = hHandle
Call ShellExecuteEx(lpExecInfo)
' a$ are the parameters of abcm2ps
'ShellExExWait
'App.Path
End Sub
Running this gives me a compile error ByRef argument type mismatch in lpExecInfo.
a) what am I doing wrong?
b) is there a better way?
I now have a personal database of Morris Dances that I would like to connect to my collection of abc notated music. This requires running abc2midi.exe or abc2ps.exe from within the database using parameters held there. Here is the code I'm trying to use for abc2ps:
Option Compare Database
'ShellExecute
Public Declare Function ShellExecute 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
'Public Const SW_HIDE = 0
'Public Const SW_NORMAL = 1
'Public Const SW_MAXIMIZE = 3
'Public Const SW_MINIMIZE = 6
'ShellExecuteEx
Private Declare Function ShellExecuteEx Lib "shell32.dll" _
Alias "ShellExecuteExA" ( _
lpExecInfo As SHELLEXECUTEINFO) As Long
Private Declare Function WaitForSingleObject Lib "kernel32.dll" ( _
ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long
Private Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
'einde ShellexecuteEX
Sub abcps()
'MAke POSTSCRIPT FILE
lpOperation = "Open"
lpFile = "ABCM2PS.exe"
lpParameters = "D:\MyMusic\ABCmusic\Braybrooke.abc"
lpDirectory = "C:\Program Files\ABCedit"
nShowCmd = 0
hwnd = hHandle
Call ShellExecuteEx(lpExecInfo)
' a$ are the parameters of abcm2ps
'ShellExExWait
'App.Path
End Sub
Running this gives me a compile error ByRef argument type mismatch in lpExecInfo.
a) what am I doing wrong?
b) is there a better way?