Visual Basic question!!!!!

Closed
Jack Rex Posts 177 Registration date Saturday January 2, 2010 Status Member Last seen August 13, 2016 - Feb 21, 2011 at 06:57 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Mar 5, 2011 at 08:56 AM
Hello,

I want to make a kind of executable in visual basic that helps me link to other executables like Autorun.exe on a cd. i made one using the shell command but I got an error, cannot find AutoRunGUI.dll. That dll is there in the folder where Autorun.exe is situated. Whys is it looking at the folder where my compiled exe is situated? Can anyone please help me with this? Here's the code:

Dim Result
Result = Shell("Foldername\Autorun.exe", 1)
Shell (Result)

Will Shellexecute solve the problem and can anyone please guide me on Shellexecute because when I try, the error Sub or Function not defined comes. Shellexecute I didn't try for autorun because this error came for anothere exe.

Code: ShellExecute(hwndMain, _T( "open"), _T( "C:\Some.exe"), NULL, NULL, SW_SHOW);

Thank You






Related:

2 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Feb 28, 2011 at 07:02 AM
it has been some time that i have used VB, but i think you would need to change the dir to "Foldername" before call to execute auto run to make it pick up the dll. perhaps alernate way could be to add to the environment variable of PATH
0
Jack Rex Posts 177 Registration date Saturday January 2, 2010 Status Member Last seen August 13, 2016 7
Mar 5, 2011 at 07:57 AM
You could tell me how to do it please?
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Mar 5, 2011 at 08:56 AM
see this
http://www.bigresource.com/Tracker/Track-vb-6PDcm07M9u/
or ,may be this would be better

https://searchwindevelopment.techtarget.com/definition/Visual-Basic?theID=3397

the 2nd one has this sample code

this is to make declare the api function.


Private Declare Function SetCurrentDirectory Lib "kernel32" Alias "SetCurrentDirectoryA" (ByVal lpPathName As String) As Long
Private Declare Function GetCurrentDirectory Lib "kernel32" Alias "GetCurrentDirectoryA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long


this is the sample usage of the above api call

Private Sub Form_Load()
Dim cwd As String
Dim length As Long
SetCurrentDirectory "C:\karthik"
cwd = Space(128)
length = GetCurrentDirectory(128, cwd)
cwd = Left(cwd, length)
MsgBox cwd
End
End Sub
0