This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma comment( lib,"Wininet.lib") | |
| bool Platform::internetConnected() { | |
| DWORD result; | |
| // Check if connected to the internet | |
| if ( InternetGetConnectedState(&result, 0)) { | |
| // Check if we can talk to icreatetoeducate.com | |
| if( InternetCheckConnection("http://icreatetoeducate.com", FLAG_ICC_FORCE_CONNECTION, 0) ) { | |
| return true; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool Platform::convertLPWToString(std::string& s, const LPWSTR pw, UINT codepage = CP_ACP) | |
| { | |
| bool res = false; | |
| char* p = 0; | |
| int bsz; | |
| bsz = WideCharToMultiByte(codepage, 0, pw,-1, 0,0,0,0); | |
| if (bsz > 0) { | |
| p = new char[bsz]; | |
| int rc = WideCharToMultiByte(codepage,0,pw,-1,p,bsz,0,0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool Platform::CopyFileToTrash( std::string file_path) { | |
| SHFILEOPSTRUCT FileOp; | |
| FileOp.hwnd = NULL; | |
| FileOp.wFunc=FO_DELETE; | |
| FileOp.pFrom= file_path.c_str(); | |
| FileOp.pTo = NULL; | |
| FileOp.fFlags=FOF_ALLOWUNDO|FOF_NOCONFIRMATION; | |
| FileOp.hNameMappings=NULL; | |
| int bRet=SHFileOperation(&FileOp); | |
| if( bRet != S_OK ) |