(svn r23490) -Add [FS#2750]: OpenBrowser function to open a browser on major OSes

This commit is contained in:
yexo
2011-12-11 11:47:08 +00:00
parent 00355b2e68
commit f18be8a266
4 changed files with 34 additions and 0 deletions

View File

@@ -18,6 +18,7 @@
#include <windows.h>
#include <fcntl.h>
#include <shlobj.h> /* SHGetFolderPath */
#include <Shellapi.h>
#include "win32.h"
#include "../../core/alloc_func.hpp"
#include "../../openttd.h"
@@ -79,6 +80,11 @@ void ShowOSErrorBox(const char *buf, bool system)
MessageBox(GetActiveWindow(), MB_TO_WIDE(buf), _T("Error!"), MB_ICONSTOP);
}
void OSOpenBrowser(const char *url)
{
ShellExecute(GetActiveWindow(), _T("open"), MB_TO_WIDE(url), NULL, NULL, SW_SHOWNORMAL);
}
/* Code below for windows version of opendir/readdir/closedir copied and
* modified from Jan Wassenberg's GPL implementation posted over at
* http://www.gamedev.net/community/forums/topic.asp?topic_id=364584&whichpage=1&#2398903 */