예제 #1
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
    switch (dwReason)
    {
        case DLL_PROCESS_ATTACH:
            g_instance = hInstance;
            // Extension DLL one-time initialization.
            if (!AfxInitExtensionModule(extensionDLL, hInstance))
                return 0;
            WNEW CDynLinkLibrary(extensionDLL);
            break;

        case DLL_PROCESS_DETACH:
            // Extension DLL per-process termination
            AfxTermExtensionModule(extensionDLL);
            break;

        case DLL_THREAD_ATTACH:
            break;

        case DLL_THREAD_DETACH:
            break;
    }

    return 1;
}
예제 #2
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE0("VALVELIB.AWX Initializing!\n");
		
		// Extension DLL one-time initialization
		AfxInitExtensionModule(ValvelibDLL, hInstance);

		// Insert this DLL into the resource chain
		new CDynLinkLibrary(ValvelibDLL);

		// Register this custom AppWizard with MFCAPWZ.DLL
		SetCustomAppWizClass(&Valvelibaw);
	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("VALVELIB.AWX Terminating!\n");

		// Terminate the library before destructors are called
		AfxTermExtensionModule(ValvelibDLL);
	}
	return 1;   // ok
}
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	// Remove this if you use lpReserved
	UNREFERENCED_PARAMETER(lpReserved);

	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE0("StateMachineEditor.DLL Initializing!\n");
		
		// Extension DLL one-time initialization
		if (!AfxInitExtensionModule(StateMachineEditorDLL, hInstance))
			return 0;

		// Insert this DLL into the resource chain
		// NOTE: If this Extension DLL is being implicitly linked to by
		//  an MFC Regular DLL (such as an ActiveX Control)
		//  instead of an MFC application, then you will want to
		//  remove this line from DllMain and put it in a separate
		//  function exported from this Extension DLL.  The Regular DLL
		//  that uses this Extension DLL should then explicitly call that
		//  function to initialize this Extension DLL.  Otherwise,
		//  the CDynLinkLibrary object will not be attached to the
		//  Regular DLL's resource chain, and serious problems will
		//  result.

		new CDynLinkLibrary(StateMachineEditorDLL);
	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("StateMachineEditor.DLL Terminating!\n");
		// Terminate the library before destructors are called
		AfxTermExtensionModule(StateMachineEditorDLL);
	}
	return 1;   // ok
}
예제 #4
0
//DLL 导出主函数
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	UNREFERENCED_PARAMETER(lpReserved);
	if (dwReason==DLL_PROCESS_ATTACH)
	{
		if (!AfxInitExtensionModule(KernelEngineDLL,hInstance)) return 0;
		new CDynLinkLibrary(KernelEngineDLL);

		//初始化 COM
		CoInitialize(NULL);

		//初始化 SOCKET
		WSADATA WSAData;
		WORD wVersionRequested=MAKEWORD(2,2);
		int iErrorCode=WSAStartup(wVersionRequested,&WSAData);
		if (iErrorCode!=0) return 0;
	}
	else if (dwReason==DLL_PROCESS_DETACH)
	{
		CoUninitialize();
		AfxTermExtensionModule(KernelEngineDLL);
	}

	return 1;
}
예제 #5
0
파일: FlwLib.CPP 프로젝트: abcweizhuo/Test3
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE1("FLWLIB.DLL Initializing %08x!\n", hInstance);
		
		// Extension DLL one-time initialization
		if (!AfxInitExtensionModule(FlwLibDLL, hInstance))
      return 0;

		// Insert this DLL into the resource chain
		new CDynLinkLibrary(FlwLibDLL);

		if (!MakeVersionOK("FLWLIB.DLL", _MAKENAME, SCD_VERINFO_V0, SCD_VERINFO_V1, SCD_VERINFO_V2, SCD_VERINFO_V3))
      return 0;

#if WithOEP
    SetOEPOptions(False); // OEP should load after this and reset if neccessary
#endif
#if WithQAL
    SetQALOptions(False); // QAL should load after this and reset if neccessary
#endif
#if WithMG
    SetMGOptions(False); // MG should load after this and reset if neccessary
