WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Clipboard Input Blocked

 Keywords: Clipboard Locked Blocked GetWindowThreadProcessId  GetOpenClipboardWindow WinItemProcId GetClipboardOwner

Question:

For some reason I am unable to paste text into WinBatch Studio. Any ideas what might be going on?

Answer:

First check that your antivirus software has not some how flagged WinBatch and the WinBatch Studio and disabled clipboard functionality somehow:

Suspect Antivirus / Security Tools:

If you have concluded that your anti-virus tools is not involved...

It's possible some application is locking the clipboard. The trick will be to figure out what process. Here is some code you can run on the system when you are having clipboard problems to help track down which Process ID owns the clipboard and or has the clipboard open...

DebugTrace(@ON , DirScript():'ClipTrace.txt')
#DefineFunction GetProcessID(h)
   DebugTrace(2 , "")

   bb=BinaryAlloc(4)
   BinaryEodSet(bb,4)
   dllname=StrCat(DirWindows(1),"user32.dll")
   DllCall(dllname,long:"GetWindowThreadProcessId",long:h,lpbinary:bb)
   p=BinaryPeek4(bb,0)
   BinaryFree(bb)
   Return (p)
#EndFunction

;GetOpenClipboardWindow the function succeeds, the return value is the handle to the window that has the clipboard open.
; If no window has the clipboard open, the return value is NULL. To get extended error information, call GetLastError.
hwnd = DllCall( DirWindows(1): "user32.dll", long:"GetOpenClipboardWindow")
If hwnd
   procid = GetProcessID(hwnd)
   Pause('GetOpenClipboardWindow','The following process ID has the clipboard open: ': procid )
   winids = WinItemProcId(procid, 2, 2)
   Message("Window ID(s)", winids)
Else
   Pause('GetOpenClipboardWindow','No window has the clipboard open')
EndIf

;GetClipboardOwner - In general, the clipboard owner is the window that last placed data in clipboard.
hwnd = DllCall( DirWindows(1): "user32.dll", long:"GetClipboardOwner")
If hwnd
   procid = GetProcessID(hwnd)
   Pause('GetClipboardOwner','The following process ID is the clipboard owner: ': procid )
   winids = WinItemProcId(procid, 2, 2)
   Message("Window ID(s)", winids)
Else
   Pause('GetClipboardOwner','No clipboard owner')
EndIf
Exit

User Reply:

It turned out that a graphic resizing program I had installed had an unnoticed feature: it could work on an image pasted from the clipboard. I wasnt using that feature, yet when I unloaded the program, my whole clipboard locked problem went away.
Article ID:   W17913
Filename:   Clipboard Input Blocked .txt
File Created: 2012:12:20:14:28:20
Last Updated: 2012:12:20:14:28:20