按照CAPTION去關閉某個視窗

2021-04-09 07:53:03 字數 841 閱讀 1672

你可以使用api函式findwindow和postmessage去尋找指定的視窗,並關閉它。下面的例子教給你怎樣找到並關掉乙個caption為「caluclator」的程式。

dim winhwnd as long

dim retval as long

winhwnd = findwindow(vbnullstring, "calculator")

debug.print winhwnd

if winhwnd <> 0 then

retval = postmessage(winhwnd, wm_close, 0&, 0&)

if retval = 0 then

msgbox "置入訊息錯誤!"

end if

else

msgbox "calculator沒有開啟!"

end if

為了讓以上的**工作,你必須在模組檔案中什麼以下api函式:

declare function findwindow lib "user32" alias _

"findwindowa" (byval lpclassname as string, _

byval lpwindowname as string) as long

declare function postmessage lib "user32" alias _

"postmessagea" (byval hwnd as long, byval wmsg as long, _

byval wparam as long, lparam as any) as long

public const wm_close = &h10  

vba 按照某列結果做透視

sub 從首列提取周次到第二列並透視 for i 1 to activesheet.range a1 currentregion.rows.count c activesheet.cells i,1 value activesheet.cells i,2 value mid c,5,2 next a...

pandas根據某列去重

drop duplicates subset comment keep first inplace true 引數 栗子 首先建立乙個dataframe。使用drop duplicates來去除重複值,如果不指明subset,那麼預設根據所有列來考慮,即當某兩行資料所有列都重複時進行去重。subse...

JDK1 8按照乙個屬性去重或者多個屬性去重

1 按照物件中的乙個屬性去重 明細詳情 listreceiptdetaillistbacklist1 receiptbackbody.getdetaillist 去重進庫任務明細狀況 listreceiptbacklist receiptdetaillistbacklist1.stream coll...