为了说明这个过程,我们必须写一个示例程序,如下:

#include "stdafx.h"#include<tchar.h>#include<stdio.h>#include<Windows.h>

#pragma comment(lib, "user32")WNDPROC oldproc=NULL;

LRESULT CALLBACK newproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
throw 0;returnoldproc(hwnd, uMsg, wParam, lParam);
}
int _tmain(int argc, TCHAR *argv[])
{
HWND hWnd
= CreateWindowEx(0, TEXT("STATIC"), TEXT("Name"),
WS_OVERLAPPEDWINDOW
|WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, NULL, NULL);
oldproc
=(WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)newproc);

UpdateWindow(hWnd);


system(
"pause");
}

标签: none

添加新评论