How to know if our software were run on a CD Drive not on a harddrive?
well - if you write files, like INI files to the current folder, it won't work
use standard folders like C:\Documents and Settings\<USER>\Application Data
(see the Recycle Bin thread - Jochen was playing with code to retrieve those folder names)
the other thing that can cause programs to not be "portable" is their absence when the CD is removed
it should not cause the OS to look for something that isn't there
oh...
and don't make any assumptions about the location of your program and its' files
it may be in D:\ one time it is run and E:\SomeFolder\ the next time
don't store that location in your config files because it may not work next time :P
GetModuleFileName with NULL, then check the return value of GetDriveType.
Quote from: Tedd on December 21, 2012, 03:14:30 AM
GetModuleFileName with NULL, then check the return value of GetDriveType.
Thanks it is worked. Do you know how to know the CD ROM name?
GetVolumeInformation
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364993%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/aa364993%28v=vs.85%29.aspx)