04-28-2011 01:10 PM
Al S wrote:
Robojeff:
I'm running CVI 2010 on Windows XP Pro 2002 Service Pack 3 with 3.5 Gb RAM.
It looks to me like ClipboardGetText appends the NULL character. I haven't seen any evidence to the contrary. As I copied various strings to the cllipboard, the string returned by ClipboardGetText always had the correct length: it expanded and shrank as needed.
The CVI Help for ClipboardGetText describes the first parameter as Pointer to the null-terminated string copied from the clipboard. I think it does the null-terminating. Since ClipboardGetText doesn't return the string length, how useful would that function be if it didn't terminate the string? You would never know where the string ended.
One of your earlier posts shows the data on the clipboard when dummy == 1. But when you get the error, dummy still == 0. What is the contents of the clipboard then? Leave the error dialog open, and switch to another app (like notepad) that accepts text from the clipboard, and paste it in.
Have you tried running your program with static data in the clipboard, without the other app (that writes to the clipboard) running?
Have you tried running the clipbord.prj sample project that ships with CVI while the app that writes to the clipboard is running and pasting from the clipboard repeatedly?
==========================================================
Hi Al-
I have been monitoring the value of CB while running the code and yes dummy ==0 when this happens and doesn't become 1 untilthe other application dumps its test results as until then, the clipboard holds only 1 asterisk which is what I test for (42). I have verified this both in the watch window and by openning up note pad and doing a Ctrl V.
I have also verified that even with the application stopped, the code will loop with the 1 asterisk on the clipboard and if I type in "1234" highlight it and copy it, I get the same error...
I did see a couple of rare occurances where it passes through the loop just fine without the error but I have not been able to replicate this "correct & desired condition"
very strange indeed...
04-28-2011 01:14 PM - edited 04-28-2011 01:23 PM
Have you tried running the CVI example clipbord.prj and repeatedly pasting?
How many times do you go through the loop before generating the error?
Have you tried running the executable outside of the CVI environment?
04-28-2011 03:18 PM
Al-
My latest findings are that it works outside of the CVI environment without error so it has to do with running the CVI envirnment.
Because I am using the CVI environment to debug this as I go, are there any settings that I might tweek to make this work in the CVI environment?
thanks for the suggestions!
04-29-2011 03:52 PM
Hi robojeff,
I'm curious if you built the executable as debug or release. Does the behavior change at all when you switch between the two?
Thanks!
Jen W
Applications Engineer
National Instruments