Jump to content
  • Advertisement
Sign in to follow this  
Zyphar

Opening Files externally for Windows or any OS

This topic is 4165 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

Hey guys, Fist time posting, been lurking for a couple of months =P. I am building a game menu which will navigate through my portfolio of work. The idea is to go into different sections and being able to open up files that are included such as a video, pictures, an executable, pretty much anything depending on how the OS opens it. I just want to open it as if you were clicking on the file itself. How could this be done? btw, I am using the Allegro Library and C++.

Share this post


Link to post
Share on other sites
Advertisement
On windows you can just use ShellExecute. I don't know that a cross platform solution exists. For example on linux unless you're running X you can't click on things - so the notion of clicking isn't really applicable.

Share this post


Link to post
Share on other sites
Well I tried to include the header files needed to use ShellExecute but I have come to a big problem. Allegro already uses the name BITMAP and so does shlobj.h and shlwapi.h.

I need to find a way around this. Anyone know?

Share this post


Link to post
Share on other sites
Declare ShellExecute and the required types yourself. That's all you're including the header for, anyway.

// defining/typedef'ing HWND and HINSTANCE can be complicated

typedef const char * LPCTSTR;
typedef int INT;
HINSTANCE ShellExecute(HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFile,
LPCTSTR lpParameters, LPCTSTR lpDirectory, INT nShowCmd);

Share this post


Link to post
Share on other sites
Well after some researching, I dunno how it would be possible to define HWND or HINSTANCE since I can't find anything on them. I would assume HINSTANCE is an int but HWND is pretty tough to figure out.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!