Exemplo n.º 1
0
bool Window::CreateEx(DWORD dwExStyle,
                      LPCTSTR lpszClass, LPCTSTR lpszName,
                      DWORD dwStyle,
                      int x, int y,
                      int nWidth, int nHeight,
                      HWND hParent, HMENU hMenu, HINSTANCE hInstance)
{
    if (!RegClass(lpszClass, hInstance))
    {
        return false;
    }

    MDICREATESTRUCT mdic;
    memset(&mdic, 0, sizeof(mdic));
    mdic.lParam = (LPARAM)this;


    hWnd = CreateWindowEx(dwExStyle,
                            lpszClass, lpszName,
                            dwStyle,
                            x, y, nWidth, nHeight,
                            hParent, hMenu, hInstance, &mdic);

    return (hWnd != NULL);
}
Exemplo n.º 2
0
BOOL CDeleteMasterApp::InitInstance()
{
//	LOGFONT		lf;
	HANDLE		hMapping;
	BOOL		bPrevInstance = FALSE;
	CString		csError,csCaption;

	csCaption.LoadString (IDS_DM_ERROR);

	hMapping = CreateFileMapping((HANDLE)0xffffffff, NULL, PAGE_READONLY, 0, 32, _T("YGDM2003MAP"));
	if(hMapping)
	{
		if( GetLastError() == ERROR_ALREADY_EXISTS )
			bPrevInstance = TRUE;
	}
	else
	{
		// Some other error; handle error.
		csError.LoadString(IDS_APP_INIT_ERR);
		::MessageBox(NULL,csError,csCaption,MB_OK|MB_ICONSTOP);
		ExitProcess(1);
	}

	if(!bPrevInstance)
	{
		if(!IsUserAdmin())
		{
			csError.LoadString(IDS_NOT_ADMIN);
			::MessageBox(NULL,csError,csCaption,MB_OK|MB_ICONSTOP);
    		return FALSE;
		}
		if(!RegClass())	return FALSE;

		g_imgList_BOX.Create(IDB_BOX,16,0,RGB(255,255,255));
		g_imgList_LIST.Create(IDB_LIST,16,0,RGB(255,255,255));
		g_pFixDiskInfo = NULL;
		g_nDelMothed   = 0;
		g_nWipeMothed  = 0;
		g_bVerify	   = FALSE;
		g_bFormat	   = FALSE;
		g_dwMaxTry	   = 10;

		m_pMainWnd = new CMain();
		m_pMainWnd->ShowWindow(SW_SHOW);
	}
	return TRUE;
}