赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
首先是吐槽:
WX你妹的Eb!程序猿,菜单自己花就算了,这次特么居然换成bcgcontrolbar了!!!
蛋疼啊!!!!
有傻么????用这玩意??
于是我淡定不能了。这货是MFC的东西……使用的时候bcgcontrolbar.Create(CMenu)然后自动销毁CMenu,
这你娃叫我怎么响应??我本着毕竟是MFC带的东西,还是用OnCommand响应的心情,尝试在Proc里面用
OnCommand,捕获事件……然后草民失败了。
在CBT里面建的菜单是灰色的混蛋!!!EnableMenuItem没有用啊没有用!!!
这是要闹哪样啊??
- if(nCode==HCBT_CREATEWND)
- {
- // 请想办法鉴定是不是主窗口
- LPCBT_CREATEWND pstr=(LPCBT_CREATEWND)lparam;
- if (pstr->lpcs->hwndParent==0&&pstr->lpcs->hMenu!=0){
- FirstTime=false;
- hWnd=(HWND)wparam;
- oProc = SetWindowLong(hWnd,GWL_WNDPROC,(LONG)newWndProc);
- HMENU hm = pstr->lpcs->hMenu;
- hPop = CreatePopupMenu();
- AppendMenu (hPop,MF_STRING,(UINT_PTR)1000,L"管理(&A)");
- AppendMenu (hPop,MF_SEPARATOR,(UINT_PTR)1001,NULL);
- AppendMenu(hm,MF_POPUP,(UINT_PTR)hPop,L"插件(&P)");
- EnableMenuItem ((HMENU) hPop,0,MF_ENABLED);
- EnableMenuItem ((HMENU)hPop,1000,MF_ENABLED);
- EnableMenuItem ((HMENU)hm,1000,MF_ENABLED); //我真的不是到该弄哪个了……
- }
- }
复制代码
VX的时候还可以
- if (uMsg==WM_INITMENUPOPUP)
- {
- EnableMenuItem ((HMENU) wParam,0,MF_ENABLED);
- //return 0;
- }
复制代码
在ACE里面完全不能用啊没效果啊!!!!
求解释肿么办???
完整代码:
- // RMPlus.cpp : Defines the exported functions for the DLL application.
- //
- #include "stdafx.h"
- #include "hHookMonery.h"
- #include <string>
- bool Okay = false;
- LRESULT CALLBACK newWndProc( HWND hwnd,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam
- )
- {
-
- if (uMsg==WM_COMMAND)
- {
- //if (MPluginHost::Effect((long)LOWORD(wParam)))
- if (LOWORD(wParam)>=1000)
- {
- //if (wParam==1000)
- //MessageBox(0,L"hi",L"hi",0);
- //return 0;
- return 0;
- }
-
-
- }
- if (uMsg==WM_INITMENU)
- {
- EnableMenuItem ((HMENU) wParam,1000,MF_ENABLED);
- //return 0;
- }
- if (uMsg==WM_INITMENUPOPUP)
- {
- EnableMenuItem ((HMENU) wParam,0,MF_ENABLED);
- //return 0;
- }
- return CallWindowProc((WNDPROC)oProc,hwnd,uMsg,wParam,lParam);
- }
- bool FirstTime=true;
- LRESULT WINAPI cbthookproc(int nCode,WPARAM wparam,LPARAM lparam)
- {
- if (GetCurrentProcessId ()!=hPid) return CallNextHookEx(hHook1,nCode,wparam,lparam);
- //if (FirstTime)
- if(nCode==HCBT_CREATEWND)
- {
- // 请想办法鉴定是不是主窗口
- LPCBT_CREATEWND pstr=(LPCBT_CREATEWND)lparam;
- if (pstr->lpcs->hwndParent==0&&pstr->lpcs->hMenu!=0){
- FirstTime=false;
- hWnd=(HWND)wparam;
- oProc = SetWindowLong(hWnd,GWL_WNDPROC,(LONG)newWndProc);
- HMENU hm = pstr->lpcs->hMenu;
- hPop = CreatePopupMenu();
- AppendMenu (hPop,MF_STRING,(UINT_PTR)1000,L"管理(&A)");
- AppendMenu (hPop,MF_SEPARATOR,(UINT_PTR)1001,NULL);
- AppendMenu(hm,MF_POPUP,(UINT_PTR)hPop,L"插件(&P)");
- EnableMenuItem ((HMENU) hPop,0,MF_ENABLED);
- EnableMenuItem ((HMENU)hPop,1000,MF_ENABLED);
- EnableMenuItem ((HMENU)hm,1000,MF_ENABLED);
- }
- }
- return CallNextHookEx(hHook1,nCode,wparam,lparam);
- }
- LRESULT WINAPI skinhookproc(int nCode,WPARAM wparam,LPARAM lparam)
- {
- if (GetCurrentProcessId ()!=hPid) return CallNextHookEx(hHook,nCode,wparam,lparam);
- CWPSTRUCT *msg = (CWPSTRUCT*)lparam;
- if (msg->message==WM_CREATE)
- {
-
- wchar_t className[1024]={0};
- ::GetClassName(msg->hwnd,className,1024);
- //if (lstrcmp(className,L"Afx:00400000:b:00010003:00000006:016B31F3")){
- if (lstrcmp(className,L"Afx:00400000:b:00010003:00000006:053F11ED")==0&&!Okay){
- //hMenu = CreateMenu();
- //HMENU child = CreateMenu();
-
- //AppendMenu(hMenu,16,(UINT_PTR)child,L"Plugin");
- //SetMenu(GetParent(msg->hwnd),hMenu);}
- //SetMenu(msg->hwnd,hMenu);
- //hMenu=msg->hwnd;
-
- //hWnd=(msg->hwnd);
- ///
- //wchar_t wt[255];
- //wsprintf(wt,L"Installed %d",hMenu);
- //MessageBox(0,wt,L"Installed",0);
- ///
- //oProc = GetWindowLong(hWnd,GWL_WNDPROC);
- needInitProc=true;
- Okay=true;
- }
-
- }
- if (needInitProc&&msg->message==WM_PAINT)
- {
- /*wchar_t wt[255];
- wsprintf(wt,L"Installed %d",hMenu);
- MessageBox(0,wt,L"Installed",0);
-
- TBBUTTON tb;
- ZeroMemory(&tb,sizeof(tb));
- tb.iBitmap=I_IMAGENONE ;
- tb.idCommand=133;
- tb.fsState=TBSTATE_ENABLED;
- tb.fsStyle|=TBSTYLE_LIST | BTNS_DROPDOWN;
- tb.iString=(INT_PTR)L"插件(&P)";
- SendMessage(hMenu,TB_BUTTONSTRUCTSIZE,sizeof(tb),0);
- SendMessage(hMenu,TB_ADDBUTTONS,1,(LPARAM)&tb);
- SendMessage(hMenu,TB_AUTOSIZE,0,0);
- hPop=CreateMenu();
- setg=CreateMenu();
- AppendMenu(hPop,16 | MF_POPUP,(UINT_PTR)setg,L"插件(&P)");
- // HMENU setg1=CreateMenu();
- AppendMenu(setg,MF_STRING,200,L"管理(&M)");*/
- needInitProc=false;
-
- // MessageBox(0,L"setover",L"setover",0);
-
-
- }
- return CallNextHookEx(hHook,nCode,wparam,lparam);
- }
- void CreateMenus()
- {
- }
- int StartRM()
- {
- STARTUPINFO sif;
- PROCESS_INFORMATION pif;
- ZeroMemory( &pif, sizeof(pif) );
- ZeroMemory( &sif, sizeof(sif) );
- sif.cb=sizeof(sif);
- hHook = SetWindowsHookEx(WH_CALLWNDPROC,&skinhookproc,hMod,0);
- hHook1 = SetWindowsHookEx(WH_CBT,&cbthookproc,hMod,0);
- if (CreateProcess(L"RPGVXAce.exe",NULL,NULL,NULL,false,NORMAL_PRIORITY_CLASS,NULL,NULL,&sif,&pif))
- {
- hPid=pif.dwProcessId;
- return (int)hHook;
- }else
- return -2;
- return -1;
- }
- int KillRM()
- {
- //
- UnhookWindowsHookEx(hHook1);
- return UnhookWindowsHookEx(hHook);
- }
- BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
- {
- // printf("hModule.%p lpReserved.%p \n", hModule, lpReserved);
- hMod=hModule;
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:{
- // printf("Process attach. \n");
-
- break;
- }
- case DLL_PROCESS_DETACH:{
- // printf("Process detach. \n");
- break;}
- case DLL_THREAD_ATTACH:
- // printf("Thread attach. \n");
- break;
- case DLL_THREAD_DETACH:
- // printf("Thread detach. \n");
- break;
- }
- return (TRUE);
- }
复制代码- #pragma once
- #include <Windows.h>
- #include "StdAfx.h"
- #pragma data_seg("YangffACESharedDataName")
- HHOOK hHook = 0;
- HHOOK hHook1 = 0;
- int hPid=0;
- HWND hWnd=0;
- bool needInitProc=false;
- HWND hMenu=0;
- HMENU hPop=0;
- long oProc=0;
- #pragma data_seg()
- HMODULE hMod =0;
- HMENU setg=0;
- #pragma comment(linker,"/section:YangffACESharedDataName,rws")
复制代码- // stdafx.h : include file for standard system include files,
- // or project specific include files that are used frequently, but
- // are changed infrequently
- //
- #pragma once
- #ifndef YFFSTD
- #define YFFSTD 1
- #include <SDKDDKVer.h>
- // Windows Header Files:
- #include <windows.h>
- #include <stdio.h>
- #include <string>
- #include <CommCtrl.h>
- #include <map>
- #include <vector>
- extern HHOOK hHook ;
- extern int hPid;
- extern HHOOK hHook1 ;
- extern HWND hWnd;
- extern bool needInitProc;
- extern HWND hMenu;
- extern HMENU hPop;
- extern long oProc;
- extern HMODULE hMod;
- extern HMENU setg;
- // TODO: reference additional headers your program requires here
- #endif
复制代码- LIBRARY RMPlusACE
- EXPORTS
- StartRM
- KillRM
复制代码- require 'Win32API'
- require 'dl'
- require 'dl/callback'
- require 'dl/func'
- include DL
- alias o_exit exit
- def exit(*args)
- Win32API.new("RMPlusACE","KillRM","","i").call()
- o_exit(*args)
- end
- puts Win32API.new("RMPlusACE","StartRM","l","i").call(0)
- print "Please Press Enter before RPG Maker VX to exit me!!"
- gets
- Win32API.new("RMPlusACE","KillRM","","i").call()
复制代码
我真的想把效果做的好些啊!!! |
|