home *** CD-ROM | disk | FTP | other *** search
/ PC Open 19 / pcopen19.iso / Imag / IMAGINE / CUSTOM.Z / MODULE1.BAS < prev    next >
Encoding:
BASIC Source File  |  1997-04-07  |  2.7 KB  |  94 lines

  1. Attribute VB_Name = "Module1"
  2. Option Explicit
  3.  
  4. Public Const MB_OK = 0
  5. Public Const MB_YESNO = 4
  6.  
  7. Public Const MB_ICONSTOP = 16
  8. Public Const MB_ICONQUESTION = 32
  9.  
  10. Public Const IDYES = 6
  11. Public Const IDNO = 7
  12.  
  13. Public Const IMAGINEER = "Imagineer.Application"
  14. Public ImagineerObj As Object
  15. Public DocumentObj As Object
  16. Public SheetObj As Object
  17.  
  18. Const STARTF_USESHOWWINDOW = &H1
  19. Const SW_SHOWMINIMIZED = &H2
  20.  
  21. Private Type STARTUPINFO
  22.    cb As Long
  23.    lpReserved As String
  24.    lpDesktop As String
  25.    lpTitle As String
  26.    dwX As Long
  27.    dwY As Long
  28.    dwXSize As Long
  29.    dwYSize As Long
  30.    dwXCountChars As Long
  31.    dwYCountChars As Long
  32.    dwFillAttribute As Long
  33.    dwFlags As Long
  34.    wShowWindow As Integer
  35.    cbReserved2 As Integer
  36.    lpReserved2 As Long
  37.    hStdInput As Long
  38.    hStdOutput As Long
  39.    hStdError As Long
  40. End Type
  41.  
  42. Private Type PROCESS_INFORMATION
  43.    hProcess As Long
  44.    hThread As Long
  45.    dwProcessID As Long
  46.    dwThreadID As Long
  47. End Type
  48.  
  49. 'For Always-On-Top switches
  50. Public Const conHwndTopmost = -1
  51. Public Const conHwndNoTopmost = -2
  52. Public Const conSwpNoActivate = &H10
  53. Public Const conSwpShowWindow = &H40
  54. Public Const SWP_NOMOVE = 2
  55. Public Const SWP_NOSIZE = 1
  56. Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE Or conSwpNoActivate
  57.  
  58. Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
  59.  
  60. Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
  61.    hHandle As Long, ByVal dwMilliseconds As Long) As Long
  62.  
  63. Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
  64.    lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
  65.    lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
  66.    ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
  67.    ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
  68.    lpStartupInfo As STARTUPINFO, lpProcessInformation As _
  69.    PROCESS_INFORMATION) As Long
  70.  
  71. Private Declare Function CloseHandle Lib "kernel32" (ByVal _
  72.    hObject As Long) As Long
  73.  
  74. Private Const NORMAL_PRIORITY_CLASS = &H20&
  75. Private Const INFINITE = -1&
  76.  
  77.  
  78.  
  79. Public Sub ExecCmd(cmdline$)
  80.    Dim proc As PROCESS_INFORMATION
  81.    Dim start As STARTUPINFO
  82.    Dim ret As Long
  83.  
  84.    ' Initialize the STARTUPINFO structure:
  85.    start.cb = Len(start)
  86.    
  87.     ' Start the shelled application:
  88.    ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
  89.    
  90.    ' Wait for the shelled application to finish:
  91.    ret& = WaitForSingleObject(proc.hProcess, INFINITE)
  92.    ret& = CloseHandle(proc.hProcess)
  93. End Sub
  94.