winmain.c
资源名称:pmqc.zip [点击查看]
上传用户:yinuo83
上传日期:2007-01-08
资源大小:36k
文件大小:1k
源码类别:
钩子与API截获
开发平台:
C/C++
- #include <windows.h>
- #include "resource.h"
- BOOL InstallMouseHook();
- BOOL UninstallMouseHook();
- BOOL CALLBACK DialogProc(HWND hDlg, UINT message,WPARAM wParam, LPARAM lParam);
- char *text,*text2;
- int WINAPI WinMain(HANDLE hInstance,HANDLE hPrevInstance,LPSTR lpszCmdLine,int nCmdShow)
- {
- DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),NULL,DialogProc);
- return 0;
- }
- BOOL CALLBACK DialogProc(HWND hDlg, UINT message,WPARAM wParam, LPARAM lParam)
- {
- HDC hdc;
- PAINTSTRUCT paintst;
- HANDLE hmapfile;
- switch ( message )
- {
- case WM_INITDIALOG:
- SetWindowText(hDlg,"myciba");
- hmapfile=CreateFileMapping(NULL,
- NULL,
- PAGE_READWRITE,
- 0,
- 128,
- "textbuf"
- );
- text=(char *)MapViewOfFile( hmapfile,
- FILE_MAP_ALL_ACCESS,
- 0,
- 0,
- 128
- );
- SetWindowPos( hDlg,HWND_TOPMOST,0,0,200,200,SWP_SHOWWINDOW);
- InstallMouseHook();
- break;
- case WM_PAINT:
- hdc=BeginPaint(hDlg,&paintst);
- //ZhouTextOutA(hdc,10,50,"abcde",5);
- EndPaint(hDlg,&paintst);
- break;
- case 65000:
- SetWindowText(GetDlgItem(hDlg,1000),text);
- //PostMessage(GetDlgItem(hDlg,IDC_LIST1),LB_ADDSTRING,0,text);
- break;
- case WM_COMMAND:
- //UninstallMouseHook();
- exit(0);
- break;
- case WM_CLOSE:
- //UninstallMouseHook();
- break;
- default:
- break;
- }
- return FALSE;
- }