04-23-2006 02:15 PM
04-24-2006 04:14 PM
Hi Steve,
First, I want to make sure you know where to find the VISA examples since their location isn't very intuitive. By default, the examples are installed in C:\VXIPNP\WinNT\NIvisa\Examples\C. The General/RdWrt_CVI is a good place to start. The viWrite function is fairly simple to use once you know that you can manually convert your data to a ViBuf. For example:
static char stringinput[512];
viWrite (instr, (ViBuf)stringinput, strlen(stringinput), &writeCount); //from the RdWRT_CVI example
Or something like this:
viWrite (mySerialHandle, &myArray[0], 1, &returnCount); //showing numeric array
I hope this is helpful! Let us know if you have further questions.
Happy coding,
Megan B.
Applications Engineer
National Instruments
04-25-2006 01:17 PM
Megan,
That is what I tried first however, the string is not converted to its actual ASCII values, it is sent straight out as is. I did fix the problem by manually converting the hex string to ASCII and this is what it looks like:
~AO0ÿ ± @ ßâ€|(ÿ~. I didn't know if CVI had a library function to convert from hex to ASCII or not.
I have also posted another thread. When I stop my application after I have generated a word report I get the following warning: A non-debuggable thread is trying to suspend execution at address 00000001. If yuou have any suggestion on this I would be greatful.
Thanks for your help
Steve
04-26-2006 02:56 PM
Good afternoon Steve,
I have never encountered an error like this and there are no substantial records of others receiving this message that I could immediately locate. So, to troubleshoot this problem, we will probably need a little more information on the problem, and work toward narrowing down the issue.
As far as providing more information, do you have a screenshot of the error, or a snippet of code that can reproduce the behavior? What are all the versions of software you are using, including the version of MS Office? Are you using any of the windows SDK threading functions or the threading functions in CVI?
To narrow down the problem, I would recommend removing large sections of code in an attempt to find the bare minimum line(s) of code which can reproduce the problem. By doing this we can hopefully narrow down the issue to one or two calls that can be more easily debugged.
04-26-2006 03:28 PM
Travis,
I believe I have narrowed it down to the WordRpt_DocumentSaveAs. When I remove this line of code the program works normally. I am using Labwindows/CVI 8.0 with Report Generation 1.0.1 and have Microsoft Office 2003 running under Windows XP. It seems as if another thread is being created when I save the document and not getting destroyed afterward, so when I generate the next document it is still open. Let me know if this helps or not.
Thanks,
Steve
04-27-2006 04:17 PM
Hello,
Awesome to hear that we could narrow this down to a single function call! The bad news, however, is that this may be something we have to work around. There really is no “report generation toolkit” for CVI – there are NI Report generation functions that come with the full version of CVI, and there is a “wordreport” function panel for MS Word reports that comes as a free-tool for use with CVI. This instrument driver was written in 1999 and is designed for an older (much older) MS Word ActiveX typelibrary. Therefore, we really can’t certify its compatibility with MS Word 2003.
That being said, there are a couple of things you can try out. First, try putting a small delay before and after the call to save as, which might give Word more time to complete its current operation before moving on to other word operations. Perhaps the operation is not threadsafe. Another option is that this issue is related to a known problem with the function regarding the filename passed to the function. One problem is that one of the variant functions incorrectly mangles the filename. You are welcome to open the wordreport.c file and examine the contents of the function. Look for the function call to “CA_VariantSetCString” which converts the filename to a variant filename. Ensure that the filename sent here is accurate. (see http://forums.ni.com/ni/board/message?board.id=180&message.id=19563&requireLogin=False for more information). Finally, the other option is to just overwrite the function in the wordreport.c file to use a newer version of the Word ActiveX functions (check out the MSDN for the appropriate functions).
I understand that this is not the answer you may have been hoping for, but hopefully some of the suggestions provided will help out.
Thanks for posting, and let me know how it goes!