home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / ADSDK.ZIP / Samples / General / ADQI / ADQI.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-08  |  2.5 KB  |  105 lines

  1. //----------------------------------------------------------------------------
  2. //
  3. //  Microsoft Active Directory 2.5 Sample Code
  4. //
  5. //  Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. //  File:       ADQI.cxx
  8. //
  9. //  Contents:   ADQI Main 
  10. //
  11. //
  12. //----------------------------------------------------------------------------
  13.  
  14.  
  15.  
  16. // ADQI.cpp : Defines the class behaviors for the application.
  17. //
  18.  
  19. #include "stdafx.h"
  20. #include "ADQI.h"
  21. #include "ADQIDlg.h"
  22.  
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CADQIApp
  31.  
  32. BEGIN_MESSAGE_MAP(CADQIApp, CWinApp)
  33.     //{{AFX_MSG_MAP(CADQIApp)
  34.         // NOTE - the ClassWizard will add and remove mapping macros here.
  35.         //    DO NOT EDIT what you see in these blocks of generated code!
  36.     //}}AFX_MSG
  37.     ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  38. END_MESSAGE_MAP()
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CADQIApp construction
  42.  
  43. CADQIApp::CADQIApp()
  44. {
  45.     m_dwFlag = 0;
  46.     m_sUserName.Empty();
  47. }
  48.  
  49.  
  50. HRESULT CADQIApp::ADsOpenObject( LPWSTR pszPath, REFIID riid, void**pUnk )
  51. {
  52.  
  53.     if ( m_sUserName.Length() )
  54.     {
  55.         return ::ADsOpenObject( pszPath, m_sUserName, NULL, m_dwFlag, riid, pUnk );
  56.     }
  57.     else
  58.     {
  59.         return ADsGetObject( pszPath, riid, pUnk );
  60.     }
  61. }
  62.  
  63. void CADQIApp::SetCredentials( LPCTSTR pszUserName, DWORD dwFlag )
  64. {
  65.     m_sUserName = pszUserName;
  66.     m_dwFlag    = dwFlag;
  67.  
  68. }
  69. /////////////////////////////////////////////////////////////////////////////
  70. // The one and only CADQIApp object
  71.  
  72. CADQIApp theApp;
  73.  
  74. /////////////////////////////////////////////////////////////////////////////
  75. // CADQIApp initialization
  76.  
  77. BOOL CADQIApp::InitInstance()
  78. {
  79.     // Standard initialization
  80.     // If you are not using these features and wish to reduce the size
  81.     //  of your final executable, you should remove from the following
  82.     //  the specific initialization routines you do not need.
  83.  
  84. #ifdef _AFXDLL
  85.     Enable3dControls();            // Call this when using MFC in a shared DLL
  86. #else
  87.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  88. #endif
  89.  
  90.     CADQIDlg dlg;
  91.     AfxOleInit();
  92.     m_pMainWnd = &dlg;
  93.     int nResponse = dlg.DoModal();
  94.     if (nResponse == IDOK)
  95.     {
  96.     }
  97.     else if (nResponse == IDCANCEL)
  98.     {
  99.     }
  100.  
  101.     // Since the dialog has been closed, return FALSE so that we exit the
  102.     //  application, rather than start the application's message pump.
  103.     return FALSE;
  104. }
  105.