LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Query String and CopyFile & Delay()

Solved!
Go to solution

Hi all engineers,

 

I'm fresh in labwindows& got some problem with it.

When I'm programming an program which allows users to key in CopyFile address by themselves, I found the commends differed from C. Which commend should I use for query string? I use GetCtrlVal (panelHandle, PANEL_fileA, &address), but when I run it, it said "argument too small".  And after query the string, how could I store it to sourcefile address or targetfile address in CopyFile?

 

Another problem is with the commend Delay();  Once I use Delay(), such as Delay(3600), the system can run, but other buttons will be out of work. I failed to find other method to fix it.

 

Could u plz give me some suggestion?

 

Many Thanks,

 

Wenxin

0 Kudos
Message 1 of 3
(3,208 Views)
Solution
Accepted by topic author Wenxin

Well, here there are a couple of suggestions for you.

 

With respect to filename, you may be passing too short a string to retrieve the user input in GetCtrlValCVI offers a useful macro to express the size of a string to hold a pathname, so ou can dimension the string as char address[MAX_PATHNAME_LEN]; , next passing it with its simple name (which in effect already is its address): GetCtrlVal (panelHandle, PANEL_fileA, address).

Another hint in this case is to check if the user has given a fullpath, included backslashes: these must be doubled since a single backslash is interpreted in C as an escape code.

But maybe the best suggestion is to let the user navigate to the correct destination and give the file name wusing FileSelectPopup, which returns the complete pathname that you can use without further modifications and formatting.

 

With respect to Delay, it actually stops program execution until the given time period elapses, so you must develop your pausing strategy in a different way. In effect, a 1 hour stop is more like a "activity suspension" than a simple pause, and you should handle it differently, especially if you want to maintain some user interaction during this time. You could for example let the system run disabling the forbidden buttons or hiding them, or divide the interval in littler time slices using ProcessSystemEvents to eprmit handling other events: there are several threads in the forum that discussthis item, so you could made search on it.

 

But the first suggestion I can give you is to run the tutorials if you haven't done it already, to study some basic documentation that comes with CVI and carefully study some of the examples installed along with the environment, that can give you a better understanding of the instrument you are using and answer some basic questions you still have.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,207 Views)

Hi Roberto,

 

Thanks for your suggestion, I think I have solved out the problem.

 

Warm Regards'

Wenxin

0 Kudos
Message 3 of 3
(3,179 Views)