Jump to content
  • Advertisement
Sign in to follow this  
GameMasterXL

System shell

This topic is 4655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I don't know if this is to do with the shell but how do i make a program in C++ that recognises a certain file format and if it does opens that file up into a program and shows an image for that file?

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure to fully understand your question, do you want to know if there is a way of knowing under which format a file is?

Actually, there is nothing such as a standard way to recognize files.

So, the first step is to read the extension, which gives a good idea on what the file could be. The second step is to start reading the file following the format that you deduced from the extension. If the format is not correct, you will know very quickly!

Some files have a marker at the beginning, for example, a BMP file starts with the characters 'B' 'M' and 'P'. So, if your file has extension .bmp and do not start with "BMP", it is clearly the wrong format, and there is no need to go further.

I believe programs like image editors just try to read the file with every format they know, until it fits.

Share this post


Link to post
Share on other sites
Is what i mean is, is there anyway for a program to recognise all the files in the system under this format *.HSC and then add an icon to that file and add a directory to it so when you click it the file gets sent to a program. Sorry for my bad explanation lol :). So you know like in visual C++ it recognises all the .cpp files on your system adding an icon to it and when you click a .cpp file it opens in the IDE and not notepad? well like that but to my own specifications. I thought it would be to do with the system shell. If not do i need a program to start up on startup?

Share this post


Link to post
Share on other sites
hi,

you have to add your filetype to the registry,
but i'm not sure how to do this exactly..

but you can search for "registering filetype" or something like that,
I think, this will work...


Marc

Share this post


Link to post
Share on other sites
Thanks for help, i am a bit confused about the registery examples on msdn. By anychance do you know how i can code that example in the first link you gave me in C++? so i can change the file types icon and menu.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!