` Printed Icetips Article

Icetips Article



Par2: Run program with specified file
2000-12-17 -- James Cooke
 
Place this inside the global map:

MODULE('Windows.DLL')
    GetDesktopWindow(), Unsigned, Pascal
  OMIT('***',_WIDTH32_)
    ShellExecute(Unsigned, *CString, *CString, *CString, *CString, Signed),
Unsigned, Pascal, Raw, Proc
   ***
   COMPILE('***',_WIDTH32_)
    ShellExecute(Unsigned, *CString, *CString, *CString, *CString, Signed),
Unsigned, Pascal, Raw, Proc,name('ShellExecuteA')
   ***
End

Declare these local variables in a window:

AssocFile            CSTRING(255)
Operation            CSTRING(255)
Param                CSTRING(255)
Directory            CSTRING(255)

Place this code in a button:

    AssocFile     =    'c:\xyz.xls'
    Param         =    ''
    Directory     =    ''
    Operation     =    'open'
    ShellExecute(GetDesktopWindow(),Operation,AssocFile,Param,Directory,5)

Compile and run - note that this can be used to call ANY windows association.

Very useful



Printed November 21, 2024, 6:54 am
This article has been viewed/printed 35298 times.