home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / Chip_2001-06_cd1.bin / zkuste / vbasic / Data / Utility / MSISDK15.msi / CustExe1.cpp < prev    next >
C/C++ Source or Header  |  2000-10-05  |  3KB  |  93 lines

  1. #pragma message("Custom Action Test EXE.  Copyright (c) 1997 - 2000 Microsoft Corporation. All rights reserved.")
  2. #if 0  // makefile definitions
  3. DESCRIPTION = Custom Action Test EXE
  4. MODULENAME  = CustExe1
  5. FILEVERSION = 1.0,0,0
  6. SUBSYSTEM = windows
  7. !include "..\TOOLS\MsiTool.mak"
  8. !if 0  #nmake skips the rest of this file
  9. #endif // end of makefile definitions
  10.  
  11. //+-------------------------------------------------------------------------
  12. //
  13. //  Microsoft Windows
  14. //
  15. //  Copyright (C) Microsoft Corporation, 1997 - 2000
  16. //
  17. //  File:       custexe1.cpp
  18. //
  19. //--------------------------------------------------------------------------
  20.  
  21. //-----------------------------------------------------------------------------------------
  22. //
  23. // BUILD Instructions
  24. //
  25. // notes:
  26. //    - SDK represents the full path to the install location of the
  27. //     Windows Installer SDK
  28. //
  29. // Using NMake:
  30. //        %vcbin%\nmake -f custexe1.cpp include="%include;SDK\Include" lib="%lib%;SDK\Lib"
  31. //
  32. // Using MsDev:
  33. //        1. Create a new Win32 Application project
  34. //      2. Add custexe1.cpp to the project
  35. //      3. Add SDK\Include and SDK\Lib directories on the Tools\Options Directories tab
  36. //      4. Add msi.lib to the library list in the Project Settings dialog
  37. //          (in addition to the standard libs included by MsDev)
  38. //
  39. //------------------------------------------------------------------------------------------
  40.  
  41. #define WINDOWS_LEAN_AND_MEAN  // faster compile
  42. #include <windows.h>
  43. #include <tchar.h>   // define UNICODE=1 on nmake command line to build UNICODE
  44. #define IDD_TEST 1
  45. #ifndef RC_INVOKED   // start of CPP source code
  46.  
  47. BOOL CALLBACK DialogProc(HWND  hwndDlg, UINT uMsg, WPARAM wParam, LPARAM  lParam)
  48. {
  49.     switch (uMsg)
  50.     {
  51.     case WM_INITDIALOG: return TRUE; // indicate we did not set focus to the control
  52.     case WM_COMMAND:
  53.         switch (wParam)
  54.         {
  55.         case IDOK:     PostQuitMessage(0); return TRUE;
  56.         case IDCANCEL: PostQuitMessage(1); return TRUE;
  57.         }
  58.         return FALSE;
  59.     default: return FALSE;
  60.     };
  61. }
  62.  
  63. extern "C" int __stdcall _tWinMain(HINSTANCE hInst, HINSTANCE/*hPrev*/, TCHAR* szCmdLine, int/*show*/)
  64. {
  65.     if ((szCmdLine[0]=='-' || szCmdLine[0]=='/') && (szCmdLine[1]=='Q' || szCmdLine[1]=='q'))
  66.         return 0;
  67.     HWND hWnd = ::CreateDialog(hInst, MAKEINTRESOURCE(1), 0, (DLGPROC)DialogProc);
  68.     if (hWnd == 0)
  69.         return 2;
  70.     ::SetDlgItemText(hWnd, 8, szCmdLine);
  71. //    ::ShowWindow(hWnd, SW_SHOW); //!! why do we need this?
  72.     MSG msg;
  73.     while (::GetMessage(&msg, 0, 0, 0) == TRUE)
  74.         ::IsDialogMessage(hWnd, &msg);
  75.     ::DestroyWindow(hWnd);
  76.     return (int) msg.wParam;
  77. }
  78.  
  79. #else // RC_INVOKED, end of source code, start of resources
  80. IDD_TEST DIALOG 150, 150, 160, 75
  81. STYLE DS_MODALFRAME | DS_NOIDLEMSG | WS_POPUP | WS_CAPTION | WS_VISIBLE
  82. CAPTION "Custom Action Test EXE"
  83. FONT 12, "Arial"
  84. {
  85.  LTEXT      "",         8,         20,  7, 120, 40
  86.  PUSHBUTTON "&Succeed", IDOK,      20, 50,  40, 16
  87.  PUSHBUTTON "&Fail",    IDCANCEL, 100, 50,  40, 16
  88. }
  89. #endif // RC_INVOKED
  90. #if 0 
  91. !endif // makefile terminator
  92. #endif
  93.