{I+=codeWee;}
[C++] Windows Message Hooking for your own Process
WNDPROC pOrigProc;

LRESULT CALLBACK HookWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
	case WM_LBUTTONDOWN:
		MessageBox(NULL, TEXT("WM_LBUTTONDOWN"), TEXT("WM_LBUTTONDOWN"), MB_OK);
		break;
	}
	return CallWindowProc(pOrigProc, hwnd, uMsg, wParam, lParam);
}

void SetHook(HWND hwnd)
{
	if (pOrigProc != NULL)
		return;
	pOrigProc = (WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (LONG)HookWndProc);
	if (!pOrigProc)
	{
		printf("SWL Error: %d\n", GetLastError());
	}
	else
	{
		printf("Successfully hooked the Window Callback!\n");
	}
}
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.