TinkerBear
Programmer
Hello,
I finally got my cmd button to, when clicked till launch another application (ie solitare), but now it gets better :
I want the user to be able to input a file location (c:\windows\whatever.exe) via input box, and then the location will be put under a cmd button for execution...here is what my code looks like for the execution function.
------------------------------------------------------------
Private 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
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileStringByKeyName Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Function Exec(str As String) As Long
Dim hwnd As Long
Exec = ShellExecute(hwnd, vbNullString, str, vbNullString, vbNullString, vbNormalFocus)
End Function
Private Sub Command1_Click()
Dim addfile As String
addfile = inputbox("Please enter the name and directory of the chosen file.", "Input Name"
Let addlocation = inputbox("Please enter the full location of file.", "Input Location"
Command3.Caption = addfile
End Sub
Private Sub Command3_Click()
Exec ("addlocation"
End Sub
-----------------------------------------------------------
I can get it to change the caption of the cmd button via input box, but when i want to then have that button to launch the application (addlocation), it jsut doesn't want to load....can ya help me?
Thanks a ton!
I finally got my cmd button to, when clicked till launch another application (ie solitare), but now it gets better :
I want the user to be able to input a file location (c:\windows\whatever.exe) via input box, and then the location will be put under a cmd button for execution...here is what my code looks like for the execution function.
------------------------------------------------------------
Private 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
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileStringByKeyName Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Function Exec(str As String) As Long
Dim hwnd As Long
Exec = ShellExecute(hwnd, vbNullString, str, vbNullString, vbNullString, vbNormalFocus)
End Function
Private Sub Command1_Click()
Dim addfile As String
addfile = inputbox("Please enter the name and directory of the chosen file.", "Input Name"
Let addlocation = inputbox("Please enter the full location of file.", "Input Location"
Command3.Caption = addfile
End Sub
Private Sub Command3_Click()
Exec ("addlocation"
End Sub
-----------------------------------------------------------
I can get it to change the caption of the cmd button via input box, but when i want to then have that button to launch the application (addlocation), it jsut doesn't want to load....can ya help me?
Thanks a ton!