Shane R. Monroe
01-09-2004, 11:42 AM
I want to document this so that hopefully it will benefit someone OTHER than me. It took me HOURS to figure out what was going on, and if I can save someone the trouble, well - it was worth it.
Blitz+ has no built in commands for accessing the clipboard, so I found some code to hit the API to get it:
http://www.blitzbasic.com/codearcs/codearcs.php?code=699
This initially appeared to work, and I was getting clipboard polling into my current project.
However, from time to time, with no reason at all, my program would crash. I wouldn't even be USING the program; just closing something else. It was ugly. Blitz wouldn't catch the error, so I narrowed it down to an API call. Since the clipboard was one of the few API calls I was using, I figured it was in there somewhere.
To make a long story (and hours of digging and BS testing) I figured out where the problem was. Turns out that the OPENCLIPBOARD command in the Blitz code wasn't being checked to make SURE the open command was successful. The next line, EXAMINECLIPBOARD was unable to execute if the open command failed. Since the code didn't check to make sure the open was successful, this was causing 'clipboard collision'. When ANOTHER program was accessing the clipboard, and I was polling it for change, my program would crash. Turns out that the clipboard gets accessed A LOT that you don't see - making almost anything (not a cut and paste action... just stuff like closing down another program ... cause my program to crash.
You can find my fixed code and further explaination here:
http://www.blitzbasic.com/Community/posts.php?topic=29178
Hope this ends up helping SOMEONE.
Blitz+ has no built in commands for accessing the clipboard, so I found some code to hit the API to get it:
http://www.blitzbasic.com/codearcs/codearcs.php?code=699
This initially appeared to work, and I was getting clipboard polling into my current project.
However, from time to time, with no reason at all, my program would crash. I wouldn't even be USING the program; just closing something else. It was ugly. Blitz wouldn't catch the error, so I narrowed it down to an API call. Since the clipboard was one of the few API calls I was using, I figured it was in there somewhere.
To make a long story (and hours of digging and BS testing) I figured out where the problem was. Turns out that the OPENCLIPBOARD command in the Blitz code wasn't being checked to make SURE the open command was successful. The next line, EXAMINECLIPBOARD was unable to execute if the open command failed. Since the code didn't check to make sure the open was successful, this was causing 'clipboard collision'. When ANOTHER program was accessing the clipboard, and I was polling it for change, my program would crash. Turns out that the clipboard gets accessed A LOT that you don't see - making almost anything (not a cut and paste action... just stuff like closing down another program ... cause my program to crash.
You can find my fixed code and further explaination here:
http://www.blitzbasic.com/Community/posts.php?topic=29178
Hope this ends up helping SOMEONE.