News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

shellexecute problem

Started by azdps, June 03, 2008, 06:00:46 AM

Previous topic - Next topic

azdps

Everytime I use shellexecute to start explorer.exe my documents window opens up. This applies to WinExec and CreateProcess as well. When windows explorer.exe isnt running the same thing happens.


.586
.model flat, stdcall
option casemap :none

   include        /masm32/include/windows.inc
   include        /masm32/include/kernel32.inc
   include        /masm32/include/shell32.inc
     
   includelib     /masm32/lib/kernel32.lib
   includelib     /masm32/lib/shell32.lib

 
   .data
      FilePath db "c:\windows\explorer.exe",0
      Open     db "open",0
   
   .code
start:

      invoke ShellExecute,0,addr Open,Addr FilePath,0,0,0

invoke ExitProcess,0
end start


zooba

What are you expecting to happen? The default startup path is your documents folder. You can specify a path to lpDirectory (the second last parameter) if you would prefer it to start somewhere else.

Cheers,

Zooba :U

PBrennick

azdps,
Exactly what are you trying to do because your description sounds acceptable to me as zooba has stated. Are you trying for Internet Explorer? If so, there are a couple of problems here. One, is the difference between explorer.exe and iexplore.exe. The following works just fine.


.586
.model flat, stdcall
option casemap :none

include /masm32/include/windows.inc
include /masm32/include/kernel32.inc
include /masm32/include/shell32.inc

includelib /masm32/lib/kernel32.lib
includelib /masm32/lib/shell32.lib


.data
; FilePath db "c:\windows\explorer.exe",0
FilePath db "c:\Program Files\Internet Explorer\",0
FileName db "IEXPLORE.EXE", 0
Open db "open",0

.code
start:

invoke ShellExecute,0,addr Open,addr FileName,0,addr FilePath,SW_SHOW

invoke ExitProcess,0
end start


If, indeed, you wish to explore your HD, use my example line of ShellExecute to show you how it should be set up. The FilePath should be replaced with the particular folder that you wish to open.
Paul
The GeneSys Project is available from:
The Repository or My crappy website

azdps

Alright I was doing everything right orginally but then changed to the code I posted because things were just not working out. The problem this whole time was that I did not have the editor setup to recognize spaces in a path name. So if I had a folder on the desktop named NEW FOLDER when I clicked on run exe in my editor it wouldn't execute the executable. Since my test program did not have a gui I didn't notice that the executable wouldnt actually run. Because I knew your code had to be right I realized the problem was somewhere else than my code. Thanks for the help.