CGh0stApp::CGh0stApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance // 初始化本进程的图像列表, 为加载系统图标列表做准备 typedef BOOL (WINAPI * pfn_FileIconInit) (BOOL fFullInit); pfn_FileIconInit FileIconInit = (pfn_FileIconInit) GetProcAddress(LoadLibrary("shell32.dll"), (LPCSTR)660); FileIconInit(TRUE); HANDLE hFile = CreateFile("QQwry.dat", 0, 0, NULL, OPEN_EXISTING, 0, NULL); if (hFile != INVALID_HANDLE_VALUE) { m_bIsQQwryExist = true; } else { m_bIsQQwryExist = false; } CloseHandle(hFile); m_bIsDisablePopTips = m_IniFile.GetInt("Settings", "PopTips", false); m_pConnectView = NULL; }
static INT StartWithDesktop(IN HINSTANCE hInstance) { InitializeAtlModule(hInstance, TRUE); if (RegOpenKeyW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer", &hkExplorer) != ERROR_SUCCESS) { WCHAR Message[256]; LoadStringW(hInstance, IDS_STARTUP_ERROR, Message, _countof(Message)); MessageBox(NULL, Message, NULL, MB_ICONERROR); return 1; } hExplorerInstance = hInstance; hProcessHeap = GetProcessHeap(); g_TaskbarSettings.Load(); InitCommonControls(); OleInitialize(NULL); #if !WIN7_COMPAT_MODE /* Initialize shell dde support */ _ShellDDEInit(TRUE); #endif /* Initialize shell icons */ FileIconInit(TRUE); /* Initialize CLSID_ShellWindows class */ _WinList_Init(); CComPtr<ITrayWindow> Tray; CreateTrayWindow(&Tray); #if !WIN7_DEBUG_MODE /* This not only hides the minimized window captions in the bottom left screen corner, but is also needed in order to receive HSHELL_* notification messages (which are required for taskbar buttons to work right) */ HideMinimizedWindows(TRUE); HANDLE hShellDesktop = NULL; if (Tray != NULL) hShellDesktop = DesktopCreateWindow(Tray); /* WinXP: Notify msgina to hide the welcome screen */ if (!SetShellReadyEvent(L"msgina: ShellReadyEvent")) SetShellReadyEvent(L"Global\\msgina: ShellReadyEvent"); if (DoStartStartupItems(Tray)) { ProcessStartupItems(); DoFinishStartupItems(); } #endif if (Tray != NULL) { TrayMessageLoop(Tray); #if !WIN7_DEBUG_MODE HideMinimizedWindows(FALSE); #endif } #if !WIN7_DEBUG_MODE if (hShellDesktop != NULL) DesktopDestroyShellWindow(hShellDesktop); #endif OleUninitialize(); RegCloseKey(hkExplorer); hkExplorer = NULL; InitializeAtlModule(hInstance, FALSE); return 0; }