前兩天的改鍵程式修改後基本可用,貼**
using system;
using system.collections.generic;
using system.runtime.interopservices;
using system.windows.forms;
namespace war3keywizard
public class keyboardhook
//析構函式中解除安裝鉤子
~keyboardhook()
static int hkeyboardhook = 0;
//滑鼠常量
public const int wh_keyboard_ll = 13;
public delegate int hookproc(int ncode, int32 wparam, intptr lparam);
//宣告鍵盤鉤子事件型別
hookproc keyboardhookprocedure;
//處理訊息的函式 返回值 true:遮蔽訊息 false:繼續訊息傳遞
public delegate bool keyvaluewizardd(int32 wparam);
//按下鍵盤的處理
public keyvaluewizardd keydownvalwzard;
//釋放鍵盤的處理
public keyvaluewizardd keyupvalwizard;
//安裝鉤子
[dllimport("user32.dll", charset = charset.auto, callingconvention = callingconvention.stdcall)]
public static extern int setwindowshookex(int idhook, hookproc lpfn, intptr hinstance, int threadid);
//下乙個鉤子
[dllimport("user32.dll", charset = charset.auto, callingconvention = callingconvention.stdcall)]
public static extern int callnexthookex(int idhook, int ncode, int32 wparam, intptr lparam);
//解除安裝鉤子
[dllimport("user32.dll", charset = charset.auto, callingconvention = callingconvention.stdcall)]
public static extern bool unhookwindowshookex(int idhook);
[dllimport("kernel32")]
public static extern int getmodulehandle(string lpmodulename);
public void start()}}
public void stop()
if (!retkeyboard)
throw new exception("unload globalkeyboardhook failed!");
}private int keyboardhookproc(int ncode, int32 wparam, intptr lparam)
}if (keyupvalwizard != null && (wparam == sysmessageconst.wm_keyup || wparam == sysmessageconst.wm_syskeydown))
return callnexthookex(hkeyboardhook, ncode, wparam, lparam);
}/// /// 宣告鍵盤鉤子的封送結構型別
///
[structlayout(layoutkind.sequential)]
public class keyboardhookstruct
}public class war3keywizard
[dllimport("user32.dll")]
public static extern intptr findwindow(string lpclassname, string lpwindowname);
[dllimport("user32.dll", entrypoint = "sendmessage")]
private static extern int sendmessage(intptr hwnd, int wmsg, int wparam, int lparam);
//[dllimport("user32.dll")]
// private static extern bool setforegroundwindow(intptr hwnd);
//啟動修改功能判斷
bool iswizardon = false;
public string info = "";
intptr war3;//war3視窗控制代碼
void keychange(int32 wparam)
war3 = findwindow(null, "warcraft iii");
logoutput.logput(info);
}//處理鍵盤按下
bool keydownproc(int32 wparam)
}return false;
}//處理鍵盤鬆開
bool keyupproc(int32 wparam)
}return false;
}//設定鍵盤修改 keyol被修改鍵列表 keyfl替換件
public void setkeymap(listkeyol, listkeyfl)}}
class keyvalchangemap
keymap.add(keyk, keyv);
}static public void clear()
public static int getkeychange(int keyk)
return -1;}}
class logoutput}}
介面
窗體程式修改
見第乙個窗體程式 兌現承諾!程式修改說明 依然沒有對介面進行優化,但那是遲早的事,首先考慮的當然是功能完善。1 把布局再調整一下,按鍵部分確定為0 9,退格,機選1注,機選5注 清除1 清除5。2 為0 9及退格按鈕設定對應的響應函式click,command命令用lambda函式動態捕捉0 9及退...
java 程式修改系統時間
runtime.getruntime exec cmd c date 2013 05 06 windows 系統 runtime.getruntime exec cmd c time 22 35 00 windows 系統runtime.getruntime exec sudo date s 201...
小程式修改checkbox樣式
1 未選中的 背景樣式 2 checkbox wx checkbox input7 選中後的 背景樣式 紅色背景 無邊框 可根據ui需求自己修改 8 checkbox wx checkbox input.wx checkbox input checked 12 選中後的 對勾樣式 白色對勾 可根據u...