News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Run on a CD Drive

Started by Farabi, December 20, 2012, 10:10:25 AM

Previous topic - Next topic

Farabi

How to know if our software were run on a CD Drive not on a harddrive?
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

dedndave

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

dedndave

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

Tedd

GetModuleFileName with NULL, then check the return value of GetDriveType.
Potato2

Farabi

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?
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165