extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int nShowCmd) { INITCOMMONCONTROLSEX ctrl; //Required to use datetime picker controls. ctrl.dwSize = sizeof(ctrl); ctrl.dwICC = ICC_DATE_CLASSES|ICC_BAR_CLASSES; InitCommonControlsEx(&ctrl); g_strCmdLine = convertToStringA(lpCmdLine); _AtlModule.SetModuleInstance(hInstance); return _AtlModule.WinMain(nShowCmd); }
extern "C" void rho_sys_unset_http_proxy() { #if defined(OS_WINDOWS_DESKTOP) || defined(RHODES_EMULATOR) _AtlModule.GetAppWindow().setProxy(); #endif RHOCONF().removeProperty("http_proxy_host", false); RHOCONF().removeProperty("http_proxy_port", false); RHOCONF().removeProperty("http_proxy_login", false); RHOCONF().removeProperty("http_proxy_password", false); RAWLOG_INFO("Unsetting HTTP proxy"); }
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int nShowCmd) { INITCOMMONCONTROLSEX ctrl; #if defined(OS_WINCE) /*if(RhoBluetoothManager::LoadBthUtil()) winversion = 1; else winversion = 2;*/ LoadAYGShell(); LoadSoundDll(); #endif //Required to use datetime picker controls. ctrl.dwSize = sizeof(ctrl); ctrl.dwICC = ICC_DATE_CLASSES|ICC_BAR_CLASSES; InitCommonControlsEx(&ctrl); g_strCmdLine = convertToStringA(lpCmdLine); _AtlModule.SetModuleInstance(hInstance); return _AtlModule.WinMain(nShowCmd); }
extern "C" HWND getWebViewWnd(int index) { return _AtlModule.GetWebViewWindow(index); }
CMainWindow& getAppWindow() { return _AtlModule.GetAppWindow(); }
extern "C" HWND getMainWnd() { return _AtlModule.GetMainWindow(); }
extern "C" void rho_wm_impl_performOnUiThread(rho::common::IRhoRunnable* pTask) { CMainWindow* mainWnd = _AtlModule.GetMainWindowObject(); mainWnd->performOnUiThread(pTask); }
extern "C" HINSTANCE rho_wmimpl_get_appinstance() { return _AtlModule.GetModuleInstance(); }
extern "C" const char* rho_native_rhopath() { return _AtlModule.getRhoRootPath().c_str(); }
extern "C" char* get_current_location() { return _AtlModule.GetCurrentLocation(); }
extern "C" void webview_navigate(char* url, int index) { _AtlModule.DoViewNavigate(url); }
extern "C" void webview_refresh() { _AtlModule.DoViewRefresh(); }
extern "C" int WINAPI _tWinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpCmdLine*/, int nShowCmd) { return _AtlModule.WinMain(nShowCmd); }
extern "C" char* rho_sys_get_locale() { return const_cast<char*>(_AtlModule.getCurrentLocale()); }
extern "C" void rho_conf_show_log() { _AtlModule.DoShowLog(); }
CMainWindow* Rhodes_getMainWindow() { return _AtlModule.GetMainWindowObject(); }
extern "C" const char* rho_native_get_appname() { return _AtlModule.getAppName().c_str(); }
void parseHttpProxyURI(const rho::String &http_proxy) { // http://<login>:<passwod>@<host>:<port> const char *default_port = "8080"; if (http_proxy.length() == 0) rho_sys_unset_http_proxy(); if (http_proxy.length() < 8) { RAWLOG_ERROR("invalid http proxy url"); return; } int index = http_proxy.find("http://", 0, 7); if (index == string::npos) { RAWLOG_ERROR("http proxy url should starts with \"http://\""); return; } index = 7; enum { ST_START, ST_LOGIN, ST_PASSWORD, ST_HOST, ST_PORT, ST_FINISH }; String token, login, password, host, port; char c, state = ST_START, prev_state = state; int length = http_proxy.length(); for (int i = index; i < length; i++) { c = http_proxy[i]; switch (state) { case ST_START: if (c == '@') { prev_state = state; state = ST_HOST; } else if (c == ':') { prev_state = state; state = ST_PASSWORD; } else { token +=c; state = ST_HOST; } break; case ST_HOST: if (c == ':') { host = token; token.clear(); prev_state = state; state = ST_PORT; } else if (c == '@') { host = token; token.clear(); prev_state = state; state = ST_LOGIN; } else { token += c; if (i == (length - 1)) { host = token; token.clear(); } } break; case ST_PORT: if (c == '@') { port = token; token.clear(); prev_state = state; state = ST_LOGIN; } else { token += c; if (i == (length - 1)) { port = token; token.clear(); } } break; case ST_LOGIN: if (prev_state == ST_PORT || prev_state == ST_HOST) { login = host; host.clear(); password = port; port.clear(); prev_state = state; state = ST_HOST; token += c; } else { token += c; if (i == (length - 1)) { login = token; token.clear(); } } break; case ST_PASSWORD: if (c == '@') { password = token; token.clear(); prev_state = state; state = ST_HOST; } else { token += c; if (i == (length - 1)) { password = token; token.clear(); } } break; default: ; } } RAWLOG_INFO("Setting up HTTP proxy:"); RAWLOG_INFO1("URI: %s", http_proxy.c_str()); RAWLOG_INFO1("HTTP proxy login = %s", login.c_str()); RAWLOG_INFO1("HTTP proxy password = %s", password.c_str()); RAWLOG_INFO1("HTTP proxy host = %s", host.c_str()); RAWLOG_INFO1("HTTP proxy port = %s", port.c_str()); if (host.length()) { #if defined(OS_WINDOWS_DESKTOP) || defined(RHODES_EMULATOR) _AtlModule.GetAppWindow().setProxy(host, port, login, password); #endif RHOCONF().setString ("http_proxy_host", host, false); if (port.length()){ RHOCONF().setString ("http_proxy_port", port, false); } else { RAWLOG_WARNING("there is no proxy port defined"); } if (login.length()) RHOCONF().setString ("http_proxy_login", login, false); if (password.length()) RHOCONF().setString ("http_proxy_password", password, false); } else { RAWLOG_ERROR("empty host name in HTTP-proxy URL"); } }
extern "C" const char* rho_native_reruntimepath() { return _AtlModule.getRhoRuntimePath().c_str(); }
// This method is called immediately before entering the message loop. // It contains initialization code for the application. // Returns: // S_OK => Success. Continue with RunMessageLoop() and PostMessageLoop(). // S_FALSE => Skip RunMessageLoop(), call PostMessageLoop(). // error code => Failure. Skip both RunMessageLoop() and PostMessageLoop(). HRESULT CRhodesModule::PreMessageLoop(int nShowCmd) throw() { HRESULT hr = __super::PreMessageLoop(nShowCmd); if (FAILED(hr)) { return hr; } // Note: In this sample, we don't respond differently to different hr success codes. #if !defined(OS_WINDOWS_DESKTOP) SetLastError(0); HANDLE hEvent = CreateEvent( NULL, false, false, CMainWindow::GetWndClassInfo().m_wc.lpszClassName ); if ( !m_bRestarting && hEvent != NULL && GetLastError() == ERROR_ALREADY_EXISTS) { // Rho Running so could bring to foreground HWND hWnd = FindWindow(CMainWindow::GetWndClassInfo().m_wc.lpszClassName, NULL); if (hWnd) { ShowWindow(hWnd, SW_SHOW); SendMessage( hWnd, PB_WINDOW_RESTORE, NULL, TRUE); SetForegroundWindow( hWnd ); COPYDATASTRUCT cds = {0}; cds.cbData = m_strTabName.length()+1; cds.lpData = (char*)m_strTabName.c_str(); SendMessage( hWnd, WM_COPYDATA, (WPARAM)WM_WINDOW_SWITCHTAB, (LPARAM)(LPVOID)&cds); } return S_FALSE; } #endif if ( !rho_sys_check_rollback_bundle(rho_native_rhopath()) ) { rho_sys_impl_exit_with_errormessage( "Bundle update", "Application is corrupted. Reinstall it, please."); return S_FALSE; } #if defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME) rho_logconf_Init((rho_wmimpl_get_logpath()[0]==0 ? m_strRootPath.c_str() : rho_wmimpl_get_logpath()), m_strRootPath.c_str(), m_logPort.c_str()); if (rho_wmimpl_get_logurl()[0]!=0) LOGCONF().setLogURL(rho_wmimpl_get_logurl()); if (rho_wmimpl_get_logmaxsize()) LOGCONF().setMaxLogFileSize(*rho_wmimpl_get_logmaxsize()); if (rho_wmimpl_get_loglevel()) LOGCONF().setMinSeverity(*rho_wmimpl_get_loglevel()); if (rho_wmimpl_get_fullscreen()) RHOCONF().setBool("full_screen", true, false); if (rho_wmimpl_get_logmemperiod()) LOGCONF().setCollectMemoryInfoInterval(*rho_wmimpl_get_logmemperiod()); #else rho_logconf_Init(m_strRootPath.c_str(), m_strRootPath.c_str(), m_logPort.c_str()); #endif // APP_BUILD_CAPABILITY_SHARED_RUNTIME LOGCONF().setMemoryInfoCollector(CLogMemory::getInstance()); #ifdef RHODES_EMULATOR RHOSIMCONF().setAppConfFilePath(CFilePath::join( m_strRootPath, RHO_EMULATOR_DIR"/rhosimconfig.txt").c_str()); RHOSIMCONF().loadFromFile(); if ( m_strRhodesPath.length() > 0 ) RHOSIMCONF().setString("rhodes_path", m_strRhodesPath, false ); RHOCONF().setString("rhosim_platform", RHOSIMCONF().getString("platform"), false); RHOCONF().setString("app_version", RHOSIMCONF().getString("app_version"), false); String start_path = RHOSIMCONF().getString("start_path"); if ( start_path.length() > 0 ) RHOCONF().setString("start_path", start_path, false); RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/debugger;"), false); RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/uri;"), false); RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/timeout;"), false); RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/digest;"), false); RHOSIMCONF().setString("ext_path", RHOSIMCONF().getString("ext_path") + CFilePath::join( m_strRhodesPath, "/lib/extensions/openssl;"), false); #endif if ( !rho_rhodesapp_canstartapp(g_strCmdLine.c_str(), " /-,") ) { LOG(INFO) + "This is hidden app and can be started only with security key."; if (RHOCONF().getString("invalid_security_token_start_path").length() <= 0) { #ifdef OS_WINDOWS_DESKTOP ::MessageBoxW(0, L"This is hidden app and can be started only with security key.", L"Security Token Verification Failed", MB_ICONERROR | MB_OK); #endif return S_FALSE; } } LOG(INFO) + "Rhodes started"; #ifdef OS_WINDOWS_DESKTOP if (m_strHttpProxy.length() > 0) { parseHttpProxyURI(m_strHttpProxy); } else #endif { if (RHOCONF().isExist("http_proxy_url")) { parseHttpProxyURI(RHOCONF().getString("http_proxy_url")); #if defined(OS_WINDOWS_DESKTOP) || defined(RHODES_EMULATOR) } else { // it's important to call this method from here to perform // a proper initialization of proxy implementation for Win32 GetAppWindow().setProxy(); #endif } } #ifdef RHODES_EMULATOR if (RHOSIMCONF().getString("debug_host").length() > 0) SetEnvironmentVariableA("RHOHOST", RHOSIMCONF().getString("debug_host").c_str() ); if (RHOSIMCONF().getString("debug_port").length() > 0) SetEnvironmentVariableA("rho_debug_port", RHOSIMCONF().getString("debug_port").c_str() ); #endif //Check for bundle directory is exists. HANDLE hFind; WIN32_FIND_DATA wfd; // rootpath + "rho/" if (m_strRootPath.at(m_strRootPath.length()-1) == '/') { hFind = FindFirstFile(convertToStringW(m_strRootPath.substr(0, m_strRootPath.find_last_of('/'))).c_str(), &wfd); } else if (m_strRootPath.at(m_strRootPath.length()-1) == '\\') { //delete all '\' from the end of the pathname int i = m_strRootPath.length(); for ( ; i != 1; i--) { if (m_strRootPath.at(i-1) != '\\') break; } hFind = FindFirstFile(convertToStringW(m_strRootPath.substr(0, i)).c_str(), &wfd); } if (INVALID_HANDLE_VALUE == hFind || !(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { int last = 0, pre_last = 0; last = getRhoRootPath().find_last_of('\\'); pre_last = getRhoRootPath().substr(0, last).find_last_of('\\'); String appName = getRhoRootPath().substr(pre_last + 1, last - pre_last - 1); String messageText = "Bundle directory \"" + m_strRootPath.substr(0, m_strRootPath.find_last_of('/')) + "\" is missing\n"; LOG(INFO) + messageText; int msgboxID = MessageBox(NULL, convertToStringW(messageText).c_str(), convertToStringW(appName).c_str(), MB_ICONERROR | MB_OK); return S_FALSE; } if (RHOCONF().getBool("Application.autoStart")) createAutoStartShortcut(); rho::common::CRhodesApp::Create(m_strRootPath, m_strRootPath, m_strRuntimePath); bool bRE1App = false; #if defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME) if (!rho_wmimpl_get_is_version2()) bRE1App = true; #endif RHODESAPP().setJSApplication(bRE1App || _AtlModule.isJSApplication()); #if defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME) if ((!rho_wmimpl_get_is_version2()) && (rho_wmimpl_get_startpage()[0] != 0)) { String spath = convertToStringA(rho_wmimpl_get_startpage()); RHOCONF().setString("start_path", spath, false); } #endif // APP_BUILD_CAPABILITY_SHARED_RUNTIME DWORD dwStyle = m_bMinimized ? 0 : WS_VISIBLE; #ifdef OS_WINCE m_appWindow.getTabbar().SetStartTabName(m_strTabName); #else m_appWindow.setStartTabName(m_strTabName); #endif #if !defined(_WIN32_WCE) dwStyle |= WS_OVERLAPPEDWINDOW; #endif // Create the main application window #if defined(OS_WINDOWS_DESKTOP) #ifdef RHODES_EMULATOR StringW windowTitle = convertToStringW(RHOSIMCONF().getString("app_name")); #else StringW windowTitle = convertToStringW(RHODESAPP().getAppTitle()); #endif m_appWindow.Initialize(windowTitle.c_str()); if (NULL == m_appWindow.m_hWnd) { return S_FALSE; } if (m_bMinimized) nShowCmd = SW_MINIMIZE; m_appWindow.ShowWindow(nShowCmd); #else String strTitle = RHODESAPP().getAppTitle(); m_appWindow.Create(NULL, CWindow::rcDefault, convertToStringW(strTitle).c_str(), dwStyle); if (NULL == m_appWindow.m_hWnd) { return S_FALSE; } m_appWindow.InvalidateRect(NULL, TRUE); m_appWindow.UpdateWindow(); m_appWindow.initBrowserWindow(); if (m_bMinimized) m_appWindow.ShowWindow(SW_MINIMIZE); #endif /* if (bRE1App) { #if defined(APP_BUILD_CAPABILITY_MOTOROLA) registerRhoExtension(); #endif #if !defined( APP_BUILD_CAPABILITY_WEBKIT_BROWSER ) && defined(OS_WINCE) m_appWindow.Navigate2(_T("about:blank"), -1 ); #endif //!APP_BUILD_CAPABILITY_WEBKIT_BROWSER rho_webview_navigate(RHOCONF().getString("start_path").c_str(), 0 ); } else { */ RHODESAPP().startApp(); #if !defined( APP_BUILD_CAPABILITY_WEBKIT_BROWSER ) && defined(OS_WINCE) // Navigate to the "loading..." page m_appWindow.Navigate2(_T("about:blank"), -1 ); #endif //APP_BUILD_CAPABILITY_WEBKIT_BROWSER //} #if defined(_WIN32_WCE)&& !defined( OS_PLATFORM_MOTCE ) DWORD dwConnCount = 0; hr = RegistryGetDWORD( SN_CONNECTIONSNETWORKCOUNT_ROOT, SN_CONNECTIONSNETWORKCOUNT_PATH, SN_CONNECTIONSNETWORKCOUNT_VALUE, &dwConnCount ); rho_sysimpl_sethas_network((dwConnCount > 1) ? 1 : 0); DWORD dwCellConnected = 0; hr = RegistryGetDWORD( SN_CONNECTIONSNETWORKCOUNT_ROOT, SN_CELLSYSTEMCONNECTED_PATH, SN_CELLSYSTEMCONNECTED_VALUE, &dwCellConnected ); rho_sysimpl_sethas_cellnetwork(dwCellConnected); // Register for changes in the number of network connections hr = RegistryNotifyWindow(SN_CONNECTIONSNETWORKCOUNT_ROOT, SN_CONNECTIONSNETWORKCOUNT_PATH, SN_CONNECTIONSNETWORKCOUNT_VALUE, m_appWindow.m_hWnd, WM_CONNECTIONSNETWORKCOUNT, 0, NULL, &g_hNotify); hr = RegistryNotifyWindow(SN_CONNECTIONSNETWORKCOUNT_ROOT, SN_CELLSYSTEMCONNECTED_PATH, SN_CELLSYSTEMCONNECTED_VALUE, m_appWindow.m_hWnd, WM_CONNECTIONSNETWORKCELL, 0, NULL, &g_hNotifyCell); #endif return S_OK; }
extern "C" HWND rho_wmimpl_get_mainwnd() { return _AtlModule.GetMainWindow(); }
// This method is called immediately before entering the message loop. // It contains initialization code for the application. // Returns: // S_OK => Success. Continue with RunMessageLoop() and PostMessageLoop(). // S_FALSE => Skip RunMessageLoop(), call PostMessageLoop(). // error code => Failure. Skip both RunMessageLoop() and PostMessageLoop(). HRESULT CRhodesModule::PreMessageLoop(int nShowCmd) throw() { HRESULT hr; /*HRESULT hr = __super::PreMessageLoop(nShowCmd); if (FAILED(hr)) { return hr; }*/ // Note: In this sample, we don't respond differently to different hr success codes. //SetLastError(0); // HANDLE hEvent = CreateEvent( NULL, false, false, CMainWindow::GetWndClassInfo().m_wc.lpszClassName ); // if ( !m_bRestarting && hEvent != NULL && GetLastError() == ERROR_ALREADY_EXISTS) //{ // Rho Running so could bring to foreground // HWND hWnd = FindWindow(CMainWindow::GetWndClassInfo().m_wc.lpszClassName, NULL); //if (hWnd) //{ // ShowWindow(hWnd, SW_SHOW); //SendMessage( hWnd, PB_WINDOW_RESTORE, NULL, TRUE); //SetForegroundWindow( hWnd ); //COPYDATASTRUCT cds = {0}; //cds.cbData = m_strTabName.length()+1; //cds.lpData = (char*)m_strTabName.c_str(); //SendMessage( hWnd, WM_COPYDATA, (WPARAM)WM_WINDOW_SWITCHTAB, (LPARAM)(LPVOID)&cds); //} //return S_FALSE; //} if ( !rho_sys_check_rollback_bundle(rho_native_rhopath()) ) { rho_sys_impl_exit_with_errormessage( "Bundle update", "Application is corrupted. Reinstall it, please."); return S_FALSE; } #if defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME) rho_logconf_Init((rho_wmimpl_get_logpath()[0]==0 ? m_strRootPath.c_str() : rho_wmimpl_get_logpath()), m_strRootPath.c_str(), m_logPort.c_str()); if (rho_wmimpl_get_logurl()[0]!=0) { LOGCONF().setLogURL(rho_wmimpl_get_logurl()); LOGCONF().setLogToSocket(true); } if (rho_wmimpl_get_logmaxsize()) LOGCONF().setMaxLogFileSize(*rho_wmimpl_get_logmaxsize()); if (rho_wmimpl_get_loglevel()) LOGCONF().setMinSeverity(*rho_wmimpl_get_loglevel()); if (rho_wmimpl_get_fullscreen()) RHOCONF().setBool("full_screen", true, false); if (rho_wmimpl_get_logmemperiod()) LOGCONF().setCollectMemoryInfoInterval(*rho_wmimpl_get_logmemperiod()); //SR EMBPD00121468 //Network api via proxy is not working with proxy enable using config.xml //Sabir: The values were getting set from rhoconfig.txt from function rho_logconf_Init //fix: we have to override http_proxy_host using config.xml value rho::String szHttpProxy = rho_wmimpl_get_httpproxy(); parseHttpProxyURI(szHttpProxy); #else rho_logconf_Init(m_strRootPath.c_str(), m_strRootPath.c_str(), m_logPort.c_str()); #endif // APP_BUILD_CAPABILITY_SHARED_RUNTIME SetLastError(0); HANDLE hEvent = CreateEvent( NULL, false, false, CMainWindow::GetWndClassInfo().m_wc.lpszClassName ); if ( !m_bRestarting && hEvent != NULL && GetLastError() == ERROR_ALREADY_EXISTS) { // Rho Running so could bring to foreground HWND hWnd = FindWindow(CMainWindow::GetWndClassInfo().m_wc.lpszClassName, NULL); if (hWnd) { ShowWindow(hWnd, SW_SHOW); SendMessage( hWnd, PB_WINDOW_RESTORE, NULL, TRUE); SetForegroundWindow( hWnd ); COPYDATASTRUCT cds = {0}; cds.cbData = m_strTabName.length()+1; cds.lpData = (char*)m_strTabName.c_str(); SendMessage( hWnd, WM_COPYDATA, (WPARAM)WM_WINDOW_SWITCHTAB, (LPARAM)(LPVOID)&cds); } return S_FALSE; } LOGCONF().setMemoryInfoCollector(CLogMemory::getInstance()); if ( !rho_rhodesapp_canstartapp(g_strCmdLine.c_str(), " /-,") ) { LOG(INFO) + "This is hidden app and can be started only with security key."; if (RHOCONF().getString("invalid_security_token_start_path").length() <= 0) { return S_FALSE; } } LOG(INFO) + "Rhodes started"; if (RHOCONF().isExist("http_proxy_url")) { parseHttpProxyURI(RHOCONF().getString("http_proxy_url")); } else if (RHOCONF().isExist("http_proxy_uri")) { parseHttpProxyURI(RHOCONF().getString("http_proxy_uri")); } //Check for bundle directory is exists. HANDLE hFind; WIN32_FIND_DATA wfd; // rootpath + "rho/" if (m_strRootPath.at(m_strRootPath.length()-1) == '/') { hFind = FindFirstFile(convertToStringW(m_strRootPath.substr(0, m_strRootPath.find_last_of('/'))).c_str(), &wfd); } else if (m_strRootPath.at(m_strRootPath.length()-1) == '\\') { //delete all '\' from the end of the pathname int i = m_strRootPath.length(); for ( ; i != 1; i--) { if (m_strRootPath.at(i-1) != '\\') break; } hFind = FindFirstFile(convertToStringW(m_strRootPath.substr(0, i)).c_str(), &wfd); } if (INVALID_HANDLE_VALUE == hFind || !(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { int last = 0, pre_last = 0; last = getRhoRootPath().find_last_of('\\'); pre_last = getRhoRootPath().substr(0, last).find_last_of('\\'); String appName = getRhoRootPath().substr(pre_last + 1, last - pre_last - 1); String messageText = "Bundle directory \"" + m_strRootPath.substr(0, m_strRootPath.find_last_of('/')) + "\" is missing\n"; LOG(INFO) + messageText; int msgboxID = MessageBox(NULL, convertToStringW(messageText).c_str(), convertToStringW(appName).c_str(), MB_ICONERROR | MB_OK); return S_FALSE; } createPowerManagementThread(); if (RHOCONF().getBool("Application.autoStart")) createAutoStartShortcut(); #if defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME) if ((!rho_wmimpl_get_is_version2()) && (rho_wmimpl_get_startpage()[0] != 0)) { String spath = convertToStringA(rho_wmimpl_get_startpage()); RHOCONF().setString("start_path", spath, false); } #endif // APP_BUILD_CAPABILITY_SHARED_RUNTIME rho::common::CRhodesApp::Create(m_strRootPath, m_strRootPath, m_strRuntimePath); set_bridge_direct_callback(); bool bRE1App = false; #if defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME) if (!rho_wmimpl_get_is_version2()) bRE1App = true; #endif RHODESAPP().setJSApplication(bRE1App || _AtlModule.isJSApplication()); DWORD dwStyle = m_bMinimized ? 0 : WS_VISIBLE; #ifdef OS_WINCE m_appWindow.getTabbar().SetStartTabName(m_strTabName); #else m_appWindow.setStartTabName(m_strTabName); #endif #if !defined(_WIN32_WCE) dwStyle |= WS_OVERLAPPEDWINDOW; #endif // Create the main application window String strTitle = RHODESAPP().getAppTitle(); m_appWindow.Create(NULL, CWindow::rcDefault, convertToStringW(strTitle).c_str(), dwStyle); if (NULL == m_appWindow.m_hWnd) { return S_FALSE; } m_appWindow.InvalidateRect(NULL, TRUE); m_appWindow.SetActiveWindow(); // Enterprise Browser was failing to launch maximimized through a shortcut, this line ensures it launches maximised m_appWindow.UpdateWindow(); #if defined(APP_BUILD_CAPABILITY_SYMBOL) initialiseRhoElementsExt(); #endif m_appWindow.initBrowserWindow(); if (m_bMinimized) m_appWindow.ShowWindow(SW_MINIMIZE); /* if (bRE1App) { #if defined(APP_BUILD_CAPABILITY_SYMBOL) registerRhoExtension(); #endif #if !defined( APP_BUILD_CAPABILITY_WEBKIT_BROWSER ) && defined(OS_WINCE) m_appWindow.Navigate2(_T("about:blank"), -1 ); #endif //!APP_BUILD_CAPABILITY_WEBKIT_BROWSER rho_webview_navigate(RHOCONF().getString("start_path").c_str(), 0 ); } else { */ RHODESAPP().startApp(); #if !defined( APP_BUILD_CAPABILITY_WEBKIT_BROWSER ) && defined(OS_WINCE) // Navigate to the "loading..." page m_appWindow.Navigate2(_T("about:blank"), -1 ); #endif //APP_BUILD_CAPABILITY_WEBKIT_BROWSER //} #if defined(_WIN32_WCE) if(RHO_IS_WMDEVICE) { DWORD dwConnCount = 0; hr = lpfn_Registry_GetDWORD( SN_CONNECTIONSNETWORKCOUNT_ROOT, SN_CONNECTIONSNETWORKCOUNT_PATH, SN_CONNECTIONSNETWORKCOUNT_VALUE, &dwConnCount ); rho_sysimpl_sethas_network((dwConnCount > 1) ? 1 : 0); DWORD dwCellConnected = 0; hr = lpfn_Registry_GetDWORD( SN_CONNECTIONSNETWORKCOUNT_ROOT, SN_CELLSYSTEMCONNECTED_PATH, SN_CELLSYSTEMCONNECTED_VALUE, &dwCellConnected ); rho_sysimpl_sethas_cellnetwork(dwCellConnected); // Register for changes in the number of network connections hr = lpfn_Registry_NotifyWindow(SN_CONNECTIONSNETWORKCOUNT_ROOT, SN_CONNECTIONSNETWORKCOUNT_PATH, SN_CONNECTIONSNETWORKCOUNT_VALUE, m_appWindow.m_hWnd, WM_CONNECTIONSNETWORKCOUNT, 0, NULL, &g_hNotify); hr = lpfn_Registry_NotifyWindow(SN_CONNECTIONSNETWORKCOUNT_ROOT, SN_CELLSYSTEMCONNECTED_PATH, SN_CELLSYSTEMCONNECTED_VALUE, m_appWindow.m_hWnd, WM_CONNECTIONSNETWORKCELL, 0, NULL, &g_hNotifyCell); } #endif return S_OK; }