看板 Visual_Basic 關於我們 聯絡資訊
程式碼如下 Public Function ClipboardEmpty() As Boolean Dim dataType As Integer dataType = Clipboard.GetFormat(3) '中繼檔 If dataType = -1 Then ClipboardEmpty = False Else ClipboardEmpty = True End If End Function repeat1: If ClipboardEmpty Then WordApp.Selection.WholeStory WordApp.Selection.Copy sClipText = Clipboard.GetText(vbCFRTF) Clipboard.Clear RaisErr = False Else Set_Timeout (1) Clipboard.Clear GoTo repeat1 RaisErr = True End If RaisErr輸出結果總是True,小弟不懂VB中的Clipboard.GetFormat(3)是什麼意思 猜想是不是有什麼緩衝區要釋放掉,因為起初RaisErr還是True,後來就變False了 網路找不到GetFormat的函式說明,希望VB高手能幫忙一下,謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.120.246.178 ※ 編輯: forkome 來自: 59.120.246.178 (10/31 11:47)
JacobTai:Clipboard 可以放不同的東西 文字 影像 檔案 10/31 12:17
JacobTai:所以需要先看他的格式...再決定能不能用... 10/31 12:18
fumizuki:MSDN 中有說明啊... 10/31 12:53
fumizuki:vbCFMetafile = 3 10/31 12:53
fumizuki:GetFormat(format) 檢查剪貼簿中的內容是否為指定的格式 10/31 12:53
fumizuki:回傳值:True、False 10/31 12:54
fumizuki:VB6的True = -1,False = 0 10/31 12:54
forkome:是說剪貼簿中的格式是不是vbCFMetafile嗎? 10/31 22:16
forkome:中繼檔是使用wmf檔嗎? 10/31 22:17
forkome:若檢查不是中繼檔格式,我要怎麼設定成中繼檔呢? 10/31 22:26
※ 編輯: forkome 來自: 218.169.242.12 (10/31 22:31)