Hello JagoDragon,
The following is an answer to the question placed by you on 15/03/2002.
The Last Save Version Watcher
Here below you may find the methodology I used to implement a Last Save Version Watcher (LSVW) on CATIA V5.
Step 1: Preparation
First of all, we have to auto-run the LSVW every time we open a CATIA session. To do this, we need to write a script file (AutoRun.CATScript) which will load our application ie the Watcher
Next, we need to copy and paste our desktop icon of CATIA V5 and rename it to “My CATIA V5R20”. In the [Properties] dialog box of it and in the [Target] field of the [Shortcut] tab we need to modify the text so as to run our AutoRun.CATScript script file.
Having done these, we have succeeded to run our application (LastSaveVersionWatcher.exe) every time we start a new CATIA session. When we click the customized CATIA icon, it will load CATIA. At the end of it, CATIA will run the AutoRun.CATScript. AutoRun.CATScript will run our application.
Step 2: The Application
What we need to do inside our application is that on load of it we need to install an appropriate hook to the already open CATIA window. (Can be done with the aid of SetWindowsHookEx API function) Now our application is able to intercept Windows messages sent to CATIA window, such as user selection of Open or Save menu item.
Step 3
In case of selection of Open menu item, we need to open our own[Open] common dialog box to allow the user to browse and select the file to open. On close of it we need to check if the user closed it with [Open] or [Cancel] button.
In the first case,
• read the last save version info stored in the selected file,
• read the version of the running CATIA session, and
• display them in a form where we can choose to open or cancel the operation
• in case we decided to open the file, use the CATIA open command to open the file in CATIA, otherwise do nothing.
In case of selection of Save menu item,
• read the last save version info stored in the CATIA active window reference file,
• the version of the running CATIA session, and
• display them in a form where we can select to save or cancel the operation
• in case we decided to save the file use the CATIA save command to save the file, otherwise do nothing.
Note: An advanced interface of the above solution is to display the last save version info as a tooltip text while user hoovering over a CATIA file in the Open common dialog box.
I hope it helps
-GELFS