rwexe_m.cpp
Upload User: caisha3
Upload Date: 2013-09-21
Package Size: 208739k
Code Size: 2k
Category:

Windows Develop

Development Platform:

Visual C++

  1. /*************************************************************************
  2. **
  3. **    
  4. ** File  :    RWExeMain.cpp
  5. **      Product  :
  6. ** Date  :    05/07/97
  7. ** Author  :    Suresh Krishnan
  8. **
  9. **   Registration Wizard Exe programs main file
  10. **   The Exe version of Registration Wizard is implemented using the Active X 
  11. **   component
  12. ** Modification History
  13. **     07/20/98 : The RegWizControl is changed  from Button control to an IE object,
  14. **                some of the properties like Text, HWND  of the button no longer exists.
  15. *************************************************************************/
  16. #include <stdio.h>
  17. #include <tchar.h>
  18. #include "rwexe_m.h"
  19. #include "regwizC_i.c"
  20. #define STRCONVERT_MAXLEN 256
  21. OLECHAR* ConvertToUnicode(char FAR* szA)
  22. {
  23.   static OLECHAR achW[STRCONVERT_MAXLEN]; 
  24.   MultiByteToWideChar(CP_ACP, 0, szA, -1, achW, STRCONVERT_MAXLEN);  
  25.   return achW; 
  26. }
  27. int LoadAndUseRegWizCtrl(TCHAR *lpCmdLine)
  28. {
  29. HRESULT hr;
  30. IRegWizCtrl *pRegWiz;
  31. hr = CoCreateInstance( CLSID_RegWizCtrl,
  32.                        NULL,
  33.                        CLSCTX_ALL,
  34.                        IID_IRegWizCtrl,
  35.                        (void**)&pRegWiz);
  36. if(FAILED(hr) ){
  37. //printf("n Error Creating Interface...");
  38. return 0;
  39. }else {
  40. //printf("n Created Interface (IExeTest)...");
  41. }
  42. // Invoke register
  43. #ifndef _UNICODE 
  44. hr = pRegWiz->InvokeRegWizard(ConvertToUnicode(lpCmdLine));
  45. #else
  46. hr = pRegWiz->InvokeRegWizard(lpCmdLine);
  47. #endif
  48. return 0;
  49. }
  50. int APIENTRY WinMain (HINSTANCE hinst, 
  51.   HINSTANCE hinstPrev, 
  52.   LPSTR lpCmdLine, 
  53.   int nCmdShow)
  54. {
  55. CoInitialize(NULL);
  56. LoadAndUseRegWizCtrl(lpCmdLine);
  57. CoUninitialize();
  58. return 1;
  59. }