PDA

View Full Version : Blitz and the Clipboard



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.

Bill_Loguidice
01-09-2004, 11:48 AM
I'm actually finally making some good progress learning regular Blitz. Out of curiosity, now that you've had it a while, what are your impressions of Blitz+? I believe you said you used it for the Year 4 CD, which was pretty impressive, so I know it's capable, but what, specifically, do you find it makes EASIER over the regular, older Blitz?

Shane R. Monroe
01-09-2004, 12:32 PM
I'm actually finally making some good progress learning regular Blitz. Out of curiosity, now that you've had it a while, what are your impressions of Blitz+? I believe you said you used it for the Year 4 CD, which was pretty impressive, so I know it's capable, but what, specifically, do you find it makes EASIER over the regular, older Blitz?

Oh, its all the same Blitz. Blitz+ is just Blitz2D with some built in GUI stuff. I'm building an app right now (should be released in a day or two.. I just worked out the last big bug) and overall it was pretty rapid and easy once you get used to how to make GUI stuff. Its not like making forms in VB, although there are some promising Form developer tools out there. I don't usually like the overhead of other people's code (and the potential bugs they bring).

Overall, I'm having a good time. Using API calls to get to Windows stuff Blitz doesn't have yet. Its all good.

Bryan 'KidHype' Smith
01-09-2004, 12:54 PM
I'm actually finally making some good progress learning regular Blitz. Out of curiosity, now that you've had it a while, what are your impressions of Blitz+? I believe you said you used it for the Year 4 CD, which was pretty impressive, so I know it's capable, but what, specifically, do you find it makes EASIER over the regular, older Blitz?
In my opinion, if you aren't going to do gaming stuff and want a cheap alternative to VB, i highly recommend Blitz Plus. Blitz Plus however, is not Windowed Game Developlment friendly (timing issues are there) but for simple GUI development while getting used to coding in a Windows enviornment, i highly recommend it.

Hell, its got Shane using API's and not cursing Bill Gates. Any program that can do that is ok in my book :)