赞 | 0 |
VIP | 133 |
好人卡 | 5 |
积分 | 1 |
经验 | 15036 |
最后登录 | 2017-9-12 |
在线时间 | 190 小时 |
Lv1.梦旅人 彩色的银子
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 190 小时
- 注册时间
- 2006-6-13
- 帖子
- 1361
|
VC6下编译OK- // WndProc.cpp : Defines the entry point for the DLL application.
- //
- #include "stdafx.h"
- #include<stdio.h>
- // 窗口过程原型
- LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- // 旧的过程
- WNDPROC OldWndProc;
- // 连接库句柄
- HINSTANCE hInst = NULL;
- // RGSS
- long (*LoadRGSS)(LPCTSTR);
- BOOL BreakRM = false;
- // 重置过程
- extern "C" __declspec(dllexport) long ReSetProc(HWND hWnd)
- {
- OldWndProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC);
- return SetWindowLong(hWnd, GWL_WNDPROC, (long)WndProc);
- }
- // 设置RGSS连接库
- extern "C" __declspec(dllexport) void SetDLL(LPCTSTR lib_name)
- {
- hInst = LoadLibrary(lib_name);
- LoadRGSS = (long (*)(LPCTSTR))GetProcAddress(hInst, "RGSSEval");
- }
- extern "C" __declspec(dllexport) void OldProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- OldWndProc(hWnd, message, wParam, lParam);
- }
- extern "C" __declspec(dllexport) void SetBreak()
- {
- BreakRM = true;
- }
- extern "C" __declspec(dllexport) void SetMousePos(HWND hWnd, long x, long y)
- {
- SendMessage(hWnd, WM_MOUSEMOVE, 0, MAKEWPARAM(x, y));
- }
- // 窗口过程
- LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- char rgss[128];
- sprintf(rgss, "WndProc.proc(%d,%d,%d,%d)", hWnd, message, wParam, lParam);
- LoadRGSS(rgss);
- if(!BreakRM)
- return OldWndProc(hWnd, message, wParam, lParam);
- else
- BreakRM = false;
- return 0;
- }
- BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
- {
- return TRUE;
- }
复制代码 |
|