#include
#include
#include "hook.h"
hinstance hinst;
hhook hhook;
bool winapi dllmain(hinstance hinstdll, dword dwreason, lpvoid lpreserved)
return true;
}bool dllsethook()
hhook = setwindowshookex(wh_callwndproc, myhookproc, hinst, 0);
if(hhook == null)
return true;
}bool dllunsethook()
hhook = null;
return true;
}lresult callback myhookproc(int ncode, wparam wparam, lparam lparam)
return callnexthookex(null, ncode, wparam, lparam);
}
通過鉤子程式跨程式關閉Window
在實際場景中會有自身程式在呼叫第三方的動態庫過程中,因為第三方的動態庫彈框導致執行緒阻塞,必須手動將彈窗關閉後才能回到自身程式的主線程中。最簡單的場景就是很多自助裝置,本身是沒有固定操作員的,如果使用者在看到彈框後沒有手動點選關閉則彈框會一直會存在。1 通過windows提供的api,findwin...
乙個搜尋路徑的例子程式 注釋
include stdio.h include stdio.h include dirent.h include string.h include sys stat.h void show dir char dir,int depth chdir dir 進去當前操作目錄,當有子目錄時遞迴呼叫使用的...
乙個很弱智的鉤子
目標 希望能將dll注入所有的gui中,當特定的gui被啟用的時候,dll中的對話方塊資源顯示 這個東西能用在外掛程式這塊,遊戲中掛上自己的框框,相當滴爽。實現 引擎呼叫dll中的注入函式,這樣全域性注入的時候,相當滴好做。曾試過在exe模組中實現全域性鉤子,鉤子中的很多變數不能相互傳遞,達不到全域...