home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / winui / shell / bandobjs / explrbar.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-12-11  |  18.8 KB  |  791 lines

  1. /**************************************************************************
  2.    THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  3.    ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  4.    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  5.    PARTICULAR PURPOSE.
  6.  
  7.    Copyright 1997 - 1998 Microsoft Corporation.  All Rights Reserved.
  8. **************************************************************************/
  9.  
  10. /**************************************************************************
  11.  
  12.    File:          ExplorerBar.cpp
  13.    
  14.    Description:   Implements CExplorerBar
  15.  
  16. **************************************************************************/
  17.  
  18. /**************************************************************************
  19.    #include statements
  20. **************************************************************************/
  21.  
  22. #include "ExplrBar.h"
  23. #include "Guid.h"
  24.  
  25. /**************************************************************************
  26.  
  27.    CExplorerBar::CExplorerBar()
  28.  
  29. **************************************************************************/
  30.  
  31. CExplorerBar::CExplorerBar()
  32. {
  33. m_pSite = NULL;
  34.  
  35. m_hWnd = NULL;
  36. m_hwndParent = NULL;
  37.  
  38. m_bFocus = FALSE;
  39.  
  40. m_dwViewMode = 0;
  41. m_dwBandID = 0;
  42.  
  43. m_ObjRefCount = 1;
  44. g_DllRefCount++;
  45. }
  46.  
  47. /**************************************************************************
  48.  
  49.    CExplorerBar::~CExplorerBar()
  50.  
  51. **************************************************************************/
  52.  
  53. CExplorerBar::~CExplorerBar()
  54. {
  55. //this should have been freed in a call to SetSite(NULL), but just to be safe
  56. if(m_pSite)
  57.    {
  58.    m_pSite->Release();
  59.    m_pSite = NULL;
  60.    }
  61.  
  62. g_DllRefCount--;
  63. }
  64.  
  65. ///////////////////////////////////////////////////////////////////////////
  66. //
  67. // IUnknown Implementation
  68. //
  69.  
  70. /**************************************************************************
  71.  
  72.    CExplorerBar::QueryInterface
  73.  
  74. **************************************************************************/
  75.  
  76. STDMETHODIMP CExplorerBar::QueryInterface(REFIID riid, LPVOID *ppReturn)
  77. {
  78. *ppReturn = NULL;
  79.  
  80. //IUnknown
  81. if(IsEqualIID(riid, IID_IUnknown))
  82.    {
  83.    *ppReturn = this;
  84.    }
  85.  
  86. //IOleWindow
  87. else if(IsEqualIID(riid, IID_IOleWindow))
  88.    {
  89.    *ppReturn = (IOleWindow*)this;
  90.    }
  91.  
  92. //IDockingWindow
  93. else if(IsEqualIID(riid, IID_IDockingWindow))
  94.    {
  95.    *ppReturn = (IDockingWindow*)this;
  96.    }   
  97.  
  98. //IInputObject
  99. else if(IsEqualIID(riid, IID_IInputObject))
  100.    {
  101.    *ppReturn = (IInputObject*)this;
  102.    }   
  103.  
  104. //IObjectWithSite
  105. else if(IsEqualIID(riid, IID_IObjectWithSite))
  106.    {
  107.    *ppReturn = (IObjectWithSite*)this;
  108.    }   
  109.  
  110. //IDeskBand
  111. else if(IsEqualIID(riid, IID_IDeskBand))
  112.    {
  113.    *ppReturn = (IDeskBand*)this;
  114.    }   
  115.  
  116. //IPersist
  117. else if(IsEqualIID(riid, IID_IPersist))
  118.    {
  119.    *ppReturn = (IPersist*)this;
  120.    }   
  121.  
  122. //IPersistStream
  123. else if(IsEqualIID(riid, IID_IPersistStream))
  124.    {
  125.    *ppReturn = (IPersistStream*)this;
  126.    }   
  127.  
  128. //IContextMenu
  129. else if(IsEqualIID(riid, IID_IContextMenu))
  130.    {
  131.    *ppReturn = (IContextMenu*)this;
  132.    }   
  133.  
  134. if(*ppReturn)
  135.    {
  136.    (*(LPUNKNOWN*)ppReturn)->AddRef();
  137.    return S_OK;
  138.    }
  139.  
  140. return E_NOINTERFACE;
  141. }                                             
  142.  
  143. /**************************************************************************
  144.  
  145.    CExplorerBar::AddRef
  146.  
  147. **************************************************************************/
  148.  
  149. STDMETHODIMP_(DWORD) CExplorerBar::AddRef()
  150. {
  151. return ++m_ObjRefCount;
  152. }
  153.  
  154.  
  155. /**************************************************************************
  156.  
  157.    CExplorerBar::Release
  158.  
  159. **************************************************************************/
  160.  
  161. STDMETHODIMP_(DWORD) CExplorerBar::Release()
  162. {
  163. if(--m_ObjRefCount == 0)
  164.    {
  165.    delete this;
  166.    return 0;
  167.    }
  168.    
  169. return m_ObjRefCount;
  170. }
  171.  
  172. ///////////////////////////////////////////////////////////////////////////
  173. //
  174. // IOleWindow Implementation
  175. //
  176.  
  177. /**************************************************************************
  178.  
  179.    CExplorerBar::GetWindow()
  180.    
  181. **************************************************************************/
  182.  
  183. STDMETHODIMP CExplorerBar::GetWindow(HWND *phWnd)
  184. {
  185. *phWnd = m_hWnd;
  186.  
  187. return S_OK;
  188. }
  189.  
  190. /**************************************************************************
  191.  
  192.    CExplorerBar::ContextSensitiveHelp()
  193.    
  194. **************************************************************************/
  195.  
  196. STDMETHODIMP CExplorerBar::ContextSensitiveHelp(BOOL fEnterMode)
  197. {
  198. return E_NOTIMPL;
  199. }
  200.  
  201. ///////////////////////////////////////////////////////////////////////////
  202. //
  203. // IDockingWindow Implementation
  204. //
  205.  
  206. /**************************************************************************
  207.  
  208.    CExplorerBar::ShowDW()
  209.    
  210. **************************************************************************/
  211.  
  212. STDMETHODIMP CExplorerBar::ShowDW(BOOL fShow)
  213. {
  214. if(m_hWnd)
  215.    {
  216.    if(fShow)
  217.       {
  218.       //show our window
  219.       ShowWindow(m_hWnd, SW_SHOW);
  220.       }
  221.    else
  222.       {
  223.       //hide our window
  224.       ShowWindow(m_hWnd, SW_HIDE);
  225.       }
  226.    }
  227.  
  228. return S_OK;
  229. }
  230.  
  231. /**************************************************************************
  232.  
  233.    CExplorerBar::CloseDW()
  234.    
  235. **************************************************************************/
  236.  
  237. STDMETHODIMP CExplorerBar::CloseDW(DWORD dwReserved)
  238. {
  239. ShowDW(FALSE);
  240.  
  241. if(IsWindow(m_hWnd))
  242.    DestroyWindow(m_hWnd);
  243.  
  244. m_hWnd = NULL;
  245.    
  246. return S_OK;
  247. }
  248.  
  249. /**************************************************************************
  250.  
  251.    CExplorerBar::ResizeBorderDW()
  252.    
  253. **************************************************************************/
  254.  
  255. STDMETHODIMP CExplorerBar::ResizeBorderDW(   LPCRECT prcBorder, 
  256.                                           IUnknown* punkSite, 
  257.                                           BOOL fReserved)
  258. {
  259. /*
  260. This method is never called for Band Objects.
  261. */
  262. return E_NOTIMPL;
  263. }
  264.  
  265. ///////////////////////////////////////////////////////////////////////////
  266. //
  267. // IInputObject Implementation
  268. //
  269.  
  270. /**************************************************************************
  271.  
  272.    CExplorerBar::UIActivateIO()
  273.    
  274. **************************************************************************/
  275.  
  276. STDMETHODIMP CExplorerBar::UIActivateIO(BOOL fActivate, LPMSG pMsg)
  277. {
  278. if(fActivate)
  279.    SetFocus(m_hWnd);
  280.  
  281. return S_OK;
  282. }
  283.  
  284. /**************************************************************************
  285.  
  286.    CExplorerBar::HasFocusIO()
  287.    
  288.    If this window or one of its decendants has the focus, return S_OK. Return 
  289.    S_FALSE if we don't have the focus.
  290.  
  291. **************************************************************************/
  292.  
  293. STDMETHODIMP CExplorerBar::HasFocusIO(void)
  294. {
  295. if(m_bFocus)
  296.    return S_OK;
  297.  
  298. return S_FALSE;
  299. }
  300.  
  301. /**************************************************************************
  302.  
  303.    CExplorerBar::TranslateAcceleratorIO()
  304.    
  305.    If the accelerator is translated, return S_OK or S_FALSE otherwise.
  306.  
  307. **************************************************************************/
  308.  
  309. STDMETHODIMP CExplorerBar::TranslateAcceleratorIO(LPMSG pMsg)
  310. {
  311. return S_FALSE;
  312. }
  313.  
  314. ///////////////////////////////////////////////////////////////////////////
  315. //
  316. // IObjectWithSite implementations
  317. //
  318.  
  319. /**************************************************************************
  320.  
  321.    CExplorerBar::SetSite()
  322.    
  323. **************************************************************************/
  324.  
  325. STDMETHODIMP CExplorerBar::SetSite(IUnknown* punkSite)
  326. {
  327. //If a site is being held, release it.
  328. if(m_pSite)
  329.    {
  330.    m_pSite->Release();
  331.    m_pSite = NULL;
  332.    }
  333.  
  334. //If punkSite is not NULL, a new site is being set.
  335. if(punkSite)
  336.    {
  337.    //Get the parent window.
  338.    IOleWindow  *pOleWindow;
  339.  
  340.    m_hwndParent = NULL;
  341.    
  342.    if(SUCCEEDED(punkSite->QueryInterface(IID_IOleWindow, (LPVOID*)&pOleWindow)))
  343.       {
  344.       pOleWindow->GetWindow(&m_hwndParent);
  345.       pOleWindow->Release();
  346.       }
  347.  
  348.    if(!m_hwndParent)
  349.       return E_FAIL;
  350.  
  351.    if(!RegisterAndCreateWindow())
  352.       return E_FAIL;
  353.  
  354.    //Get and keep the IInputObjectSite pointer.
  355.    if(SUCCEEDED(punkSite->QueryInterface(IID_IInputObjectSite, (LPVOID*)&m_pSite)))
  356.       {
  357.       return S_OK;
  358.       }
  359.    
  360.    return E_FAIL;
  361.    }
  362.  
  363. return S_OK;
  364. }
  365.  
  366. /**************************************************************************
  367.  
  368.    CExplorerBar::GetSite()
  369.    
  370. **************************************************************************/
  371.  
  372. STDMETHODIMP CExplorerBar::GetSite(REFIID riid, LPVOID *ppvReturn)
  373. {
  374. *ppvReturn = NULL;
  375.  
  376. if(m_pSite)
  377.    return m_pSite->QueryInterface(riid, ppvReturn);
  378.  
  379. return E_FAIL;
  380. }
  381.  
  382. ///////////////////////////////////////////////////////////////////////////
  383. //
  384. // IDeskBand implementation
  385. //
  386.  
  387. /**************************************************************************
  388.  
  389.    CExplorerBar::GetBandInfo()
  390.    
  391. **************************************************************************/
  392.  
  393. STDMETHODIMP CExplorerBar::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO* pdbi)
  394. {
  395. if(pdbi)
  396.    {
  397.    m_dwBandID = dwBandID;
  398.    m_dwViewMode = dwViewMode;
  399.  
  400.    if(pdbi->dwMask & DBIM_MINSIZE)
  401.       {
  402.       pdbi->ptMinSize.x = MIN_SIZE_X;
  403.       pdbi->ptMinSize.y = MIN_SIZE_Y;
  404.       }
  405.  
  406.    if(pdbi->dwMask & DBIM_MAXSIZE)
  407.       {
  408.       pdbi->ptMaxSize.x = -1;
  409.       pdbi->ptMaxSize.y = -1;
  410.       }
  411.  
  412.    if(pdbi->dwMask & DBIM_INTEGRAL)
  413.       {
  414.       pdbi->ptIntegral.x = 1;
  415.       pdbi->ptIntegral.y = 1;
  416.       }
  417.  
  418.    if(pdbi->dwMask & DBIM_ACTUAL)
  419.       {
  420.       pdbi->ptActual.x = 0;
  421.       pdbi->ptActual.y = 0;
  422.       }
  423.  
  424.    if(pdbi->dwMask & DBIM_TITLE)
  425.       {
  426.       lstrcpyW(pdbi->wszTitle, L"Sample Explorer Bar");
  427.       }
  428.  
  429.    if(pdbi->dwMask & DBIM_MODEFLAGS)
  430.       {
  431.       pdbi->dwModeFlags = DBIMF_VARIABLEHEIGHT;
  432.       }
  433.    
  434.    if(pdbi->dwMask & DBIM_BKCOLOR)
  435.       {
  436.       //Use the default background color by removing this flag.
  437.       pdbi->dwMask &= ~DBIM_BKCOLOR;
  438.       }
  439.  
  440.    return S_OK;
  441.    }
  442.  
  443. return E_INVALIDARG;
  444. }
  445.  
  446. ///////////////////////////////////////////////////////////////////////////
  447. //
  448. // IPersistStream implementations
  449. // 
  450. // This is only supported to allow the desk band to be dropped on the 
  451. // desktop and to prevent multiple instances of the desk band from showing 
  452. // up in the context menu. This desk band doesn't actually persist any data.
  453. //
  454.  
  455. /**************************************************************************
  456.  
  457.    CExplorerBar::GetClassID()
  458.    
  459. **************************************************************************/
  460.  
  461. STDMETHODIMP CExplorerBar::GetClassID(LPCLSID pClassID)
  462. {
  463. *pClassID = CLSID_SampleExplorerBar;
  464.  
  465. return S_OK;
  466. }
  467.  
  468. /**************************************************************************
  469.  
  470.    CExplorerBar::IsDirty()
  471.    
  472. **************************************************************************/
  473.  
  474. STDMETHODIMP CExplorerBar::IsDirty(void)
  475. {
  476. return S_FALSE;
  477. }
  478.  
  479. /**************************************************************************
  480.  
  481.    CExplorerBar::Load()
  482.    
  483. **************************************************************************/
  484.  
  485. STDMETHODIMP CExplorerBar::Load(LPSTREAM pStream)
  486. {
  487. return S_OK;
  488. }
  489.  
  490. /**************************************************************************
  491.  
  492.    CExplorerBar::Save()
  493.    
  494. **************************************************************************/
  495.  
  496. STDMETHODIMP CExplorerBar::Save(LPSTREAM pStream, BOOL fClearDirty)
  497. {
  498. return S_OK;
  499. }
  500.  
  501. /**************************************************************************
  502.  
  503.    CExplorerBar::GetSizeMax()
  504.    
  505. **************************************************************************/
  506.  
  507. STDMETHODIMP CExplorerBar::GetSizeMax(ULARGE_INTEGER *pul)
  508. {
  509. return E_NOTIMPL;
  510. }
  511.  
  512. ///////////////////////////////////////////////////////////////////////////
  513. //
  514. // IContextMenu Implementation
  515. //
  516.  
  517. /**************************************************************************
  518.  
  519.    CExplorerBar::QueryContextMenu()
  520.  
  521. **************************************************************************/
  522.  
  523. STDMETHODIMP CExplorerBar::QueryContextMenu( HMENU hMenu,
  524.                                              UINT indexMenu,
  525.                                              UINT idCmdFirst,
  526.                                              UINT idCmdLast,
  527.                                              UINT uFlags)
  528. {
  529. if(!(CMF_DEFAULTONLY & uFlags))
  530.    {
  531.    InsertMenu( hMenu, 
  532.                indexMenu, 
  533.                MF_STRING | MF_BYPOSITION, 
  534.                idCmdFirst + IDM_COMMAND, 
  535.                "&Sample Explorer Bar Command");
  536.  
  537.    return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(IDM_COMMAND + 1));
  538.    }
  539.  
  540. return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(0));
  541. }
  542.  
  543. /**************************************************************************
  544.  
  545.    CExplorerBar::InvokeCommand()
  546.  
  547. **************************************************************************/
  548.  
  549. STDMETHODIMP CExplorerBar::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
  550. {
  551. switch (LOWORD(lpcmi->lpVerb))
  552.    {
  553.    case IDM_COMMAND:
  554.       MessageBox(lpcmi->hwnd, TEXT("Explorer Bar Command selected."), TEXT("Sample Explorer Bar"), MB_OK | MB_ICONINFORMATION);
  555.       break;
  556.  
  557.    default:
  558.       return E_INVALIDARG;
  559.    }
  560.  
  561. return NOERROR;
  562. }
  563.  
  564. /**************************************************************************
  565.  
  566.    CExplorerBar::GetCommandString()
  567.  
  568. **************************************************************************/
  569.  
  570. STDMETHODIMP CExplorerBar::GetCommandString( UINT idCommand,
  571.                                              UINT uFlags,
  572.                                              LPUINT lpReserved,
  573.                                              LPSTR lpszName,
  574.                                              UINT uMaxNameLen)
  575. {
  576. HRESULT  hr = E_INVALIDARG;
  577.  
  578. switch(uFlags)
  579.    {
  580.    case GCS_HELPTEXT:
  581.       switch(idCommand)
  582.          {
  583.          case IDM_COMMAND:
  584.             lstrcpy(lpszName, TEXT("Explorer Bar command help text"));
  585.             hr = NOERROR;
  586.             break;
  587.          }
  588.       break;
  589.    
  590.    case GCS_VERB:
  591.       switch(idCommand)
  592.          {
  593.          case IDM_COMMAND:
  594.             lstrcpy(lpszName, TEXT("command"));
  595.             hr = NOERROR;
  596.             break;
  597.          }
  598.       break;
  599.    
  600.    case GCS_VALIDATE:
  601.       hr = NOERROR;
  602.       break;
  603.    }
  604.  
  605. return hr;
  606. }
  607.  
  608. ///////////////////////////////////////////////////////////////////////////
  609. //
  610. // private method implementations
  611. //
  612.  
  613. /**************************************************************************
  614.  
  615.    CExplorerBar::WndProc()
  616.    
  617. **************************************************************************/
  618.  
  619. LRESULT CALLBACK CExplorerBar::WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
  620. {
  621. CExplorerBar  *pThis = (CExplorerBar*)GetWindowLong(hWnd, GWL_USERDATA);
  622.  
  623. switch (uMessage)
  624.    {
  625.    case WM_NCCREATE:
  626.       {
  627.       LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
  628.       pThis = (CExplorerBar*)(lpcs->lpCreateParams);
  629.       SetWindowLong(hWnd, GWL_USERDATA, (LONG)pThis);
  630.  
  631.       //set the window handle
  632.       pThis->m_hWnd = hWnd;
  633.       }
  634.       break;
  635.    
  636.    case WM_PAINT:
  637.       return pThis->OnPaint();
  638.    
  639.    case WM_COMMAND:
  640.       return pThis->OnCommand(wParam, lParam);
  641.    
  642.    case WM_SETFOCUS:
  643.       return pThis->OnSetFocus();
  644.  
  645.    case WM_KILLFOCUS:
  646.       return pThis->OnKillFocus();
  647.    }
  648.  
  649. return DefWindowProc(hWnd, uMessage, wParam, lParam);
  650. }
  651.  
  652. /**************************************************************************
  653.  
  654.    CExplorerBar::OnPaint()
  655.    
  656. **************************************************************************/
  657.  
  658. LRESULT CExplorerBar::OnPaint(void)
  659. {
  660. PAINTSTRUCT ps;
  661. RECT        rc;
  662.  
  663. BeginPaint(m_hWnd, &ps);
  664.  
  665. GetClientRect(m_hWnd, &rc);
  666. SetTextColor(ps.hdc, RGB(255, 255, 255));
  667. SetBkMode(ps.hdc, TRANSPARENT);
  668. DrawText(ps.hdc, TEXT("Sample Explorer Bar"), -1, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
  669.  
  670. EndPaint(m_hWnd, &ps);
  671.  
  672. return 0;
  673. }
  674.  
  675. /**************************************************************************
  676.  
  677.    CExplorerBar::OnCommand()
  678.    
  679. **************************************************************************/
  680.  
  681. LRESULT CExplorerBar::OnCommand(WPARAM wParam, LPARAM lParam)
  682. {
  683. return 0;
  684. }
  685.  
  686. /**************************************************************************
  687.  
  688.    CExplorerBar::FocusChange()
  689.    
  690. **************************************************************************/
  691.  
  692. void CExplorerBar::FocusChange(BOOL bFocus)
  693. {
  694. m_bFocus = bFocus;
  695.  
  696. //inform the input object site that the focus has changed
  697. if(m_pSite)
  698.    {
  699.    m_pSite->OnFocusChangeIS((IDockingWindow*)this, bFocus);
  700.    }
  701. }
  702.  
  703. /**************************************************************************
  704.  
  705.    CExplorerBar::OnSetFocus()
  706.    
  707. **************************************************************************/
  708.  
  709. LRESULT CExplorerBar::OnSetFocus(void)
  710. {
  711. FocusChange(TRUE);
  712.  
  713. return 0;
  714. }
  715.  
  716. /**************************************************************************
  717.  
  718.    CExplorerBar::OnKillFocus()
  719.    
  720. **************************************************************************/
  721.  
  722. LRESULT CExplorerBar::OnKillFocus(void)
  723. {
  724. FocusChange(FALSE);
  725.  
  726. return 0;
  727. }
  728.  
  729. /**************************************************************************
  730.  
  731.    CExplorerBar::RegisterAndCreateWindow()
  732.    
  733. **************************************************************************/
  734.  
  735. BOOL CExplorerBar::RegisterAndCreateWindow(void)
  736. {
  737. //If the window doesn't exist yet, create it now.
  738. if(!m_hWnd)
  739.    {
  740.    //Can't create a child window without a parent.
  741.    if(!m_hwndParent)
  742.       {
  743.       return FALSE;
  744.       }
  745.  
  746.    //If the window class has not been registered, then do so.
  747.    WNDCLASS wc;
  748.    if(!GetClassInfo(g_hInst, EB_CLASS_NAME, &wc))
  749.       {
  750.       ZeroMemory(&wc, sizeof(wc));
  751.       wc.style          = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
  752.       wc.lpfnWndProc    = (WNDPROC)WndProc;
  753.       wc.cbClsExtra     = 0;
  754.       wc.cbWndExtra     = 0;
  755.       wc.hInstance      = g_hInst;
  756.       wc.hIcon          = NULL;
  757.       wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
  758.       wc.hbrBackground  = (HBRUSH)CreateSolidBrush(RGB(0, 0, 192));
  759.       wc.lpszMenuName   = NULL;
  760.       wc.lpszClassName  = EB_CLASS_NAME;
  761.       
  762.       if(!RegisterClass(&wc))
  763.          {
  764.          //If RegisterClass fails, CreateWindow below will fail.
  765.          }
  766.       }
  767.  
  768.    RECT  rc;
  769.  
  770.    GetClientRect(m_hwndParent, &rc);
  771.  
  772.    //Create the window. The WndProc will set m_hWnd.
  773.    CreateWindowEx(   0,
  774.                      EB_CLASS_NAME,
  775.                      NULL,
  776.                      WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER,
  777.                      rc.left,
  778.                      rc.top,
  779.                      rc.right - rc.left,
  780.                      rc.bottom - rc.top,
  781.                      m_hwndParent,
  782.                      NULL,
  783.                      g_hInst,
  784.                      (LPVOID)this);
  785.       
  786.    }
  787.  
  788. return (NULL != m_hWnd);
  789. }
  790.  
  791.