LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Workspace save - CVI API

Hello.

I wrote a small program that buld template project in cvi. (I use cvi api functions - cvisrvr);

Program steps:

1. Open new cvi (CVI_NewApp).

2. Save Project (CVI_AppSaveProject).

3. Create a few new *.c files and add them to project.

4. Build.

5. Exit.(CVI_AppExitCVI (cviAutoObj, NULL, 0, &ReturnValue); )

 

The question:

When i run step 5, I cannot finsh this step because i must save a workspace.

How can i programaticaly or throw api functions can save a workspace?

 

Boris

Best Regards
Boris
0 Kudos
Message 1 of 6
(3,477 Views)

Hi Boris,

 

Have you tried using CVI_AppSaveAll or CVI_AppSaveFile to save the workspace?

Rohama K.
0 Kudos
Message 2 of 6
(3,449 Views)

Hello

Sorry bu both function not working.

 

CVI_AppSaveFile - not allowed to save *.cws files. 

 

CVI_AppSaveAll  - promt me dialog for insert a name for wokspace. (It is my problem).

 

I need a function like (create_workspace or save_carent_workspace or etc....).

 

Today, i cannot automatically create a template project for my customers.

My program stucked on step 4 (build project) and/or step 5 (exit from cvi).

 

After many of working days on this application i need any solution.

 

 

Thanks

Best Regard

Boris 

Best Regards
Boris
0 Kudos
Message 3 of 6
(3,422 Views)

It looks like there isn't an easy way to save a workspace without having the prompt for the name of the workspace show up. A work around is to programmatically create a text file with the file extension ".cws". If you open a blank .cws file in notepad, you will see information about what is in the workspace. Add that information to the text file you create programmatically in CVI. CVI_AppSaveAll should not prompt for the user to give it a name.

Rohama K.
0 Kudos
Message 4 of 6
(3,394 Views)

Hello Rohama K.
What is the best way to create a sample project in CVI using API.
Could you please write me step by step similar to what I wrote at the beginning how I can implement the construction project through the API. Where in the steps I wrote above, I have to create the file CWS and how to attach the project to him? How i open CVI if i create a cws file at begining?

 

Thank you

and Best Regards Boris

Best Regards
Boris
0 Kudos
Message 5 of 6
(3,389 Views)

Hi,

 

1. Create .cws file:

fp=fopen("<path to save>\\NameOfWorkspace.cws", "w");

2. Write information to the file so that it has the minimum information to open it in CVI:
fprintf(fp, "[Workspace Header]\nActive Project = 1\nNumber of Projects = 1\nVersion = 1001");

3. Open CVI Workspace: CVI_NewApp

4. Add the new .c files

5. Save workspace: CVI_AppSaveAll

6. Exit CVI: CVI_AppExitCVI

 


Rohama K.
0 Kudos
Message 6 of 6
(3,372 Views)