-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbrowser.c
39 lines (28 loc) · 1.16 KB
/
browser.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <stdlib.h>
/////#include <iostream>
#include <windows.h>
#include <shellapi.h>
int main(void)
{
#if defined(_WIN32) || defined(_WIN64) || defined(__TOS_WIN__) || defined(OS_WINDOWS) || defined(__WIN32__) || defined(__WINDOWS__)
cout<< " Windows"<< endl; system("dir");
#endif
cout<<"NOT Windows"<< endl; system("ls");
cout<< " Windows"<< endl; system("dir");
//system("start https://digitalbd.org");
ShellExecute(NULL, "open", "http://www.microsoft.com", NULL, NULL, SW_SHOWNORMAL);
/// reference link https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/224816
}
/// I've had MUCH better luck using ShellExecuteA().
/// I've heard that there are a lot of security risks when you use "system()".
/// This is what I came up with for my own code.
void SearchWeb( string word )
{
string base_URL = "http://www.bing.com/search?q=";
string search_URL = "dummy";
search_URL = base_URL + word;
cout << "Searching for: \"" << word << "\"\n";
ShellExecuteA(NULL, "open", search_URL.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
/// p.s. Its using WinAPI if i'm correct. So its not multiplatform solution.