home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WAPPLIC.HPP < prev    next >
C/C++ Source or Header  |  1997-01-23  |  30KB  |  866 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,8);
  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.         // NOTE: On the Set, the bmp must have its handle detached first.
  321.         //       This can be accomplished by calling bmp.DetachHandle().
  322.         // NOTE: On the Get, the bitmap that is returned cannot be
  323.         //       relied upon for long-term use, so the best idea is to
  324.         //       make a copy of it, as in bmp.Create( bmp, 0, 0, TRUE );
  325.  
  326.         WBool   SetClipboardBitmap( const WBitmap & bmp, WWindow *owner=NULL );
  327.         WBitmap GetClipboardBitmap( WWindow * owner=NULL );
  328.  
  329.         // ClipboardData
  330.         //
  331.         // NOTE: Can't rely on return value of GetClipboardData for
  332.         //       long-term use, so the best idea is to make a copy of it
  333.  
  334.         WBool SetClipboardData( void * data, WInt data_size,
  335.                                 const WChar * format,
  336.                                 WWindow * owner=NULL, WBool indirect=TRUE );
  337.         WBool SetClipboardData( void * data, WInt data_size, WInt format,
  338.                                 WWindow * owner=NULL, WBool indirect=TRUE );
  339.         void * GetClipboardData( const WChar * format, WWindow * owner=NULL,
  340.                                  WBool indirect=TRUE );
  341.         void * GetClipboardData( WInt format, WWindow * owner=NULL,
  342.                                  WBool indirect=TRUE );
  343.  
  344.         // ClipboardText
  345.  
  346.         WBool SetClipboardText( const WString & str, WWindow * owner=NULL );
  347.         WString GetClipboardText( WWindow * owner=NULL );
  348.  
  349.         // HelpFile
  350.         //
  351.         //     Identifies the module-wide help file.
  352.  
  353.         WFilePath GetHelpFile() const;
  354.         WBool SetHelpFile( const WFilePath & helpFile );
  355.  
  356.         // LocalModule
  357.         //
  358.         //     Identifies the module that created the application
  359.         //     object.  In a EXE, the local module is either the
  360.         //     exe module or the library module.  In a DLL, the
  361.         //     local module is either the library module or a
  362.         //     completely different module.
  363.  
  364.         const WModule & GetLocalModule() const;
  365.  
  366.         // MultiOSWarnings
  367.  
  368.         WBool GetMultiOSWarnings() const;
  369.         WBool SetMultiOSWarnings( WBool warnings );
  370.  
  371.         /*************************************************************
  372.          * Methods
  373.          *************************************************************/
  374.  
  375.         // EmptyClipboard
  376.  
  377.         WBool EmptyClipboard( WWindow * owner=NULL );
  378.  
  379.         // Initialize 
  380.         //
  381.         //    Call this to initialize the library.  Appropriate defaults
  382.         //    are used.
  383.  
  384.         WBool Initialize( unsigned int instance,
  385.                           unsigned int prevInstance,
  386.                           const WAnsiChar *commandLine, int showState );
  387.         WBool Initialize( WModuleHandle instance=0,
  388.                           WModuleHandle prevInstance=0,
  389.                           WAnsiChar *commandLine=NULL, int showState=0 );
  390.  
  391.         // Quit
  392.  
  393.         void Quit( WDWord exitCode=0 );
  394.  
  395.         // Run 
  396.  
  397.         WLong Run();
  398.  
  399.         // Uninitialize
  400.  
  401.         WLong Uninitialize();
  402.  
  403.         /*************************************************************
  404.          * Static Properties
  405.          *************************************************************/
  406.  
  407.         // ActiveWindow
  408.  
  409.         static WWindow *GetActiveWindow();
  410.         static WBool    SetActiveWindow( WWindow *win );
  411.  
  412.         // ApplicationObject
  413.  
  414.         static WApplication *GetApplicationObject();
  415.         static WBool         SetApplicationObject( WApplication * appObj );
  416.  
  417.         // CaptionSize
  418.  
  419.         static WInt GetCaptionSize();
  420.  
  421.         // CommandLine
  422.         //
  423.         //     Return the command line used to start the app.
  424.  
  425.         static WString GetCommandLine();
  426.  
  427.         // GetWorkArea
  428.  
  429.         static WRect GetWorkArea();
  430.  
  431.         // ComputerName
  432.         //
  433.         //     Name of this computer.
  434.  
  435.         static WString GetComputerName();
  436.  
  437.         // DesktopWindowHandle
  438.  
  439.         static WWindowHandle GetDesktopWindowHandle();
  440.  
  441.         // DialogBaseWidth
  442.  
  443.         static WFloat WCMRETURNSFLOAT GetDialogBaseHeight( const WFont & font );
  444.  
  445.         // DialogBaseWidth
  446.  
  447.         static WFloat WCMRETURNSFLOAT GetDialogBaseWidth( const WFont & font );
  448.  
  449.         // DialogFrameHeight
  450.  
  451.         static WInt GetDialogFrameHeight();
  452.     
  453.         // DialogFrameWidth
  454.  
  455.         static WInt GetDialogFrameWidth();
  456.  
  457.         // EnvironmentVariable
  458.  
  459.         static WString GetEnvironmentVariable( const WString & name );
  460.         static WBool   SetEnvironmentVariable( const WString & name,
  461.                                                const WString & value );
  462.  
  463.         // ExecutableModule
  464.         //
  465.         //     Identifies the EXE's module.
  466.  
  467.         static const WModule & GetExecutableModule();
  468.  
  469.         // ExecutableType
  470.  
  471.         static WExecutableFileType GetExecutableType( const WFilePath & exe );
  472.  
  473.         // FileAttributes
  474.  
  475.         static WFileAttribute GetFileAttributes( const WFilePath & file );
  476.         static WBool SetFileAttributes( const WFilePath & file,
  477.                                         WFileAttribute attribute=0 );
  478.  
  479.         // FileDisplayName
  480.  
  481.         static WString GetFileDisplayName( const WFilePath & file,
  482.                                            WBool useFileAttributes=FALSE,
  483.                                            WFileAttribute attribute=0 );
  484.  
  485.         // FileType
  486.  
  487.         static WString GetFileType( const WFilePath & file,
  488.                                     WBool useFileAttributes=FALSE,
  489.                                     WFileAttribute attribute=0 );
  490.  
  491.         // FocusWindow
  492.  
  493.         static WWindow * GetFocusWindow();
  494.  
  495.         // ForegroundWindow
  496.  
  497.         static WBool SetForegroundWindow( WWindow * window );
  498.         static WWindow * GetForegroundWindow();
  499.  
  500.         // ForegroundWindowHandle
  501.  
  502.         static WWindowHandle GetForegroundWindowHandle();
  503.  
  504.         // FrameHeight
  505.  
  506.         static WInt GetFrameHeight();
  507.     
  508.         // FrameWidth
  509.  
  510.         static WInt GetFrameWidth();
  511.     
  512.         // HScrollBarHeight
  513.  
  514.         static WInt GetHScrollBarHeight();
  515.  
  516.         // KeyboardState
  517.  
  518.         static WULong GetKeyboardState();
  519.  
  520.         // LibraryModule
  521.         //
  522.         //     Identifies the WClass DLL's module.  Note that in a
  523.         //     standalone exe LibraryModule == ExecutableModule.
  524.  
  525.         static const WModule & GetLibraryModule();
  526.  
  527.         // MousePresent
  528.  
  529.         static WBool GetMousePresent();
  530.  
  531.         // MenuCheckMarkHeight
  532.  
  533.         static WInt GetMenuCheckMarkHeight();
  534.     
  535.         // MenuCheckMarkWidth
  536.  
  537.         static WInt GetMenuCheckMarkWidth();
  538.     
  539.         // ProfileString
  540.  
  541.         static WString GetProfileString( WString sectionName, WString keyName,
  542.                                          WString defaultString,
  543.                                          WString fileName = "WIN.INI" );
  544.                                          
  545.         static WBool SetProfileString( WString sectionName, WString keyName,
  546.                                        WString value,
  547.                                        WString fileName = "WIN.INI",
  548.                                        WBool flushCache = TRUE );
  549.  
  550.         // ProgramPath
  551.         //
  552.         //     Return the full path to the running executable.
  553.  
  554.         static WString GetProgramPath();
  555.  
  556.         // ScreenSize
  557.  
  558.         static WRect GetScreenSize();
  559.  
  560.         // SystemDirectory
  561.         //
  562.         //     Returns path of the system directory.
  563.  
  564.         static WString GetSystemDirectory();
  565.  
  566.         // SystemTime
  567.         //
  568.         //
  569.         static WTime GetSystemTime();
  570.  
  571.         // UserName
  572.         //
  573.         //     User's login name.
  574.  
  575.         static WString GetUserName();
  576.  
  577.         // VScrollBarWidth
  578.  
  579.         static WInt GetVScrollBarWidth();
  580.  
  581.         // WindowsDirectory
  582.         //
  583.         //     Returns path of the Windows directory.
  584.  
  585.         static WString GetWindowsDirectory();
  586.  
  587.         // WorkingDirectory
  588.         //
  589.         //     Return the full path of the current directory.
  590.  
  591.         static WString GetWorkingDirectory();
  592.  
  593.         /*************************************************************
  594.          * Static Methods
  595.          *************************************************************/
  596.  
  597.         // AbortSystemShutdown
  598.  
  599.         static WBool AbortSystemShutdown( WChar * machineName=NULL );
  600.  
  601.         // AddToRecentDocumentList
  602.  
  603.         static void AddToRecentDocumentList( const WFilePath & file );
  604.  
  605.         // Beep
  606.  
  607.         static WBool Beep( WBeepSound sound=WBeepStandard );
  608.  
  609.         // ClearRecentDocumentList
  610.  
  611.         static void ClearRecentDocumentList();
  612.  
  613.         // CopyFile
  614.  
  615.         static WBool CopyFile( const WFilePath & source,
  616.                                const WFilePath & dest, WWindow * parent=NULL,
  617.                                WSHFileFlag flags=WSFFDefaultCopy,
  618.                                const WChar * progressTitle=NULL,
  619.                                WBool * userAborted=NULL );
  620.  
  621.         // DeleteFile
  622.  
  623.         static WBool DeleteFile( const WFilePath & source,
  624.                                  WWindow * parent=NULL,
  625.                                  WSHFileFlag flags=WSFFDefaultDelete,
  626.                                  const WChar * progressTitle=NULL,
  627.                                  WBool * userAborted=NULL );
  628.  
  629.         // EnumerateAllWindows
  630.  
  631.         static WBool EnumerateAllWindows( WObject * client,
  632.                                           WEnumCallback callback,
  633.                                           void * userData );
  634.  
  635.         // EnumerateChildWindows
  636.  
  637.         static WBool EnumerateChildWindows( WObject * client,
  638.                                             WEnumCallback callback,
  639.                                             void * userData,
  640.                                             WWindow * parent );
  641.  
  642.         // EnumerateTopLevelWindows
  643.  
  644.         static WBool EnumerateTopLevelWindows( WObject * client,
  645.                                                WEnumCallback callback,
  646.                                                void * userData );
  647.  
  648.         // Execute
  649.  
  650.         static WBool Execute(const WFilePath & file,
  651.                              const WString & operation = WNullString,
  652.                              const WString & parameters = WEmptyString,
  653.                              WInt cmdShow = WWinStateShowNormal,
  654.                              WWindow* parent = NULL);
  655.  
  656.         // ExtractIcon
  657.  
  658.         static WIcon ExtractIcon(const WFilePath & file,
  659.                                  WBool associated = TRUE,
  660.                                  WUInt index = 0);
  661.  
  662.         // FindExecutable
  663.  
  664.         static WBool FindExecutable(const WFilePath & file,  WString & nameEXE);
  665.  
  666.         // ForceDelete
  667.  
  668.         static void ForceDelete( WBool evenInEventHandler=FALSE,
  669.                                  WObject * calledFrom=NULL );
  670.  
  671.         // InitiateSystemShutdown
  672.  
  673.         static WBool InitiateSystemShutdown( WChar * message=NULL,
  674.                                              WLong timeout=0,
  675.                                              WBool forceAppsToClose=TRUE,
  676.                                              WBool reboot=FALSE,
  677.                                              WChar * machineName=NULL );
  678.  
  679.         // InvokeHelp
  680.         //
  681.         //    Invoke the help subsystem.  A form is required for the
  682.         //    help subsystem to keep track of help requests.  If no
  683.         //    filename is specified, the file in the HelpFile property
  684.         //    is used instead.
  685.  
  686.         static WBool InvokeHelp( WWindow * window, WHelpType type,
  687.                           WULong helpID, const WChar * helpFileName=NULL,
  688.                           WWindowHandle windowHandle=NULLHWND );
  689.         static WBool InvokeHelp( WWindow * window, WHelpType type,
  690.                           const WChar * helpCommand,
  691.                           const WChar * helpFileName=NULL );
  692.  
  693.         // MoveFile
  694.  
  695.         static WBool MoveFile( const WFilePath & source,
  696.                                const WFilePath & dest,
  697.                                WWindow * parent=NULL,
  698.                                WSHFileFlag flags=WSFFDefaultMove,
  699.                                const WChar * progressTitle=NULL,
  700.                                WBool * userAborted=NULL );
  701.  
  702.         // MultiOSWarning
  703.  
  704.         static void MultiOSWarning( WOSType os, WChar * message );
  705.  
  706.         // OSType
  707.         //
  708.         //    Return the type of OS we're running on (NT, Win95, Win16,
  709.         //    or Win32s) and optionally fill in a WOSVersionInfo
  710.         //    structure.
  711.  
  712.         static WOSType OSType( WOSVersionInfo *info=NULL );
  713.  
  714.         // PlaySound (WAVEFORM sound file format)
  715.  
  716.         static WBool PlaySound( const WString & sound,
  717.                                 WULong flag=WPSFlagFileName|WPSFlagAsync,
  718.                                 WModuleHandle module=_ApplicationModule );
  719.  
  720.         // PostMessage
  721.  
  722.         static WLong PostMessage( WWindow * win, const WMessage & msg );
  723.         static WLong PostMessage( const WMessage & msg );
  724.  
  725.         // RegisterDeleteObject (alternative to delete this)
  726.  
  727.         static WBool RegisterDeleteObject( WObject * object );
  728.  
  729.         // RenameFile
  730.  
  731.         static WBool RenameFile( const WFilePath & source,
  732.                                  const WFilePath & dest,
  733.                                  WWindow * parent=NULL,
  734.                                  WSHFileFlag flags=WSFFDefaultRename,
  735.                                  const WChar * progressTitle=NULL,
  736.                                  WBool * userAborted=NULL );
  737.  
  738.         // SendMessage
  739.  
  740.         static WLong SendMessage( WWindow * win, const WMessage & msg );
  741.         static WLong SendMessage( const WMessage & msg );
  742.  
  743.         // Wait
  744.         //
  745.         //    Wait for semaphore, thread, process, et. al.
  746.  
  747.         static WWaitReturn Wait( WULong handle, WULong secondsToWait=0,
  748.                                  WBool waitForever=FALSE );
  749.  
  750.         /*************************************************************
  751.          * Data members
  752.          *************************************************************/
  753.  
  754.     #ifdef __BUILDING_WCM__
  755.     public:
  756.     #else
  757.     protected:
  758.     #endif
  759.  
  760.         WStartEventData         _event;
  761.         WModule                 _localModule;
  762.         WFilePath               _helpFile;
  763.         WDWord                  _mainThreadID;
  764.         WBool                   _multiOSWarnings;
  765.         WBool                   _autoContextHelp;
  766.  
  767.         static WApplication    *_globalObject;
  768.         static WModule          _libraryModule;
  769.         static WModule          _exeModule;
  770. };
  771.  
  772. class WCMCLASS WExeApplication : public WApplication {
  773.     WDeclareSubclass( WExeApplication, WApplication );
  774.  
  775.     public:
  776.         WExeApplication();
  777.  
  778.         ~WExeApplication();
  779.  
  780.         /*************************************************************
  781.          * Methods
  782.          *************************************************************/
  783.  
  784.         // EntryPoint
  785.         //
  786.         //     Note that the second just calls the first and is provided
  787.         //     for backwards compatibility.
  788.  
  789.         int EntryPoint( WModuleHandle inst, WModuleHandle prev,
  790.                         WAnsiChar *command, int show );
  791.         int EntryPoint( unsigned int inst, unsigned int prev,
  792.                         const WAnsiChar *command, int show );
  793.  
  794.         /*************************************************************
  795.          * Data members
  796.          *************************************************************/
  797.     private:
  798. };
  799.  
  800. /********************************************************************
  801.  *
  802.  * WDLLApplication
  803.  *
  804.  *   Events:
  805.  *
  806.  *      ProcessAttach --
  807.  *
  808.  *      ProcessDetach --
  809.  *
  810.  *      ThreadAttach --
  811.  *
  812.  *      ThreadDetach --
  813.  *
  814.  ********************************************************************/
  815.  
  816. class WCMCLASS WDLLApplication : public WApplication {
  817.     WDeclareSubclass( WDLLApplication, WApplication );
  818.  
  819.     public:
  820.         WDLLApplication();
  821.  
  822.         ~WDLLApplication();
  823.  
  824.         /*************************************************************
  825.          * Methods
  826.          *************************************************************/
  827.  
  828.         // EntryPoint
  829.         //
  830.         //     Note that the second just calls the first and is provided
  831.         //     for backwards compatibility.
  832.  
  833.         WBool EntryPoint( WModuleHandle inst, unsigned int reason,
  834.                           void * data );
  835.         WBool EntryPoint( unsigned int inst, unsigned int reason,
  836.                           void * data );
  837.  
  838.         /*************************************************************
  839.          * Data members
  840.          *************************************************************/
  841.     private:
  842. };
  843.  
  844. #if defined( _DEBUG ) && defined( __BUILDING_WCM__ )
  845. #define WMULTIOSWARNING( os, msg ) \
  846.                 if( WApplication::_globalObject && \
  847.                     WApplication::_globalObject->_multiOSWarnings && \
  848.                     ___WCMOSVersion == os ){ \
  849.                     WApplication::MultiOSWarning( os, msg );\
  850.                 }
  851. #elif defined( _DEBUG )
  852. #define WMULTIOSWARNING( os, msg )                                      \
  853.                 if( WApplication::GetApplicationObject() != NULL && WApplication::GetApplicationObject()->GetMultiOSWarnings() && WApplication::OSType() == os ) {      \
  854.                     WApplication::MultiOSWarning( os, msg );            \
  855.                 }
  856. #else
  857. #define WMULTIOSWARNING( os, msg )
  858. #endif
  859.  
  860. #ifndef _WNO_PRAGMA_PUSH
  861. #pragma enum pop;
  862. #pragma pack(pop);
  863. #endif
  864.  
  865. #endif // _WAPPLIC_HPP_INCLUDED
  866.