home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / atl / atlcon / atlcon.cpp next >
C/C++ Source or Header  |  1998-04-03  |  2KB  |  58 lines

  1. // ATLCon.cpp : Example showing how to host controls and
  2. //              create frame windows using ATL
  3. //
  4. // This is a part of the Active Template Library.
  5. // Copyright (C) 1996-1998 Microsoft Corporation
  6. // All rights reserved.
  7. //
  8. // This source code is only intended as a supplement to the
  9. // Active Template Library Reference and related
  10. // electronic documentation provided with the library.
  11. // See these sources for detailed information regarding the
  12. // Active Template Library product.
  13.  
  14. #include "stdafx.h"
  15. #include "resource.h"
  16. #include "initguid.h"
  17. #include "ATLCon.h"
  18. #include "ATLCon_i.c"
  19. #include "ATLCon1.h"
  20. #pragma comment(lib, "comctl32.lib")
  21.  
  22. CComModule _Module;
  23.  
  24. BEGIN_OBJECT_MAP(ObjectMap)
  25. END_OBJECT_MAP()
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. //
  29. extern "C" int WINAPI _tWinMain(HINSTANCE hInstance,
  30.     HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/)
  31. {
  32.     lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
  33.  
  34.     CoInitialize(0);
  35.     _Module.Init(ObjectMap, hInstance, &LIBID_ATLCONLib);
  36.  
  37.     // This is because the property browser control uses SysListView32
  38.     ::InitCommonControls();
  39.  
  40.     RECT rcPos = { CW_USEDEFAULT, 0, 0, 0 };
  41.     HMENU hMenu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MENU1));
  42.     HICON hIcon = LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON1));
  43.     CAtlCon frame;
  44.     frame.GetWndClassInfo().m_wc.hIcon = hIcon;
  45.     frame.Create(GetDesktopWindow(), rcPos, _T("ATL Container"), 0, 0, (UINT)hMenu);
  46.     frame.ShowWindow(SW_SHOWNORMAL);
  47.  
  48.     MSG msg;
  49.     while (GetMessage(&msg, 0, 0, 0))
  50.     {
  51.         TranslateMessage(&msg);
  52.         DispatchMessage(&msg);
  53.     }
  54.     _Module.Term();
  55.     CoUninitialize();
  56.     return 0;
  57. }
  58.