home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 10 / ioProg_10.iso / soft / optima / hpp.z / WAPPLIC.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-09  |  27.3 KB  |  827 lines

  1. /********************************************************************
  2.  *
  3.  * WApplication
  4.  *
  5.  *   Events:
  6.  *
  7.  *      Start -- Called when the application is starting.  User can
  8.  *               decide if application should continue.
  9.  *
  10.  *      Run -- Called to run the application.
  11.  *
  12.  *      End -- Called when the application is terminating.
  13.  *
  14.  ********************************************************************/
  15.  
  16. #ifndef _WAPPLIC_HPP_INCLUDED
  17. #define _WAPPLIC_HPP_INCLUDED
  18.  
  19. #ifndef _WNO_PRAGMA_PUSH
  20. #pragma pack(push,4);
  21. #pragma enum int;
  22. #endif
  23.  
  24. #include "wdef.hpp"
  25.  
  26. #ifndef _WOBJECT_HPP_INCLUDED
  27. #  include "wobject.hpp"
  28. #endif
  29. #ifndef _WBITMAP_HPP_INCLUDED
  30. #  include "wbitmap.hpp"
  31. #endif
  32. #ifndef _WSTRING_HPP_INCLUDED
  33. #  include "wstring.hpp"
  34. #endif
  35. #ifndef _WTHREAD_HPP_INCLUDED
  36. #  include "wthread.hpp"
  37. #endif
  38. #ifndef _WMODULE_HPP_INCLUDED
  39. #  include "wmodule.hpp"
  40. #endif
  41. #ifndef _WWINDOW_HPP_INCLUDED
  42. #  include "wwindow.hpp"
  43. #endif
  44. #ifndef _WLLIST_HPP_INCLUDED
  45. #  include "wllist.hpp"
  46. #endif
  47. #ifndef _WFILPATH_HPP_INCLUDED
  48. #  include "wfilpath.hpp"
  49. #endif
  50.  
  51. struct WStartEventData : public WEventData {
  52.     WBool abortRun;
  53.     WLong exitCode;
  54. };
  55.  
  56. typedef WStartEventData WEndEventData;
  57. typedef WStartEventData WRunEventData;
  58.  
  59. typedef WEventData WThreadAttachEventData;
  60. typedef WEventData WThreadDetachEventData;
  61.  
  62. struct WProcessAttachEventData : public WEventData {
  63.     WBool dynamic;
  64. };
  65.  
  66. typedef WProcessAttachEventData WProcessDetachEventData;
  67.  
  68.  
  69. enum WWaitReturn {
  70.     WFailed                     = 0xFFFFFFFFL,
  71.     WSucceeded                  = 0x00000000L,
  72.     WAbandoned                  = 0x00000080L,
  73.     WTimeout                    = 0x00000102L
  74. };
  75.  
  76. class WForm;
  77.  
  78. enum WHelpType {
  79.     WHelpContext                = 0x0001,
  80.     WHelpQuit                   = 0x0002,
  81.     WHelpIndex                  = 0x0003,
  82.     WHelpContents               = 0x0003,
  83.     WHelpHelpOnHelp             = 0x0004,
  84.     WHelpSetContents            = 0x0005,
  85.     WHelpSetIndex               = 0x0005,
  86.     WHelpContextPopup           = 0x0008,
  87.     WHelpOnContextMenu          = 0x000a,
  88.     WHelpFinder                 = 0x000b,
  89.     WHelpOnHelp                 = 0x000c,
  90.     WHelpKey                    = 0x0101,
  91.     WHelpCommand                = 0x0102,
  92.     WHelpPartialKey             = 0x0105
  93. };
  94.  
  95. #define WClipboardText                  WTEXT("WCLASS_CLIPBOARD_TEXT")
  96. #define WClipboardDIF                   WTEXT("WCLASS_CLIPBOARD_DIF")
  97. #define WClipboardBitmap                WTEXT("WCLASS_CLIPBOARD_BITMAP")
  98. #define WClipboardDIBitmap              WTEXT("WCLASS_CLIPBOARD_DI_BITMAP")
  99. #define WClipboardDSPBitmap             WTEXT("WCLASS_CLIPBOARD_DSP_BITMAP")
  100. #define WClipboardOEMText               WTEXT("WCLASS_CLIPBOARD_OEM_TEXT")
  101. #define WClipboardUnicodeText           WTEXT("WCLASS_CLIPBOARD_UNICODE_TEXT")
  102. #define WClipboardTIFF                  WTEXT("WCLASS_CLIPBOARD_TIFF")
  103. #define WClipboardWave                  WTEXT("WCLASS_CLIPBOARD_WAVE")
  104. #define WClipboardSYLK                  WTEXT("WCLASS_CLIPBOARD_SYLK")
  105. #define WClipboardRIFF                  WTEXT("WCLASS_CLIPBOARD_RIFF")
  106. #define WClipboardPenData               WTEXT("WCLASS_CLIPBOARD_PEN_DATA")
  107. #define WClipboardPalette               WTEXT("WCLASS_CLIPBOARD_PALETTE")
  108. #define WClipboardOwnerDisplay          WTEXT("WCLASS_CLIPBOARD_OWNER_DISPLAY")
  109. #define WClipboardMetaFile              WTEXT("WCLASS_CLIPBOARD_META_FILE")
  110. #define WClipboardLocale                WTEXT("WCLASS_CLIPBOARD_LOCALE")
  111. #define WClipboardHDROP                 WTEXT("WCLASS_CLIPBOARD_HDROP")
  112. #define WClipboardDSPText               WTEXT("WCLASS_CLIPBOARD_DSP_TEXT")
  113. #define WClipboardDSPMetaFile           WTEXT("WCLASS_CLIPBOARD_DSP_META_FILE")
  114. #define WClipboardEnhancedMetaFile      WTEXT("WCLASS_CLIPBOARD_EN_META_FILE")
  115. #define WClipboardDSPEnhancedMetaFile   WTEXT("WCLASS_CLIPBOARD_DSP_EN_META_FILE")
  116.  
  117. typedef WBool WCMDEF (WObject::*WEnumCallback)( WWindow * win,
  118.                                                 WWindowHandle winHandle,
  119.                                                 void * userData );
  120.  
  121. #ifndef _WIN16
  122. #undef FindExecutable
  123. #undef ExtractIcon
  124. #undef GetFileAttributes
  125. #undef SetFileAttributes
  126. #undef GetUserName
  127. #undef GetComputerName
  128. #undef GetCommandLine
  129. #undef SendMessage
  130. #undef PostMessage
  131. #undef PlaySound
  132. #undef GetSystemDirectory
  133. #undef GetWindowsDirectory
  134. #undef GetWorkingDirectory
  135. #undef CopyFile
  136. #undef MoveFile
  137. #undef DeleteFile
  138. #undef InitiateSystemShutdown
  139. #undef GetEnvironmentVariable
  140. #undef SetEnvironmentVariable
  141. #if defined( _UNICODE )
  142.     #define GetUserName                 GetUserNameW
  143.     #define GetComputerName             GetComputerNameW
  144.     #define GetCommandLine              GetCommandLineW
  145.     #define GetEnvironmentVariable      GetEnvironmentVariableW
  146.     #define SetEnvironmentVariable      SetEnvironmentVariableW
  147.     #define SendMessage                 SendMessageW
  148.     #define PostMessage                 PostMessageW
  149.     #define PlaySound                   PlaySoundW
  150.     #define GetSystemDirectory          GetSystemDirectoryW
  151.     #define GetWindowsDirectory         GetWindowsDirectoryW
  152.     #define GetWorkingDirectory         GetWorkingDirectoryW
  153.     #define SetFileAttributes           SetFileAttributesW
  154.     #define CopyFile                    CopyFileW
  155.     #define MoveFile                    MoveFileW
  156.     #define DeleteFile                  DeleteFileW
  157.     #define InitiateSystemShutdown      InitiateSystemShutdownW
  158.     #define GetFileAttributes           GetFileAttributesW
  159.     #define FindExecutable              FindExecutableW
  160.     #define ExtractIcon                 ExtractIconW
  161.     #define GetProfileString            GetProfileStringW
  162.     #define WritePrivateProfileString   WritePrivateProfileStringW
  163. #else
  164.     #define GetUserName                 GetUserNameA
  165.     #define GetComputerName             GetComputerNameA
  166.     #define GetCommandLine              GetCommandLineA
  167.     #define GetEnvironmentVariable      GetEnvironmentVariableA
  168.     #define SetEnvironmentVariable      SetEnvironmentVariableA
  169.     #define SendMessage                 SendMessageA
  170.     #define PostMessage                 PostMessageA
  171.     #define PlaySound                   PlaySoundA
  172.     #define GetSystemDirectory          GetSystemDirectoryA
  173.     #define GetWindowsDirectory         GetWindowsDirectoryA
  174.     #define GetWorkingDirectory         GetWorkingDirectoryA
  175.     #define GetFileAttributes           GetFileAttributesA
  176.     #define SetFileAttributes           SetFileAttributesA
  177.     #define CopyFile                    CopyFileA
  178.     #define MoveFile                    MoveFileA
  179.     #define DeleteFile                  DeleteFileA
  180.     #define InitiateSystemShutdown      InitiateSystemShutdownA
  181.     #define FindExecutable              FindExecutableA
  182.     #define ExtractIcon                 ExtractIconA
  183.     #define GetProfileString            GetProfileStringA
  184.     #define WritePrivateProfileString   WritePrivateProfileStringA
  185. #endif
  186. #endif
  187.  
  188. enum WBeepSound {
  189.     WBeepOK             = 0x00000000L,          WBeepDefault = WBeepOK,
  190.     WBeepHand           = 0x00000010L,
  191.     WBeepQuestion       = 0x00000020L,
  192.     WBeepExclamation    = 0x00000030L,
  193.     WBeepAsterisk       = 0x00000040L,
  194.     WBeepStandard       = 0xFFFFFFFF,
  195. };
  196.  
  197.  
  198. #define    WPSFlagSync          0x0000 // SND_SYNC
  199. #define    WPSFlagAsync         0x0001 // SND_ACYNC
  200. #define    WPSFlagNoDefault     0x0002 // SND_NODEFAULT
  201. #define    WPSFlagMemory        0x0004 // SND_MEMORY
  202. #define    WPSFlagLoop          0x0008 // SND_LOOP
  203. #define    WPSFlagNoStop        0x0010 // SND_NOSTOP
  204.  
  205. #define    WPSFlagNoWait        0x00002000L // SND_NOWAIT
  206. #define    WPSFlagAlias         0x00010000L // SND_ALIAS
  207. #define    WPSFlagAliasID       0x00110000L // SND_ALIAS_ID
  208. #define    WPSFlagFileName      0x00020000L // SND_FILENAME
  209. #define    WPSFlagResource      0x00040004L // SND_RESOURCE
  210. #if(WINVER >= 0x0400)
  211. #define    WPSFlagPurge         0x0040 // SND_PURGE
  212. #define    WPSFlagApplication   0x0080 // SND_APPLICATION
  213. #endif /* WINVER > = 0x0400 */
  214.  
  215.  
  216. struct WOSVersionInfo {
  217.     WDWord platform;
  218.     WDWord majorVersion;
  219.     WDWord minorVersion;
  220.     WDWord buildNumber;
  221.     WChar  extraInfo[ 128 ];
  222.     WDWord reserved;
  223. };
  224.  
  225. class WCMCLASS WTime {
  226.         public:
  227.             WTime();
  228.             ~WTime();
  229.  
  230.         public:    
  231.             WUShort _year;
  232.             WUShort _month;
  233.             WUShort _dayOfWeek;
  234.             WUShort _day;
  235.             WUShort _hour;
  236.             WUShort _minute;
  237.             WUShort _second;
  238.             WUShort _milliseconds;
  239. };
  240.  
  241. enum WOSType {
  242.     WOST_Win16 = 0,
  243.     WOST_WinNT = 1,
  244.     WOST_Win95 = 2,
  245.     WOST_Win32s = 3,
  246. };
  247.  
  248.  
  249. typedef WULong WSHFileFlag;
  250.  
  251. #define WSFFMultiDestFiles              ((WSHFileFlag)0x00000001L)
  252. #define WSFFMultiDestinationFiles       ((WSHFileFlag)0x00000001L)
  253. #define WSFFMultipleDestFiles           ((WSHFileFlag)0x00000001L)
  254. #define WSFFMultipleDestinationFiles    ((WSHFileFlag)0x00000001L)
  255. #define WSFFConfirmMouse                ((WSHFileFlag)0x00000002L)
  256. #define WSFFSilent                      ((WSHFileFlag)0x00000004L)
  257. #define WSFFRenameOnCollision           ((WSHFileFlag)0x00000008L)
  258. #define WSFFNoConfirmation              ((WSHFileFlag)0x00000010L)
  259. #define WSFFWantMappingHandle           ((WSHFileFlag)0x00000020L)
  260. #define WSFFAllowUndo                   ((WSHFileFlag)0x00000040L)
  261. #define WSFFFilesOnly                   ((WSHFileFlag)0x00000080L)
  262. #define WSFFSimpleProgress              ((WSHFileFlag)0x00000100L)
  263. #define WSFFNoConfirmMkdir              ((WSHFileFlag)0x00000200L)
  264. #define WSFFNoConfirmMakeDir            ((WSHFileFlag)0x00000200L)
  265. #define WSFFNoConfirmMakeDirectory      ((WSHFileFlag)0x00000200L)
  266.  
  267. #define WSFFDefaultCopy                 ((WSHFileFlag)0x0000025CL)
  268. #define WSFFDefaultMove                 ((WSHFileFlag)0x0000025CL)
  269. #define WSFFDefaultDelete               ((WSHFileFlag)0x0000025CL)
  270. #define WSFFDefaultRename               ((WSHFileFlag)0x0000025CL)
  271.  
  272. typedef WULong WFileAttribute;
  273.  
  274. #define WFAReadOnly                     ((WFileAttribute)0x00000001L)
  275. #define WFAHidden                       ((WFileAttribute)0x00000002L)
  276. #define WFASystem                       ((WFileAttribute)0x00000004L)
  277. #define WFADirectory                    ((WFileAttribute)0x00000010L)
  278. #define WFAArchive                      ((WFileAttribute)0x00000020L)
  279. #define WFANormal                       ((WFileAttribute)0x00000080L)
  280. #define WFATemporary                    ((WFileAttribute)0x00000100L)
  281. #define WFACompressed                   ((WFileAttribute)0x00000800L)
  282.  
  283. enum WExecutableFileType {
  284.     WNonEXE,
  285.     WWindowsEXE,
  286.     WDosEXE,
  287.     WWin32ConsoleEXE
  288. };
  289.  
  290. //
  291. // WApplication
  292. //
  293.  
  294. #define WAppObject (*WApplication::GetApplicationObject())
  295.  
  296. class WCMCLASS WApplication : public WEventGenerator {
  297.     WDeclareSubclass( WApplication, WEventGenerator );
  298.  
  299.     public:
  300.  
  301.         /***************************************************************
  302.          * Constructors and Destructors
  303.          ****************************************************************/
  304.  
  305.         WApplication();
  306.  
  307.         ~WApplication();
  308.  
  309.         /***************************************************************
  310.          * Properties
  311.          ***************************************************************/
  312.  
  313.         // AutomaticContextHelpHandling
  314.  
  315.         WBool GetAutomaticContextHelpHandling() const;
  316.         WBool SetAutomaticContextHelpHandling( WBool autoContextHelp );
  317.  
  318.         // ClipboardBitmap
  319.  
  320.         WBool   SetClipboardBitmap( const WBitmap & bmp, WWindow *owner=NULL );
  321.         WBitmap GetClipboardBitmap( WWindow * owner=NULL );
  322.  
  323.         // ClipboardData
  324.         //
  325.         // NOTE: Can't rely on return value of GetClipboardData for
  326.         //       long-term use, so the best idea is to make a copy of it
  327.  
  328.         WBool SetClipboardData( void * data, WInt data_size,
  329.                                 const WChar * format,
  330.                                 WWindow * owner=NULL );
  331.         WBool SetClipboardData( void * data, WInt data_size, WInt format,
  332.                                 WWindow * owner=NULL );
  333.         void * GetClipboardData( const WChar * format, WWindow * owner=NULL );
  334.         void * GetClipboardData( WInt format, WWindow * owner=NULL );
  335.  
  336.         // ClipboardText
  337.  
  338.         WBool SetClipboardText( const WString & str, WWindow * owner=NULL );
  339.         WString GetClipboardText( WWindow * owner=NULL );
  340.  
  341.         // HelpFile
  342.         //
  343.         //     Identifies the module-wide help file.
  344.  
  345.         WFilePath GetHelpFile() const;
  346.         WBool SetHelpFile( const WFilePath & helpFile );
  347.  
  348.         // LocalModule
  349.         //
  350.         //     Identifies the module that created the application
  351.         //     object.  In a EXE, the local module is either the
  352.         //     exe module or the library module.  In a DLL, the
  353.         //     local module is either the library module or a
  354.         //     completely different module.
  355.  
  356.         const WModule & GetLocalModule() const;
  357.  
  358.         // MultiOSWarnings
  359.  
  360.         WBool GetMultiOSWarnings() const;
  361.         WBool SetMultiOSWarnings( WBool warnings );
  362.  
  363.         /*************************************************************
  364.          * Methods
  365.          *************************************************************/
  366.  
  367.         // EmptyClipboard
  368.  
  369.         WBool EmptyClipboard( WWindow * owner=NULL );
  370.  
  371.         // Initialize 
  372.         //
  373.         //    Call this to initialize the library.  Appropriate defaults
  374.         //    are used.
  375.  
  376.         WBool Initialize( unsigned int instance=0, unsigned int prevInstance=0,
  377.                           const WAnsiChar *commandLine=NULL, int showState=0 );
  378.  
  379.         // Quit
  380.  
  381.         void Quit( WDWord exitCode=0 );
  382.  
  383.         // Run 
  384.  
  385.         WLong Run();
  386.  
  387.         // Uninitialize
  388.  
  389.         WLong Uninitialize();
  390.  
  391.         /*************************************************************
  392.          * Static Properties
  393.          *************************************************************/
  394.  
  395.         // ActiveWindow
  396.  
  397.         static WWindow *GetActiveWindow();
  398.         static WBool    SetActiveWindow( WWindow *win );
  399.  
  400.         // ApplicationObject
  401.  
  402.         static WApplication *GetApplicationObject();
  403.         static WBool         SetApplicationObject( WApplication * appObj );
  404.  
  405.         // CaptionSize
  406.  
  407.         static WInt GetCaptionSize();
  408.  
  409.         // CommandLine
  410.         //
  411.         //     Return the command line used to start the app.
  412.  
  413.         static WString GetCommandLine();
  414.  
  415.         // GetWorkArea
  416.  
  417.         static WRect GetWorkArea();
  418.  
  419.         // ComputerName
  420.         //
  421.         //     Name of this computer.
  422.  
  423.         static WString GetComputerName();
  424.  
  425.         // DesktopWindowHandle
  426.  
  427.         static WWindowHandle GetDesktopWindowHandle();
  428.  
  429.         // DialogBaseWidth
  430.  
  431.         static WFloat WCMRETURNSFLOAT GetDialogBaseHeight( const WFont & font );
  432.  
  433.         // DialogBaseWidth
  434.  
  435.         static WFloat WCMRETURNSFLOAT GetDialogBaseWidth( const WFont & font );
  436.  
  437.         // DialogFrameHeight
  438.  
  439.         static WInt GetDialogFrameHeight();
  440.     
  441.         // DialogFrameWidth
  442.  
  443.         static WInt GetDialogFrameWidth();
  444.  
  445.         // EnvironmentVariable
  446.  
  447.         static WString GetEnvironmentVariable( const WString & name );
  448.         static WBool   SetEnvironmentVariable( const WString & name,
  449.                                                const WString & value );
  450.  
  451.         // ExecutableModule
  452.         //
  453.         //     Identifies the EXE's module.
  454.  
  455.         static const WModule & GetExecutableModule();
  456.  
  457.         // ExecutableType
  458.  
  459.         static WExecutableFileType GetExecutableType( const WFilePath & exe );
  460.  
  461.         // FileAttributes
  462.  
  463.         static WFileAttribute GetFileAttributes( const WFilePath & file );
  464.         static WBool SetFileAttributes( const WFilePath & file,
  465.                                         WFileAttribute attribute=0 );
  466.  
  467.         // FileDisplayName
  468.  
  469.         static WString GetFileDisplayName( const WFilePath & file,
  470.                                            WBool useFileAttributes=FALSE,
  471.                                            WFileAttribute attribute=0 );
  472.  
  473.         // FileType
  474.  
  475.         static WString GetFileType( const WFilePath & file,
  476.                                     WBool useFileAttributes=FALSE,
  477.                                     WFileAttribute attribute=0 );
  478.  
  479.         // FocusWindow
  480.  
  481.         static WWindow * GetFocusWindow();
  482.  
  483.         // ForegroundWindow
  484.  
  485.         static WBool SetForegroundWindow( WWindow * window );
  486.         static WWindow * GetForegroundWindow();
  487.  
  488.         // ForegroundWindowHandle
  489.  
  490.         static WWindowHandle GetForegroundWindowHandle();
  491.  
  492.         // FrameHeight
  493.  
  494.         static WInt GetFrameHeight();
  495.     
  496.         // FrameWidth
  497.  
  498.         static WInt GetFrameWidth();
  499.     
  500.         // HScrollBarHeight
  501.  
  502.         static WInt GetHScrollBarHeight();
  503.  
  504.         // KeyboardState
  505.  
  506.         static WULong GetKeyboardState();
  507.  
  508.         // LibraryModule
  509.         //
  510.         //     Identifies the WClass DLL's module.  Note that in a
  511.         //     standalone exe LibraryModule == ExecutableModule.
  512.  
  513.         static const WModule & GetLibraryModule();
  514.  
  515.         // MousePresent
  516.  
  517.         static WBool GetMousePresent();
  518.  
  519.         // MenuCheckMarkHeight
  520.  
  521.         static WInt GetMenuCheckMarkHeight();
  522.     
  523.         // MenuCheckMarkWidth
  524.  
  525.         static WInt GetMenuCheckMarkWidth();
  526.  
  527.         // ProfileString
  528.  
  529.         static WString GetProfileString( WString sectionName, WString keyName,
  530.                                          WString defaultString,
  531.                                          WString fileName = "WIN.INI" );
  532.                                          
  533.         static WBool SetProfileString( WString sectionName, WString keyName,
  534.                                        WString value,
  535.                                        WString fileName = "WIN.INI",
  536.                                        WBool flushCache = TRUE );
  537.     
  538.         // ProgramPath
  539.         //
  540.         //     Return the full path to the running executable.
  541.  
  542.         static WString GetProgramPath();
  543.  
  544.         // ScreenSize
  545.  
  546.         static WRect GetScreenSize();
  547.  
  548.         // SystemDirectory
  549.         //
  550.         //     Returns path of the system directory.
  551.  
  552.         static WString GetSystemDirectory();
  553.  
  554.         // SystemTime
  555.         //
  556.         //
  557.         static WTime GetSystemTime();
  558.  
  559.         // UserName
  560.         //
  561.         //     User's login name.
  562.  
  563.         static WString GetUserName();
  564.  
  565.         // VScrollBarWidth
  566.  
  567.         static WInt GetVScrollBarWidth();
  568.  
  569.         // WindowsDirectory
  570.         //
  571.         //     Returns path of the Windows directory.
  572.  
  573.         static WString GetWindowsDirectory();
  574.  
  575.         // WorkingDirectory
  576.         //
  577.         //     Return the full path of the current directory.
  578.  
  579.         static WString GetWorkingDirectory();
  580.  
  581.         /*************************************************************
  582.          * Static Methods
  583.          *************************************************************/
  584.  
  585.         // AbortSystemShutdown
  586.  
  587.         static WBool AbortSystemShutdown( WChar * machineName=NULL );
  588.  
  589.         // AddToRecentDocumentList
  590.  
  591.         static void AddToRecentDocumentList( const WFilePath & file );
  592.  
  593.         // Beep
  594.  
  595.         static WBool Beep( WBeepSound sound=WBeepStandard );
  596.  
  597.         // ClearRecentDocumentList
  598.  
  599.         static void ClearRecentDocumentList();
  600.  
  601.         // CopyFile
  602.  
  603.         static WBool CopyFile( const WFilePath & source,
  604.                                const WFilePath & dest, WWindow * parent=NULL,
  605.                                WSHFileFlag flags=WSFFDefaultCopy,
  606.                                const WChar * progressTitle=NULL,
  607.                                WBool * userAborted=NULL );
  608.  
  609.         // DeleteFile
  610.  
  611.         static WBool DeleteFile( const WFilePath & source,
  612.                                  WWindow * parent=NULL,
  613.                                  WSHFileFlag flags=WSFFDefaultDelete,
  614.                                  const WChar * progressTitle=NULL,
  615.                                  WBool * userAborted=NULL );
  616.  
  617.         // EnumerateAllWindows
  618.  
  619.         static WBool EnumerateAllWindows( WObject * client,
  620.                                           WEnumCallback callback,
  621.                                           void * userData );
  622.  
  623.         // EnumerateChildWindows
  624.  
  625.         static WBool EnumerateChildWindows( WObject * client,
  626.                                             WEnumCallback callback,
  627.                                             void * userData,
  628.                                             WWindow * parent );
  629.  
  630.         // EnumerateTopLevelWindows
  631.  
  632.         static WBool EnumerateTopLevelWindows( WObject * client,
  633.                                                WEnumCallback callback,
  634.                                                void * userData );
  635.  
  636.         // Execute
  637.  
  638.         static WBool Execute(const WFilePath & file,
  639.                              const WString & operation = WNullString,
  640.                              const WString & parameters = WEmptyString,
  641.                              WInt cmdShow = WWinStateShowNormal,
  642.                              WWindow* parent = NULL);
  643.  
  644.         // ExtractIcon
  645.  
  646.         static WIcon ExtractIcon(const WFilePath & file,
  647.                                  WBool associated = TRUE,
  648.                                  WUInt index = 0);
  649.  
  650.         // FindExecutable
  651.  
  652.         static WBool FindExecutable(const WFilePath & file,  WString & nameEXE);
  653.  
  654.         // ForceDelete
  655.  
  656.         static void ForceDelete( WBool evenInEventHandler=FALSE );
  657.  
  658.         // InitiateSystemShutdown
  659.  
  660.         static WBool InitiateSystemShutdown( WChar * message=NULL,
  661.                                              WLong timeout=0,
  662.                                              WBool forceAppsToClose=TRUE,
  663.                                              WBool reboot=FALSE,
  664.                                              WChar * machineName=NULL );
  665.  
  666.         // InvokeHelp
  667.         //
  668.         //    Invoke the help subsystem.  A form is required for the
  669.         //    help subsystem to keep track of help requests.  If no
  670.         //    filename is specified, the file in the HelpFile property
  671.         //    is used instead.
  672.  
  673.         static WBool InvokeHelp( WWindow * window, WHelpType type,
  674.                           WULong helpID, const WChar * helpFileName=NULL,
  675.                           WWindowHandle windowHandle=NULLHWND );
  676.         static WBool InvokeHelp( WWindow * window, WHelpType type,
  677.                           const WChar * helpCommand,
  678.                           const WChar * helpFileName=NULL );
  679.  
  680.         // MoveFile
  681.  
  682.         static WBool MoveFile( const WFilePath & source,
  683.                                const WFilePath & dest,
  684.                                WWindow * parent=NULL,
  685.                                WSHFileFlag flags=WSFFDefaultMove,
  686.                                const WChar * progressTitle=NULL,
  687.                                WBool * userAborted=NULL );
  688.  
  689.         // MultiOSWarning
  690.  
  691.         static void MultiOSWarning( WOSType os, WChar * message );
  692.  
  693.         // OSType
  694.         //
  695.         //    Return the type of OS we're running on (NT, Win95, Win16,
  696.         //    or Win32s) and optionally fill in a WOSVersionInfo
  697.         //    structure.
  698.  
  699.         static WOSType OSType( WOSVersionInfo *info=NULL );
  700.  
  701.         // PlaySound (WAVEFORM sound file format)
  702.  
  703.         static WBool PlaySound( const WString & sound,
  704.                                 WULong flag=WPSFlagFileName|WPSFlagAsync,
  705.                                 WModuleHandle module=_ApplicationModule );
  706.  
  707.         // PostMessage
  708.  
  709.         static WLong PostMessage( WWindow * win, const WMessage & msg );
  710.  
  711.         // RegisterDeleteObject (alternative to delete this)
  712.  
  713.         static WBool RegisterDeleteObject( WObject * object );
  714.  
  715.         // RenameFile
  716.  
  717.         static WBool RenameFile( const WFilePath & source,
  718.                                  const WFilePath & dest,
  719.                                  WWindow * parent=NULL,
  720.                                  WSHFileFlag flags=WSFFDefaultRename,
  721.                                  const WChar * progressTitle=NULL,
  722.                                  WBool * userAborted=NULL );
  723.  
  724.         // SendMessage
  725.  
  726.         static WLong SendMessage( WWindow * win, const WMessage & msg );
  727.  
  728.         // Wait
  729.         //
  730.         //    Wait for semaphore, thread, process, et. al.
  731.  
  732.         static WWaitReturn Wait( WULong handle, WULong secondsToWait=0,
  733.                                  WBool waitForever=FALSE );
  734.  
  735.         /*************************************************************
  736.          * Data members
  737.          *************************************************************/
  738.  
  739.     protected:
  740.  
  741.         WStartEventData         _event;
  742.         WModule                 _localModule;
  743.         WFilePath               _helpFile;
  744.         WDWord                  _mainThreadID;
  745.         WWindow                 _clipboardServer;
  746.         WBool                   _multiOSWarnings;
  747.         WBool                   _autoContextHelp;
  748.  
  749.         static WApplication    *_globalObject;
  750.         static WModule          _libraryModule;
  751.         static WModule          _exeModule;
  752. };
  753.  
  754. class WCMCLASS WExeApplication : public WApplication {
  755.     WDeclareSubclass( WExeApplication, WApplication );
  756.  
  757.     public:
  758.         WExeApplication();
  759.  
  760.         ~WExeApplication();
  761.  
  762.         /*************************************************************
  763.          * Methods
  764.          *************************************************************/
  765.  
  766.         int EntryPoint( unsigned int inst, unsigned int prev,
  767.                         const WAnsiChar *command, int show );
  768.  
  769.         /*************************************************************
  770.          * Data members
  771.          *************************************************************/
  772.     private:
  773. };
  774.  
  775. /********************************************************************
  776.  *
  777.  * WDLLApplication
  778.  *
  779.  *   Events:
  780.  *
  781.  *      ProcessAttach --
  782.  *
  783.  *      ProcessDetach --
  784.  *
  785.  *      ThreadAttach --
  786.  *
  787.  *      ThreadDetach --
  788.  *
  789.  ********************************************************************/
  790.  
  791. class WCMCLASS WDLLApplication : public WApplication {
  792.     WDeclareSubclass( WDLLApplication, WApplication );
  793.  
  794.     public:
  795.         WDLLApplication();
  796.  
  797.         ~WDLLApplication();
  798.  
  799.         /*************************************************************
  800.          * Methods
  801.          *************************************************************/
  802.  
  803.         WBool EntryPoint( unsigned int inst, unsigned int reason,
  804.                           void *data );
  805.  
  806.         /*************************************************************
  807.          * Data members
  808.          *************************************************************/
  809.     private:
  810. };
  811.  
  812. #ifdef _DEBUG
  813. #define WMULTIOSWARNING( os, msg )                                      \
  814.                 if( WApplication::GetApplicationObject() != NULL && WApplication::GetApplicationObject()->GetMultiOSWarnings() && WApplication::OSType() == os ) {      \
  815.                     WApplication::MultiOSWarning( os, msg );            \
  816.                 }
  817. #else
  818. #define WMULTIOSWARNING( os, msg )
  819. #endif
  820.  
  821. #ifndef _WNO_PRAGMA_PUSH
  822. #pragma enum pop;
  823. #pragma pack(pop);
  824. #endif
  825.  
  826. #endif // _WAPPLIC_HPP_INCLUDED
  827.