Sign in to follow this  
Followers 0
gcue

Clipboard Monitoring

4 posts in this topic

#1 ·  Posted (edited)

I am trying to monitor the clipboard on computer A and send it to computer B and vice versa.

so im trying to monitor the clipboard and send it to the opposite pc... (image or text)

im running across a problem with running a do until within the while loop. it never ends! id like to exit the do loop but stay within the while loop just in case something else is copied..

here's what i have so far:

Local $iFormat, $iCount

While 1
    If Not _ClipBoard_Open(0) Then _WinAPI_ShowError("_ClipBoard_Open failed")

    Do
        $iFormat = _ClipBoard_EnumFormats($iFormat)
        If $iFormat <> 0 Then
            $iCount += 1
            
            If StringInStr(_ClipBoard_FormatStr($iFormat), "Bitmap") <> 0 Then
                ClipboardIsImage()
                ExitLoop 1
            EndIf

            If StringInStr(_ClipBoard_FormatStr($iFormat), "Text") <> 0 Then
                ClipboardIsText()
                ExitLoop 1
            EndIf
        EndIf
    Until $iFormat = 0

    _ClipBoard_Close()
WEnd
Edited by gcue

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Local $iFormat, $iCount

While 1
    If Not _ClipBoard_Open(0) Then _WinAPI_ShowError("_ClipBoard_Open failed")

    Do
        $iFormat = _ClipBoard_EnumFormats($iFormat)
        If $iFormat <> 0 Then
            $iCount += 1
            
            If StringInStr(_ClipBoard_FormatStr($iFormat), "Bitmap") <> 0 Then
                ClipboardIsImage()
                $iFormat = 0
            EndIf

            If StringInStr(_ClipBoard_FormatStr($iFormat), "Text") <> 0 Then
                ClipboardIsText()
                $iFormat = 0
            EndIf
        EndIf
    Until $iFormat = 0

    _ClipBoard_Close()
WEnd

seems like that should work...

Edited by supadodger

Share this post


Link to post
Share on other sites

unfortunately, it doesn't =/

Share this post


Link to post
Share on other sites

Why do you think the do..until loop is never exiting?

The logic of your code combined with the behavior of _ClipBoard_EnumFormats() will not allow the do..until loop to NOT exit.

Or: the problem your having has a other reason.


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0