` Printed Icetips Article

Icetips Article



Par2: ShellExecuteEX prototype
2003-05-14 -- John Christ III
 
SHELLEXECUTEINFOgroup GROUP, TYPE
cbSize       UNSIGNED
fMask        UNSIGNED
hwnd         UNSIGNED
lpVerb       LONG
lpFile       LONG
lpParameters LONG
lpDirectory  LONG
nShow        LONG
hInstApp     UNSIGNED
! Optional members
lpIDList     LONG
lpClass      LONG
hkeyClass    LONG
dwHotKey     UNSIGNED
hIcon        UNSIGNED
hProcess     UNSIGNED
  END

MODULE('win32.lib')
    ShellExecuteEx(*SHELLEXECUTEINFOgroup), SIGNED, PASCAL, |
        RAW, DLL, NAME('ShellExecuteExA')
    WaitForSingleObject(UNSIGNED, LONG), UNSIGNED, PASCAL, |
        NAME('WaitForSingleObject')
    CloseHandle(UNSIGNED), SIGNED, PASCAL, NAME('CloseHandle')
END

sei                 LIKE(SHELLEXECUTEINFOgroup)
FileAction          CSTRING(16)
FileName            CSTRING(256)
Parameters          CSTRING(256)
DefaultDirectory    CSTRING(256)

FileAction        = 'open'
FileName          = 'myProgram.exe'
Parameters        = ''
DefaultDirectory  = ''

CLEAR(sei)
sei.cbSize        = SIZE(sei)
sei.fMask         = SEE_MASK_NOCLOSEPROCESS
sei.hwnd          = Window{PROP:Handle}
sei.lpVerb        = ADDRESS(FileAction)
sei.lpFile        = ADDRESS(FileName)
sei.lpParameters  = ADDRESS(Parameters)
sei.lpDirectory   = ADDRESS(DefaultDirectory)
sei.nShow         = SW_HIDE

IF ShellExecuteEx(sei)
    I# = WaitForSingleObject(sei.hProcess, -1);
    I# = CloseHandle(sei.hProcess);
END

(Later) Sorry, forgot these:

SW_HIDE             EQUATE(0)
SEE_MASK_NOCLOSEPROCESS    EQUATE(00000040h)



Printed November 21, 2024, 12:36 pm
This article has been viewed/printed 35329 times.