What's Here?
- Members: 137,221
- Replies: 481,466
- Topics: 75,056
- Snippets: 2,567
- Tutorials: 675
- Total Online: 2,171
- Members: 103
- Guests: 2,068
|
Since wxWidgets is cross platform, it might be handy to be able to get the current operating system's start command, to use system() ~ that's exactly what this function does: it checks the default operating system, and returns a string of the operating system's command to start a process.
|
Submitted By: gabehabe
|
|
|
Rating:
|
|
Views: 224 |
Language: C++
|
|
Last Modified: October 13, 2008 |
Snippet
/*
* A method to get the "start" command of the current operating system
* Author: Danny Battison
* Contact: gabehabe@googlemail.com
*/
#include <string>
std::string GetStartCommand() {
#if defined(__WXMSW__)
return "start";
#elif defined(__WXMAC__)
return "open";
#elif defined(__UNIX__)
return "xdg-open";
#endif
}
/** EXAMPLE USAGE **/
#include <wx/wx.h>
class MainApp : public wxApp {
public:
bool OnInit();
};
bool MainApp::OnInit() {
std::string ContactAuthor = GetStartCommand() + " mailto:gabehabe@googlemail.com";
system(ContactAuthor.c_str());
return true;
}
IMPLEMENT_APP(MainApp)
Copy & Paste
|
|
|
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
|