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.

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 on other sites
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 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 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 complicatedtypedef const char * LPCTSTR;typedef int INT;HINSTANCE ShellExecute(HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFile,                        LPCTSTR lpParameters, LPCTSTR lpDirectory, INT nShowCmd);

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.

1. 1
Rutin
49
2. 2
3. 3
4. 4
5. 5

• 10
• 28
• 20
• 9
• 20
• Forum Statistics

• Total Topics
633410
• Total Posts
3011723
• Who's Online (See full list)

There are no registered users currently online

×