#endif

	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("FLWLIB.DLL Terminating!\n");
		AfxTermExtensionModule(FlwLibDLL);
	}
	return 1;   // ok
}
예제 #6
0
파일: v7ui.cpp 프로젝트: ste6an/v7ui
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	UNREFERENCED_PARAMETER(lpReserved);

	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE0("V7UI.DLL Initializing!\n");
		
		if (!AfxInitExtensionModule(V7uiDLL, hInstance))
			return 0;

		context_obj::CContextBase::InitAllContextClasses();
		Init1CGlobal(hInstance);
// 		INITCOMMONCONTROLSEX InitCtrlEx;
// 		InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
// 		InitCtrlEx.dwICC  = ICC_PROGRESS_CLASS|ICC_LISTVIEW_CLASSES|ICC_BAR_CLASSES|
// 			ICC_COOL_CLASSES|ICC_TAB_CLASSES;
// 		InitCommonControlsEx(&InitCtrlEx);

		new CDynLinkLibrary(V7uiDLL);
	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("V7UI.DLL Terminating!\n");
		context_obj::CContextBase::DoneAllContextClasses();
		AfxTermExtensionModule(V7uiDLL);
	}
	return 1;
}
예제 #7
0
//
// for MFC initialization
//
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	switch(dwReason)
	{
	case DLL_PROCESS_ATTACH:
		_hdllInstance = hInstance;
		if(!AfxInitExtensionModule(DesignCtrSampleDll, hInstance))
			return 0;
		new CDynLinkLibrary(DesignCtrSampleDll);

		_Module.Init(ObjectMap, hInstance);
		//
		registerAppInfo(hInstance);
		DllRegisterServer();
		break;
	
	case DLL_PROCESS_DETACH:
		AfxTermExtensionModule(DesignCtrSampleDll);
		_Module.Term();
		break;
	}

	return 1;
}
예제 #8
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE1("AlcoaSpMdl.DLL Initializing %08x!\n", hInstance);

		// Extension DLL one-time initialization
		if (!AfxInitExtensionModule(AlcoaSpMdlDLL, hInstance))
      return 0;

		// Insert this DLL into the resource chain
		new CDynLinkLibrary(AlcoaSpMdlDLL);

		if (!MakeVersionOK("AlcoaSpMdl.DLL", _MAKENAME, SCD_VERINFO_V0, SCD_VERINFO_V1, SCD_VERINFO_V2, SCD_VERINFO_V3))
      return 0;

  //  ForceLoadModelLibrary();

	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("AlcoaSpMdl.DLL Terminating!\n");
		AfxTermExtensionModule(AlcoaSpMdlDLL);
	}
	return 1;   // ok
}
예제 #9
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
    // Remove this if you use lpReserved
    UNREFERENCED_PARAMETER(lpReserved);

    if (dwReason == DLL_PROCESS_ATTACH)
    {
        TRACE0("NodeSimEx.DLL Initializing!\n");

        // Extension DLL one-time initialization
        if (!AfxInitExtensionModule(NodeSimExDLL, hInstance))
        {
            return 0;
        }

        // Insert this DLL into the resource chain
        // NOTE: If this Extension DLL is being implicitly linked to by
        //  an MFC Regular DLL (such as an ActiveX Control)
        //  instead of an MFC application, then you will want to
        //  remove this line from DllMain and put it in a separate
        //  function exported from this Extension DLL.  The Regular DLL
        //  that uses this Extension DLL should then explicitly call that
        //  function to initialize this Extension DLL.  Otherwise,
        //  the CDynLinkLibrary object will not be attached to the
        //  Regular DLL's resource chain, and serious problems will
        //  result.
        sg_pomDynLinkLib = new CDynLinkLibrary(NodeSimExDLL);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
    {
        if (sg_pouNS_CAN != NULL)
        {
            sg_pouNS_CAN->ExitInstance();
            delete sg_pouNS_CAN;
            sg_pouNS_CAN = NULL;
        }

        if (sg_pouNS_J1939 != NULL)
        {
            sg_pouNS_J1939->ExitInstance();
            delete sg_pouNS_J1939;
            sg_pouNS_J1939 = NULL;
        }

        if (NULL != sg_pomDynLinkLib)
        {
            delete sg_pomDynLinkLib;
            sg_pomDynLinkLib = NULL;
        }

        // Terminate the library before destructors are called
        AfxTermExtensionModule(NodeSimExDLL);
    }

    //CGlobalObj::m_pEditorDocTemplate = NULL;
    return 1;   // ok
}
예제 #10
0
//------------------------------------------------------------------------------
// 
//------------------------------------------------------------------------------
extern "C" int APIENTRY DllMain ( HINSTANCE hInstance, DWORD dwReason, LPVOID )
{
     if   ( dwReason == DLL_PROCESS_ATTACH )
     {
          g_hInstanceCommon = hInstance;

          if   ( !AfxInitExtensionModule ( COMMONDLL, hInstance ) )
          {
               return 0;
          }
          new CDynLinkLibrary ( COMMONDLL );

		  if ( g_hCommonLocRes && AfxInitExtensionModule(COMMONDLLRes, g_hCommonLocRes) )
			  new CDynLinkLibrary(COMMONDLLRes);
		  
		  
		  g_hLockBitmap = (HBITMAP)::LoadImage(hInstance, 
			  MAKEINTRESOURCE(IDB_COMMON_LOCK_BITMAP), IMAGE_BITMAP, 0, 0, LR_SHARED);
		  
		  g_hLockBitmapMask = (HBITMAP)::LoadImage(hInstance, 
			  MAKEINTRESOURCE(IDB_COMMON_LOCK_BITMAP_MASK), IMAGE_BITMAP, 0, 0, LR_SHARED);
		  
		  BITMAP bm = {0}; 
		  ::GetObject(g_hLockBitmap, sizeof(BITMAP), &bm);

		  g_LockBitmapSize.cx = bm.bmWidth;
		  g_LockBitmapSize.cy = bm.bmHeight;

		  
     }
     else if ( dwReason == DLL_PROCESS_DETACH )
     {
          AfxTermExtensionModule ( COMMONDLL );
		  AfxTermExtensionModule ( COMMONDLLRes );

		  if (g_hCommonLocRes)
		  {
			  FreeLibrary(g_hCommonLocRes);
			  g_hCommonLocRes = NULL;
		  }
		  
     }
     return 1;
}
예제 #11
0
파일: ZdCtl.cpp 프로젝트: DeegC/ZeidonTools
extern "C" int APIENTRY
DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
{
   // Remove this if you use lpReserved
   UNREFERENCED_PARAMETER( lpReserved );

   if ( dwReason == DLL_PROCESS_ATTACH )
   {
   // TRACE0( "ZDCTL.DLL Initializing!\n" );
      g_hInstanceDLL = hInstance;

      // Extension DLL one-time initialization - do not allocate memory here,
      // use the TRACE or ASSERT macros or call MessageBox
      if ( AfxInitExtensionModule( extensionDLL, hInstance ) == 0 )
         return( 0 );

      // Other initialization could be done here, as long as
      // it doesn't result in direct or indirect calls to AfxGetApp.
      // This extension DLL doesn't need to access the app object
      // but to be consistent with ZDrApp.dll, this DLL requires
      // explicit initialization as well (see below).

      // This allows for greater flexibility later in development.

      ///////////////////////////////////////////////////////////////////////
      //
      // We are calling this DLL from regular DLL's, so we have moved
      // the call to CDynLinkLibrary .
      //
      // Insert this DLL into the resource chain
      // NOTE: If this Extension DLL is being implicitly linked to by
      // an MFC Regular DLL (such as an ActiveX Control) instead of an
      // MFC application, then you will want to remove this line from
      // DllMain and put it in a separate function exported from this
      // Extension DLL.  The Regular DLL that uses this Extension DLL
      // should then explicitly call that function to initialize this
      // Extension DLL.  Otherwise, the CDynLinkLibrary object will not
      // be attached to the Regular DLL's resource chain, and serious
      // problems will result.
      //
      ///////////////////////////////////////////////////////////////////////

      // new CDynLinkLibrary( extensionDLL );
   }
   else
   if ( dwReason == DLL_PROCESS_DETACH )
   {
   // TRACE0( "ZDCTL.DLL Terminating!\n" );
      AfxTermExtensionModule( extensionDLL );
   }

   return( 1 );   // ok
}
예제 #12
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	// lpReserved를 사용하는 경우 다음을 제거하십시오.
	UNREFERENCED_PARAMETER(lpReserved);

	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE0("IOCPNetwork.DLL을 초기화하고 있습니다.\n");
		
		// 확장 DLL을 한 번만 초기화합니다.
		if (!AfxInitExtensionModule(IOCPNetworkDLL, hInstance))
			return 0;

		// 이 DLL을 리소스 체인에 삽입합니다.
		// 참고: 이 확장 DLL이 MFC 응용 프로그램이
		//  아닌 ActiveX 컨트롤과 같은 MFC 기본 DLL에
		//  의해 명시적으로 링크되어 있는 경우에는
		//  DllMain에서 이 줄을 제거하고, 제거한 줄은 이 확장 DLL에서
		//  내보낸 별도의 함수에 추가합니다.
		//  그런 다음 이 확장 DLL을 사용하는 기본 DLL은
		//  해당 함수를 명시적으로 호출하여 이 확장 DLL을 추가해야 합니다.
		//  그렇지 않으면 CDynLinkLibrary 개체가
		//  기본 DLL의 리소스 체인에 추가되지 않으므로
		//  심각한 문제가 발생합니다.

		new CDynLinkLibrary(IOCPNetworkDLL);

		// 소켓 초기화입니다.
		// 참고: 이 확장 DLL이 MFC 응용 프로그램이
		//  아닌 ActiveX 컨트롤과 같은 MFC 기본 DLL에
		//  의해 명시적으로 링크되어 있는 경우에는
		//  DllMain에서 다음 줄을 제거하고, 제거한 줄은 이 확장 DLL에서
		//  내보낸 별도의 함수에 추가합니다.
		//  그런 다음 이 확장 DLL을 사용하는 기본 DLL은
		//  해당 함수를 명시적으로 호출하여 이 확장 DLL을 초기화해야 합니다.
		if (!AfxSocketInit())
		{
			return FALSE;
		}
	
	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("IOCPNetwork.DLL을 종료하고 있습니다.\n");

		// 소멸자가 호출되기 전에 라이브러리를 종료합니다.
		AfxTermExtensionModule(IOCPNetworkDLL);
	}
	return 1;   // 확인
}
예제 #13
0
/**
 * DLL 入口函数
 */
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	UNREFERENCED_PARAMETER(lpReserved);
	if (dwReason == DLL_PROCESS_ATTACH)
	{
		if (!AfxInitExtensionModule(GameClientDLL, hInstance)) return 0;
		new CDynLinkLibrary(GameClientDLL);
	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		AfxTermExtensionModule(GameClientDLL);
	}
	return 1;
}
예제 #14
0
//导出函数
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason==DLL_PROCESS_ATTACH)
	{
		if (!AfxInitExtensionModule(ServiceCoreDLL, hInstance)) return 0;
		new CDynLinkLibrary(ServiceCoreDLL);
	}
	else if (dwReason==DLL_PROCESS_DETACH)
	{
		AfxTermExtensionModule(ServiceCoreDLL);
	}

	return 1;
}
BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) {
	//- Remove this if you use lpReserved
	UNREFERENCED_PARAMETER(lpReserved) ;

	if ( dwReason == DLL_PROCESS_ATTACH ) {
        _hdllInstance =hInstance ;
		// Extension DLL one-time initialization
		if ( !AfxInitExtensionModule (ArxTestEntitlementDLL, hInstance) )
			return (FALSE);
	} else if ( dwReason == DLL_PROCESS_DETACH ) {
		// Terminate the library before destructors are called
		AfxTermExtensionModule (ArxTestEntitlementDLL) ;
	}
	return (TRUE) ;
}
예제 #16
0
BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
/***************************************************************************/
{
    UNUSED_ALWAYS( lpReserved );
    if( dwReason == DLL_PROCESS_ATTACH ) {
        // Add the AFX library to the list of modules searched for resources.
        AfxInitExtensionModule( _AFXModule, hInstance );
        new CDynLinkLibrary( _AFXModule, TRUE );
    } else {
        // Delete the CDynLinkLibrary object for the AFX library, as well as any
        // others that are left.
        AfxTermExtensionModule( _AFXModule, TRUE );
    }
    return( TRUE );
}
예제 #17
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	// Remove this if you use lpReserved
	UNREFERENCED_PARAMETER(lpReserved);

	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE0("SigGrphWnd.DLL Initializing!\n");
		
		// Extension DLL one-time initialization
        if (!AfxInitExtensionModule(SigGrphWndDLL, hInstance))
        {
            return 0;
        }

		// Insert this DLL into the resource chain
		// NOTE: If this Extension DLL is being implicitly linked to by
		//  an MFC Regular DLL (such as an ActiveX Control)
		//  instead of an MFC application, then you will want to
		//  remove this line from DllMain and put it in a separate
		//  function exported from this Extension DLL.  The Regular DLL
		//  that uses this Extension DLL should then explicitly call that
		//  function to initialize this Extension DLL.  Otherwise,
		//  the CDynLinkLibrary object will not be attached to the
		//  Regular DLL's resource chain, and serious problems will
		//  result.

		new CDynLinkLibrary(SigGrphWndDLL);

		for(int nBUSID = 0; nBUSID<AVAILABLE_PROTOCOLS;nBUSID++)
		{
			m_sGraphWndPlacement[nBUSID].length = 0;
			m_sGraphWndPlacement[nBUSID].rcNormalPosition.top = -1;
			m_sGraphSplitterPos[nBUSID].m_nRootSplitterData[0][0] = -1;
		}
	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("SigGrphWnd.DLL Terminating!\n");

		// Terminate the library before destructors are called
		AfxTermExtensionModule(SigGrphWndDLL);
	}
	return 1;   // ok
}
예제 #18
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	// Remove this if you use lpReserved
	UNREFERENCED_PARAMETER(lpReserved);
	
	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE0("AGmagicVP.DLL Initializing!\n");
		
		// Extension DLL one-time initialization
		if (!AfxInitExtensionModule(AGmagicVPDLL, hInstance))
			return 0;
		
		// Insert this DLL into the resource chain
		// NOTE: If this Extension DLL is being implicitly linked to by
		//  an MFC Regular DLL (such as an ActiveX Control)
		//  instead of an MFC application, then you will want to
		//  remove this line from DllMain and put it in a separate
		//  function exported from this Extension DLL.  The Regular DLL
		//  that uses this Extension DLL should then explicitly call that
		//  function to initialize this Extension DLL.  Otherwise,
		//  the CDynLinkLibrary object will not be attached to the
		//  Regular DLL's resource chain, and serious problems will
		//  result.

		new CDynLinkLibrary(AGmagicVPDLL);
		//CAGmagicVPDllSerialDlg	dllSerialDlg;
		//if(dllSerialDlg.DoModal()!=IDOK)
		//{
		//	AfxTermExtensionModule(AGmagicVPDLL);
		//	return 0;
		//}
	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("AGmagicVP.DLL Terminating!\n");
		// Terminate the library before destructors are called
		AfxTermExtensionModule(AGmagicVPDLL);

		//if(_tcslen(AGMAGICVP_LIBRARY_SERIAL_KEY)>0)
		//	AfxMessageBox(_T("Thank for use AGmagicVP DLL"),MB_OK | MB_ICONINFORMATION,0);
	}
	return 1;   // ok
}
예제 #19
0
//DLL 主函数
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	UNREFERENCED_PARAMETER(lpReserved);
	if (dwReason==DLL_PROCESS_ATTACH)
	{
		if (!AfxInitExtensionModule(SkinControlsDLL, hInstance)) return 0;
		new CDynLinkLibrary(SkinControlsDLL);
		//GdiplusStartupInput StartupInput;
		//GdiplusStartup(&g_lGdiPlusToken,&StartupInput,NULL);

	}
	else if (dwReason==DLL_PROCESS_DETACH)
	{
		//GdiplusShutdown(g_lGdiPlusToken);
		AfxTermExtensionModule(SkinControlsDLL);
	}
	return 1;
}
예제 #20
0
//导出函数
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason==DLL_PROCESS_ATTACH)
	{
		if (!AfxInitExtensionModule(WHImageDLL, hInstance)) return 0;
		new CDynLinkLibrary(WHImageDLL);

		GdiplusStartupInput StartupInput;
		GdiplusStartup(&g_lGdiPlusToken,&StartupInput,NULL);
	}
	else if (dwReason==DLL_PROCESS_DETACH)
	{
		GdiplusShutdown(g_lGdiPlusToken);
		AfxTermExtensionModule(WHImageDLL);
	}

	return 1;
}
예제 #21
0
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	// 如果使用 lpReserved,请将此移除
	UNREFERENCED_PARAMETER(lpReserved);

	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE0("ServerControl.DLL 正在初始化!\n");
		if (!AfxInitExtensionModule(ServerControlDLL, hInstance)) return 0;
		new CDynLinkLibrary(ServerControlDLL);

	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("ServerControl.DLL 正在终止!\n");
		AfxTermExtensionModule(ServerControlDLL);
	}
	return 1;   // 确定
}
예제 #22
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE0("bsclib.DLL Initializing!\n");
		
		// Extension DLL one-time initialization
		AfxInitExtensionModule(bsclibDLL, hInstance);

		// Insert this DLL into the resource chain
		new CDynLinkLibrary(bsclibDLL);
	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("bsclib.DLL Terminating!\n");
	}
	return 1;   // ok
}
예제 #23
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	// 如果使用 lpReserved,请将此移除
	UNREFERENCED_PARAMETER(lpReserved);

	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE0("CommonLibrary.DLL 正在初始化!\n");
		
		// 扩展 DLL 一次性初始化
		if (!AfxInitExtensionModule(CommonLibraryDLL, hInstance))
			return 0;

		// 将此 DLL 插入到资源链中
		// 注意: 如果此扩展 DLL 由
		//  MFC 规则 DLL (如 ActiveX 控件)隐式链接到,
		//  而不是由 MFC 应用程序链接到,则需要
		//  将此行从 DllMain 中移除并将其放置在一个
		//  从此扩展 DLL 导出的单独的函数中。使用此扩展 DLL 的
		//  规则 DLL 然后应显式
		//  调用该函数以初始化此扩展 DLL。否则,
		//  CDynLinkLibrary 对象不会附加到
		//  规则 DLL 的资源链,并将导致严重的
		//  问题。

		new CDynLinkLibrary(CommonLibraryDLL);

	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("CommonLibrary.DLL 正在终止!\n");

		if( common::utility::last_error_key != TLS_OUT_OF_INDEXES)
			TlsFree( common::utility::last_error_key);

		// 在调用析构函数之前终止该库
		AfxTermExtensionModule(CommonLibraryDLL);
	}

	return 1;   // 确定
}
예제 #24
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
 UNREFERENCED_PARAMETER(lpReserved);

 if (dwReason == DLL_PROCESS_ATTACH)
 {
  TRACE0("PROPGRID.DLL Initializing!\n");
  if (!AfxInitExtensionModule(PropGridDLL, hInstance))
   return 0;

  new CDynLinkLibrary(PropGridDLL);
 }
 else if (dwReason == DLL_PROCESS_DETACH)
 {
  TRACE0("PROPGRID.DLL Terminating!\n");
  AfxTermExtensionModule(PropGridDLL);
 }
 return 1;
}
예제 #25
0
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        TRACE0("PROPTREE.DLL Initializing!\n");

        if (!AfxInitExtensionModule(PropTreeDLL, hInstance))
            return 0;

        new CDynLinkLibrary(PropTreeDLL);

        ghInst = hInstance;
    }
    else if (dwReason == DLL_PROCESS_DETACH)
    {
        TRACE0("PROPTREE.DLL Terminating!\n");
        AfxTermExtensionModule(PropTreeDLL);
    }

    return 1;
}
예제 #26
0
파일: dlldb.cpp 프로젝트: Rupan/winscp
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
	if (dwReason == DLL_PROCESS_ATTACH)
	{
		// shared initialization
		VERIFY(AfxInitExtensionModule(extensionDLL, hInstance));

		// wire up this DLL into the resource chain
		CDynLinkLibrary* pDLL = new CDynLinkLibrary(extensionDLL, TRUE);
		ASSERT(pDLL != NULL);
	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		AfxTermExtensionModule(extensionDLL);
	}
	else if (dwReason == DLL_THREAD_DETACH)
	{
		AfxTermThread(hInstance);
	}
	return TRUE;    // ok
}
예제 #27
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	// Remove this if you use lpReserved
	UNREFERENCED_PARAMETER(lpReserved);

	if (dwReason == DLL_PROCESS_ATTACH)
	{
		_hdllInstance = hInstance;
		// Extension DLL one-time initialization
		if (!AfxInitExtensionModule(ExtendTabsDLL, hInstance))
			return 0;

		new CDynLinkLibrary(ExtendTabsDLL);
	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		// Terminate the library before destructors are called
		AfxTermExtensionModule(ExtendTabsDLL);
	}
	return 1;   // ok
}
예제 #28
0
extern "C" BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, void* /*pvReserved*/)
{
	switch (fdwReason)
	{
	case DLL_PROCESS_ATTACH:
		TRACE0("English_USA.1252.DLL Initializing!\n");
		// perform one-time initialization
		VERIFY(AfxInitExtensionModule(g_afxModule, hInst));
		// insert this DLL into the resource chain
		new CDynLinkLibrary(g_afxModule);
		// successfully attached
		return (TRUE);
	case DLL_PROCESS_DETACH:
		TRACE0("English_USA.1252.DLL Terminating!\n");
		// perform per-process termination
		AfxTermExtensionModule(g_afxModule);
		// successfully detached
		return (TRUE);
	default:
		return (TRUE);
	}
}
예제 #29
0
int
APIENTRY
DllMain (/*[in]*/ HINSTANCE	hInstance,
	 /*[in]*/ DWORD		reason,
	 /*[in]*/ LPVOID	pReserved)
{
  UNREFERENCED_PARAMETER(pReserved);
  
  if (reason == DLL_PROCESS_ATTACH)
    {
      if (! AfxInitExtensionModule(MikuiDLL, hInstance))
	{
	  return (0);
	}
      new CDynLinkLibrary (MikuiDLL);
    }
  else if (reason == DLL_PROCESS_DETACH)
    {
      AfxTermExtensionModule (MikuiDLL);
    }
  return (1);
}
예제 #30
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	// Quitar lo siguiente si se utiliza lpReserved
	UNREFERENCED_PARAMETER(lpReserved);

	if (dwReason == DLL_PROCESS_ATTACH)
	{
		TRACE0("Inicializando Referencias.DLL\n");
		
		// Inicialización única del archivo DLL de extensión
		if (!AfxInitExtensionModule(ReferenciasDLL, hInstance))
			return 0;

		// Insertar este archivo DLL en la cadena de recursos
		// NOTA: si un archivo DLL estándar de MFC, como un control ActiveX,
		//  vincula de forma implícita el archivo DLL de extensión,
		//  en vez de una aplicación MFC,
		//  quite esta línea de DllMain y colóquela en
		//  otra función que se haya exportado del archivo DLL de extensión. El archivo DLL estándar
		//  que utiliza el archivo DLL de extensión llama de forma explícita
		//  a esa función para inicializar el archivo DLL de extensión. De lo contrario,
		//  el objeto CDynLinkLibrary no se adjunta a la cadena de recursos
		//  del archivo DLL estándar y se pueden producir
		//  problemas graves.

		new CDynLinkLibrary(ReferenciasDLL);

	}
	else if (dwReason == DLL_PROCESS_DETACH)
	{
		TRACE0("Finalizando Referencias.DLL\n");

		// Finalizar la biblioteca antes de llamar a los destructores
		AfxTermExtensionModule(ReferenciasDLL);
	}
	return 1;   // aceptar
}