1樓:
首先你要讓你的程式能在系統托盤裡顯示,
網上有很多示例
然後你在queryunload事件裡讓cancel=1並讓程式最小化就好了
2樓:匿名使用者
'以下是宣告
option explicit
const max_tooltip as integer = 64
const nif_icon = &h2
const nif_message = &h1
const nif_tip = &h4
const nim_add = &h0
const nim_delete = &h2
const wm_mousemove = &h200
const wm_lbuttondown = &h201
const wm_lbuttonup = &h202
const wm_rbuttondown = &h204
const wm_rbuttonup = &h205
const sw_restore = 9
const sw_hide = 0
private type notifyicondata
cbsize as long
hwnd as long
uid as long
uflags as long
ucallbackmessage as long
hicon as long
sztip as string * max_tooltip
end type
private declare function showwindow lib "user32" (byval hwnd as long, byval ncmdshow as long) as long
private declare function shell_notifyicon lib "shell32.dll" alias "shell_notifyicona" (byval dwmessage as long, lpdata as notifyicondata) as long
private nficondata as notifyicondata
public flag as integer
private sub mdiform_mousemove(button as integer, shift as integer, x as single, y as single)
'這是生成標誌的**,可以放到需要的塊裡
nficondata.hwnd = mdiform1.hwnd
nficondata.uid = mdiform1.icon
nficondata.uflags = nif_icon or nif_message or nif_tip
nficondata.ucallbackmessage = wm_mousemove
nficondata.hicon = mdiform1.icon.handle
nficondata.sztip = "timetip" & vbnullchar
nficondata.cbsize = len(nficondata)
call shell_notifyicon(nim_add, nficondata)
'這是取消標誌
call shell_notifyicon(nim_delete, nficondata)
'這是點選標誌出現選單
private sub mdiform_mousemove(button as integer, shift as integer, x as single, y as single)
if mdiform1.visible = false then
dim lmsg as single
lmsg = x / screen.twipsperpixelx
if lmsg = wm_rbuttonup or lmsg = wm_lbuttonup then mdiform1.popupmenu mnumain'這是選單名稱
end if
end sub
'這裡視窗是mdiform1,你也可以更改.
'別忘了勾上部件\引用中的windows script host和windows script control
'希望對你有幫助
3樓:張王明
用樓上的函式,要途簡單 可以找 系統托盤控制元件.
VB程式設計題目,vb程式設計題目
private sub mand1 click dim i as integer,j as integer,k as integer dim a 1 to 10 as integerdim max as integer,min as integer,pj as single dim sumnum a...
vb程式設計問題,VB程式設計問題
private sub command1 click text1 for i 1 to 45 7 for j 1 to 45 6 2for k 1 to 45 3 5if i j 2 k 5 45 thenn n 1 end if next next next text1 n end sub pri...
VB程式設計問題,VB程式設計難嗎?
非常簡單,你看插圖,一切都在圖中。如下 在窗體中新增一個label1 兩個預設command1和command2。一切屬性預設 不用修改。private sub command1 click if command1.caption 有邊框 then label1.borderstyle 1 comm...