Wait!
How does the program know what function it is? i don't specify anything but the parameters so how does that work?
and why isn't this code working?
this is the source to my dll. i have a wndproc function and a ChangeWindowProcedure(hWnd) function. i'm getting a error
error C2059: syntax error : ')'
at line 28
heres the code
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#define EXPORT __declspec(dllexport)
LONG Proc;
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved,
HINSTANCE hInstance
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
EXPORT void ChangeWindowProcedure(HWND hWnd)
{
Proc = GetWindowLong(hWnd, GCL_WNDPROC);
LRESULT (*)(HWND,UINT,WPARAM,LPARAM) NewProc;
SetWindowLong(hWnd, GCL_WNDPROC, NewProc);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
int wmId;
HDC hdc;
PAINTSTRUCT ps;
CallWindowProc(WNDPROC(Proc), hWnd, Message, wParam, lParam);
switch (Message)
{
case WM_COMMAND:
wmId = LOWORD(lParam);
switch (wmId)
{
case 100:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, Message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
break;
case WM_CLOSE:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, Message, wParam, lParam);
}
return 0;
}
New Site! Check it out \/