// hodll.cpp : Defines the initialization routines for the DLL.
//#include "stdafx.h"
#include "hodll.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "mymenu.h"
#pragma data_seg(".SHARDAT")
static HHOOK hkb=NULL;
FILE *f1;
#pragma data_seg()HINSTANCE hins;
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
///////////////////////////////////////////////////////////////////////////////
// CHodllAppBEGIN_MESSAGE_MAP(CHodllApp, CWinApp)
//{{AFX_MSG_MAP(CHodllApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CHodllApp construction
LRESULT __declspec(dllexport)__stdcall CALLBACK KeyboardProc(
int nCode,
WPARAM wParam,
LPARAM lParam)
{
if(nCode == HC_ACTION && wParam == WM_RBUTTONDOWN)
{
MOUSEHOOKSTRUCT *mp = (MOUSEHOOKSTRUCT*)lParam;
CMenuXP *pMenu = new CMenuXP;
pMenu->CreatePopupMenu();
pMenu->SetBackColor(RGB(0xf2, 0xf2, 0xf2));
pMenu->SetSelectedBarColor(RGB(0x66, 0x99, 0xff));
pMenu->SetMenuStyle(CMenuXP::STYLE_XP);
pMenu->AppendMyMenu(我的自绘菜单用到的参数);
CWnd *pWin = new CWnd();
pWin->m_hWnd = mp->hwnd;
pMenu->TrackPopupMenu(TPM_LEFTBUTTON,mp->pt.x , mp->pt.y ,pWin);
}
LRESULT RetVal = CallNextHookEx( hkb, nCode, wParam, lParam ); return RetVal;}
BOOL __declspec(dllexport)__stdcall installhook()
{
f1=fopen("c:\\report.txt","w");
fclose(f1);
hkb=SetWindowsHookEx(WH_MOUSE,(HOOKPROC)KeyboardProc,hins,0);
return TRUE;
}
BOOL __declspec(dllexport) UnHook()
{
BOOL unhooked = UnhookWindowsHookEx(hkb);
// MessageBox(0,"exit","sasa",MB_OK);
return unhooked;
}
BOOL CHodllApp::InitInstance ()
{AFX_MANAGE_STATE(AfxGetStaticModuleState());
hins=AfxGetInstanceHandle();
return TRUE;}
BOOL CHodllApp::ExitInstance ()
{
return TRUE;
}CHodllApp::CHodllApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}/////////////////////////////////////////////////////////////////////////////
// The one and only CHodllApp objectCHodllApp theApp;
//#include "stdafx.h"
#include "hodll.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "mymenu.h"
#pragma data_seg(".SHARDAT")
static HHOOK hkb=NULL;
FILE *f1;
#pragma data_seg()HINSTANCE hins;
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
///////////////////////////////////////////////////////////////////////////////
// CHodllAppBEGIN_MESSAGE_MAP(CHodllApp, CWinApp)
//{{AFX_MSG_MAP(CHodllApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CHodllApp construction
LRESULT __declspec(dllexport)__stdcall CALLBACK KeyboardProc(
int nCode,
WPARAM wParam,
LPARAM lParam)
{
if(nCode == HC_ACTION && wParam == WM_RBUTTONDOWN)
{
MOUSEHOOKSTRUCT *mp = (MOUSEHOOKSTRUCT*)lParam;
CMenuXP *pMenu = new CMenuXP;
pMenu->CreatePopupMenu();
pMenu->SetBackColor(RGB(0xf2, 0xf2, 0xf2));
pMenu->SetSelectedBarColor(RGB(0x66, 0x99, 0xff));
pMenu->SetMenuStyle(CMenuXP::STYLE_XP);
pMenu->AppendMyMenu(我的自绘菜单用到的参数);
CWnd *pWin = new CWnd();
pWin->m_hWnd = mp->hwnd;
pMenu->TrackPopupMenu(TPM_LEFTBUTTON,mp->pt.x , mp->pt.y ,pWin);
}
LRESULT RetVal = CallNextHookEx( hkb, nCode, wParam, lParam ); return RetVal;}
BOOL __declspec(dllexport)__stdcall installhook()
{
f1=fopen("c:\\report.txt","w");
fclose(f1);
hkb=SetWindowsHookEx(WH_MOUSE,(HOOKPROC)KeyboardProc,hins,0);
return TRUE;
}
BOOL __declspec(dllexport) UnHook()
{
BOOL unhooked = UnhookWindowsHookEx(hkb);
// MessageBox(0,"exit","sasa",MB_OK);
return unhooked;
}
BOOL CHodllApp::InitInstance ()
{AFX_MANAGE_STATE(AfxGetStaticModuleState());
hins=AfxGetInstanceHandle();
return TRUE;}
BOOL CHodllApp::ExitInstance ()
{
return TRUE;
}CHodllApp::CHodllApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}/////////////////////////////////////////////////////////////////////////////
// The one and only CHodllApp objectCHodllApp theApp;
解决方案 »
- ado
- vs03 控件注册失败!
- 急急急急 vc6.0或vc.net 如何做com组件(上传组件) 在线等待 进者都有分 贡献出我所有分
- 视的最大化问题??
- 怎样去除单文档应用程序的滚动条,我用向导生成了一个FormView的程序,向导给我加入了滚动条,我根本不需要它,想把他去掉该怎么办?请大
- 在视图中需要绘制的数据量大,且需要计算,象这样的情况如何提高重绘速度?多线程可行吗?
- help about ras
- 回调是什么意思?回调是否就是指系统调用?
- DLL路径改变后就无法重新调用了
- 如何将一个树形控件的子接点全部删除,还有如何得到第一个子接点的句柄
- 请问如何得到远程主机的IP地址
- c++实现远程控制功能,能得到客户端的一些信息
pWin->m_hWnd = mp->hwnd;
该为:
CWnd *pWin=FromHandle(mp->hwnd)