Beispiel #1
0
void MainInitDialog(HWND hWnd)
{
    // so external functions can reference it
    hThisWindow = hWnd;

    // Setup the icons
    SendMessage(hWnd, WM_SETICON, ICON_SMALL,
	(LPARAM) LoadImage(hThisInstance, "HUGS", IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CXSMICON), 0));
    SendMessage(hWnd, WM_SETICON, ICON_BIG,
	(LPARAM) LoadIcon(hThisInstance, "HUGS"));

    // Create the toolbar
    MainInitToolbar(hWnd);

    // Create the status bar
    CreateStatusWindow(WS_CHILD | WS_VISIBLE, "", hWnd, ID_STATUS);

    // Call the required init functions
    RtfWindowInit(GetDlgItem(hWnd, ID_RTF));
    MruInit();
    RegistryReadWindowPos(hWnd);
}
Beispiel #2
0
BOOL CreateWinGHCiMainWindow(INT nCmdShow)
{
	//hWndMain = CreateDialog(hThisInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, &MainWndProc);

	
	if (!RegisterWinGHCiWindowClass(hThisInstance) )
	{	
		ErrorExit(TEXT("Could not register WinGHCiWindowClass"));
		return FALSE;
	}

	hWndMain = CreateWindowEx(WS_EX_ACCEPTFILES,WinGHCiWindowClass, WinGHCiWindowTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hThisInstance, NULL);



	if (!hWndMain)
	{	
		ErrorExit(TEXT("CreateWinGHCiMainWindow"));
		return FALSE;
	}

    ShowWindow(hWndMain, nCmdShow);
    UpdateWindow(hWndMain);

	// Setup the icons
	SendMessage(hWndMain, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hThisInstance, MAKEINTRESOURCE(ID_GHCi_ICON)));	
	SendMessage(hWndMain, WM_SETICON, ICON_BIG,	(LPARAM) LoadIcon(hThisInstance, MAKEINTRESOURCE(ID_WinGHCi_ICON)));

	// Create status line
	hWndStatus = CreateWindowEx(
		0,                       
		STATUSCLASSNAME,        
		(LPCTSTR) TEXT(""),          
		WS_CHILD | SBARS_SIZEGRIP | WS_VISIBLE,               
		0, 0, 0, 0,              
		hWndMain,              
		(HMENU) IDC_Statusbar,      
		hThisInstance,                   
		NULL);                   


	// create rich edit control
	hWndRtf = CreateWindowEx(
		 WS_EX_CLIENTEDGE,
		 RICHEDIT_CLASS,        
		(LPCTSTR) TEXT(""),          
		WS_CHILD  | WS_VISIBLE | WS_VSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_DISABLENOSCROLL | ES_WANTRETURN,               
		0, 0, 0, 0,              
		hWndMain,              
		(HMENU) IDC_Rtf,      
		hThisInstance,                   
		NULL);   

	RtfWindowInit();
	SetFocus(hWndRtf);

	CreateToolbar();
	InitMruFiles();
	InitHistory();

	RegistryReadWindowPos(hWndMain);


	return TRUE;
}