Windows XP Pro
CVI 5.5
Howdy,
I have two separate apps, we'll call them MDS and ASN. They each have associated file extensions .mds and .asn, respectively, in Windows. They are in no way associated with each other - they are independent programs.
When you double click on a .mds file the MDS program starts up and loads the file fine. It sees the filename passed in from the command line in 8.3 format (i.e.C:\DOCUME~1\user\Desktop\TESTFI~1.MDS). Thus, argv[2] is the whole pathname for the file that was double clicked. This is great because if a file has some goofy filename with multiple spaces in a row it will still be opened because it's still a single string in argv.
Here's the rub, application ASN has the same code to handle the command line args passed from Windows. However, it receives the filename in the long format. If the filename has single spaces and/or long strings of spaces then the filename is broken up into individual strings like each space in the filename actually separated a command argument (i.e. argv[2] = "C:\DOCUMENTS" argv[3] = "and" argv[4] = "Settings\user\Desktop\TEST" argv[5] = "FILE.MDS"). There is no way to recover the multiple spaces from this (that I know of).
Neither program is a 16-bit application. (But Windows would pass 8.3 format filenames to a 16-bit app)
My questions are:
1) Why does MDS receive 8.3 format filenames from Windows when a mds file is double clicked?
2) How can I get Windows to pass 8.3 format filenames to ASN?
3) Alternatively, is there a way to find the file that activated the application other than via the command line (like some call from the windows SDK)?
Thanks for reading my post!
-shrew