option explicit
public declare function createwindowex lib "user32" alias "createwindowexa" (byval dwexstyle as long, byval lpclassname as string, byval lpwindowname as string, byval dwstyle as long, byval x as long, byval y as long, byval nwidth as long, byval nheight as long, byval hwndparent as long, byval hmenu as long, byval hinstance as long, lpparam as any) as long
public declare function loadicon lib "user32" alias "loadicona" (byval hinstance as long, byval lpiconname as string) as long
public declare function loadcursor lib "user32" alias "loadcursora" (byval hinstance as long, byval lpcursorname as string) as long
public declare function getstockobject lib "gdi32" (byval nindex as long) as long
public declare function registerclas*** lib "user32" alias "registerclas***a" (pcwndclas*** as wndclas***) as integer
public declare function showwindow lib "user32" (byval handle_of_window as long, byval ncmdshow as long) as long
public declare function updatewindow lib "user32" (byval handle_of_window as long) as long
public declare function setfocus lib "user32" (byval handle_of_window as long) as long
public declare function postmessage lib "user32" alias "postmessagea" (byval handle_of_window as long, byval wmsg as long, byval wparam as long, byval lparam as long) as long
public declare function defwindowproc lib "user32" alias "defwindowproca" (byval handle_of_window as long, byval wmsg as long, byval wparam as long, byval lparam as long) as long
public declare function getmessage lib "user32" alias "getmessagea" (lpmsg as msg, byval handle_of_window as long, byval wmsgfiltermin as long, byval wmsgfiltermax as long) as long
public declare function translatemessage lib "user32" (lpmsg as msg) as long
public declare function dispatchmessage lib "user32" alias "dispatchmessagea" (lpmsg as msg) as long
public declare sub postquitmessage lib "user32" (byval nexitcode as long)
public declare function beginpaint lib "user32" (byval handle_of_window as long, lppaint as paintstruct) as long
public declare function endpaint lib "user32" (byval handle_of_window as long, lppaint as paintstruct) as long
public declare function getclientrect lib "user32" (byval handle_of_window as long, lprect as rect) as long
public declare function drawtext lib "user32" alias "drawtexta" (byval hdc as long, byval lpstr as string, byval ncount as long, lprect as rect, byval wformat as long) as long
type wndclas***
cbsize as long
style as long
lpfnwndproc as long
cbcl***tra as long
cbwndextra as long
hinstance as long
hicon as long
hcursor as long
hbrbackground as long
lpszmenuname as string
lpszclassname as string
hicon** as long
end type
type pointapi
x as long
y as long
end type
type msg
handle_of_window as long
message as long
wparam as long
lparam as long
time as long
pt as pointapi
end type
type rect
left as long
top as long
right as long
bottom as long
end type
type paintstruct
hdc as long
ferase as long
rcpaint as rect
frestore as long
fincupdate as long
rgbreserved(32) as byte 'this was declared incorrectly in vb api viewer
end type
sub main()
call vbwinmain
end sub
public function vbwinmain() as long
public function windowproc(byval handle_of_window as long, byval message as long, byval wparam as long, byval lparam as long) as long
dim ps as paintstruct
dim rc as rect
dim hdc as long
dim str as string
select case message
case wm_paint
hdc = beginpaint(handle_of_window, ps)
call getclientrect(handle_of_window, rc)
str = "hello, world!"
call drawtext(hdc, str, len(str), rc, dt_singleline or dt_center or dt_vcenter)
call endpaint(handle_of_window, ps)
exit function
'case wm_keydown
' call postmessage(handle_of_window, wm_close, 0, 0)
' exit function
case wm_destroy
postquitmessage 0&
exit function
case else
windowproc = defwindowproc(handle_of_window, message, wparam, lparam)
end select
end function
function getfuncptr(byval lngfnptr as long) as long
getfuncptr = lngfnptr
end function
仿照別人寫的鍵盤HOOK,hoho
就這個小破程式還耽誤了我兩天,我真是太笨了。這是乙個全域性的鉤子,需要放在dll中。關於dll的部分就不說了。pragma data seg simdata hwnd glbprevwnd null static hhook glbhook null hinstance glbinst null f...
Linux C 網路程式設計 仿照網盤的功能
啟動 server make server conf serverconf.ini client make client 127.0.0.1 2000 預設 server ip為主機ip,port 2000,子程序個數 5 server端 將對應命令的資料報進行傳送,包括退出處理機制 註冊 clie...
Hook技術簡介(有用SDK寫的例子)
鉤子 hook 是windows訊息處理機制的乙個平台,應用程式可以在上面設定子程以監視指定視窗的某種訊息,而且所監視的視窗可以是其他程序所建立的。當訊息到達後,在目標視窗處理函式之前處理它。鉤子機制允許應用程式截獲處理window訊息或特定事件。鉤子實際上是乙個處理訊息的程式段,通過系統呼叫,把它...