如果能把關於軟體的一些資訊(about me)加入視窗的系統選單是不是很酷啊!
其實這是個很簡單的操作,lets go!
1.新增乙個模組(subclass)
option explicit
有關系統選單的api
public declare function getsystemmenu lib "user32" (byval hwnd as long, byval brevert as long) as long
public declare function insertmenu lib "user32" alias "insertmenua" (byval hmenu as long, byval nposition as long, byval wflags as long, byval widnewitem as long, byval lpnewitem as any) as long
public const mf_bycommand = &h0&
public const mf_byposition = &h400&
public const mf_string = &h0&
public const mf_separator = &h800&
有關視窗的訊息處理的api
private declare function setwindowlong lib "user32" alias _
"setwindowlonga" (byval hwnd as long, byval nindex _
as long, byval dwnewlong as long) as long
private declare function callwindowproc lib "user32" alias _
"callwindowproca" (byval lpprevwndfunc as long, byval _
hwnd as long, byval msg as long, byval wparam as _
long, byval lparam as long) as long
const gwl_wndproc = (-4&)
const wm_syscommand = &h112
const wm_destroy = &h2
dim prevwndproc&
public sub init(hwnd as long)
prevwndproc = setwindowlong(hwnd, gwl_wndproc, addressof subwndproc)
end sub
public sub terminate(hwnd as long)
call setwindowlong(hwnd, gwl_wndproc, prevwndproc)
end sub
private function subwndproc(byval hwnd as long, byval msg as long, _
byval wparam as long, byval lparam as long) _
as long
if msg = wm_destroy then terminate (form1.hwnd)
if msg = wm_syscommand then
if wparam = 2002 then
msgbox "我是40star", vbinformation, "hia..hia..."
end if
end if
subwndproc = callwindowproc(prevwndproc, hwnd, msg, wparam, lparam)
end function
2.在視窗的load事件中加入
private sub form_load()
insertmenu getsystemmenu(me.hwnd, false), 0, mf_byposition or mf_separator, 2001, "" 加入一條分割線
insertmenu getsystemmenu(me.hwnd, false), 0, mf_byposition or mf_string, 2002, "about me(&a)" 加入about me選單在系統選單中
call init(me.hwnd)
end sub
3.在視窗的unload事件中加入
private sub form_unload(cancel as integer)
call terminate(me.hwnd)
end sub
ok啦!執行一下吧,是不是很好玩 :)
在win2000 + vb6中除錯通過
good luck
將Sublime Text2 加入右鍵選單
於是按照vim加入滑鼠右鍵的方法.果然可以.這裡和大家分享 1.執行中輸入 regedit 開啟登錄檔 2.在hkey classes root shell 下新建 項 名稱自己覺得.我用的是sublime text 3.在 sublime text 下 新建 項 名字 command 這個貌似不可...
如何 使用變數視窗將變數加入封裝
sql server 2005 在 business intelligence development studio 中,開啟您要使用的 integration services 封裝。在 方案總管 中,連按兩下封裝將其開啟。在 ssis 設計師 中,若要定義變數的範圍,請執行下列其中之一 在 ss...
將Tomact加入windows系統服務
註冊tomact服務,在cmd中執行如下語句 語句1 cd e tomact apache tomcat 7.0.64 bin 語句2 e tomact apache tomcat 7.0.64 bin service.bat inatall tomact7.0 注 tomact7.0為服務名稱 移...