|
// MacRcrd.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include <commctrl.h> // InitCommonControlEx
#include "MacRcrdImport.h"
#define MAX_HOOKS 3
struct _HookStruct
{
HHOOK hHook;
DWORD dwOptions;
HWND hWnd;
LONG lInstance;
PFNCALLBACK fnCallback;
};
#pragma data_seg(".SHARED")
UINT g_nProcessAttachs = 0; // # of DLL process attachments
_HookStruct g_HooksData[MAX_HOOKS] = { 0 };
#pragma data_seg()
#pragma comment(linker, "/SECTION:.SHARED,RWS")
///////////////////////////////////////////////////////////////////////////////
// L O C A L S
BOOL APIENTRY LibInitDLL();
BOOL APIENTRY LibExitDLL();
BOOL APIENTRY LibProcessInit(HINSTANCE hInstance);
BOOL APIENTRY LibProcessExit(HINSTANCE hInstance);
///////////////////////////////////////////////////////////////////////////////
// {D6328A57-811A-4f67-9064-4181FE22135B}
static const GUID LIBID_MACRCRDLib =
{ 0xd6328a57, 0x811a, 0x4f67, { 0x90, 0x64, 0x41, 0x81, 0xfe, 0x22, 0x13, 0x5b } };
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP()
///////////////////////////////////////////////////////////////////////////////
// Main Entry point for that DLL
BOOL APIENTRY DllMain(
HINSTANCE hInstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved // reserved
)
{
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
{
DisableThreadLibraryCalls( hInstDLL );
/* Initialize shared things */
if ( 0 == g_nProcessAttachs )
LibInitDLL();
g_nProcessAttachs++;
LibProcessInit( hInstDLL );
}
break;
case DLL_PROCESS_DETACH:
{
LibProcessExit( hInstDLL );
g_nProcessAttachs--;
if ( 0 == g_nProcessAttachs )
LibExitDLL();
}
break;
default:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// LibInitDLL
BOOL APIENTRY LibInitDLL()
{
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// LibExitDLL
BOOL APIENTRY LibExitDLL()
{
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// LibProcessInit
BOOL APIENTRY LibProcessInit(HINSTANCE hInstance)
{
_Module.Init(ObjectMap, hInstance, &LIBID_MACRCRDLib);
// InitCommonControls() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX commex = { 0 };
commex.dwSize = sizeof(commex);
commex.dwICC = ICC_WIN95_CLASSES|ICC_UPDOWN_CLASS;
InitCommonControlsEx(&commex);
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// LibProcessExit
BOOL APIENTRY LibProcessExit(HINSTANCE hInstance)
{
_Module.Term();
return TRUE;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Ernest is a multi-discipline software engineer.
Skilled at software design and development for all Windows platforms.
-
MCSD (C#, .NET)
Interests: User Interface, GDI/GDI+, Scripting, Android, iOS, Windows Mobile.
Programming Skills: C/C++, C#, Java (Android), VB and ASP.NET.
I hope you will enjoy my contributions.