Click here to Skip to main content
15,899,314 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Progress Bar not worked well with larger values? PinPopular
enhzflep14-Apr-12 3:04
enhzflep14-Apr-12 3:04 
GeneralRe: Progress Bar not worked well with larger values? Pin
Le@rner16-Apr-12 18:55
Le@rner16-Apr-12 18:55 
GeneralRe: Progress Bar not worked well with larger values? Pin
enhzflep16-Apr-12 20:54
enhzflep16-Apr-12 20:54 
AnswerRe: Progress Bar not worked well with larger values? Pin
Maximilien14-Apr-12 3:34
Maximilien14-Apr-12 3:34 
QuestionCreateWindowEx, DestroyWindow, CreateWindowEx Pin
jkirkerx13-Apr-12 10:31
professionaljkirkerx13-Apr-12 10:31 
AnswerThat was just a bad idea - went back to hide and show Pin
jkirkerx13-Apr-12 12:28
professionaljkirkerx13-Apr-12 12:28 
AnswerRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
Binu MD16-Apr-12 21:22
Binu MD16-Apr-12 21:22 
GeneralRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
jkirkerx17-Apr-12 7:12
professionaljkirkerx17-Apr-12 7:12 
It turned out to be a big mess. The Bool bRegister was a unsuccessful attempt to unregister the class after it was created. I thought if I could create the class, create the window, that I could destroy the window, and unregister the class to create a clean slate, and start the process again.

On the 2nd time around, the window would paint, but it would not respond. When I took the other toolbar and dragged it across the regenerated toolbar, the regenerated toolbar would not paint again and dissappear. So I added the WS_CLIPSIBLINGS, and upon regeneration, no window at all.

So I went back to show and hide, and added a return 1 to the WM_CLOSE in the Windows Proc, to cancel destroying the window, and to just run ShowWindow and update the checkbox in the main menu.


HWND _project_Explorer_Create( HWND hWndMain, HINSTANCE hInstance, HWND hMDIClientArea, HWND hWndStatusBar )
{
	
	hProjectExplorer_Instance = hInstance;
	LoadString( hInstance, IDM_PROJECT_EXPLORER_CLASS, sz_ProjectExplorer_Class, MAX_LOADSTRING );

	//BOOL bRegister = FALSE;
	//bRegister = UnregisterClass( sz_ProjectExplorer_Class, hInstance );
	//DWORD dwErrorCode = GetLastError();
		
	WNDCLASSEX toolWindow;
	toolWindow.cbSize = sizeof(WNDCLASSEX);

	if ( !GetClassInfoEx( hInstance, sz_ProjectExplorer_Class, &toolWindow ) ) {
	
		toolWindow.style		= CS_HREDRAW | CS_VREDRAW;
		toolWindow.lpfnWndProc		= _project_Explorer_WndProc;
		toolWindow.cbClsExtra		= 0;
		toolWindow.cbWndExtra		= 0;
		toolWindow.hInstance		= hInstance;
		toolWindow.hIcon		= 0;
		toolWindow.hCursor		= 0;
		toolWindow.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);
		toolWindow.lpszMenuName		= 0;
		toolWindow.lpszClassName	= sz_ProjectExplorer_Class;
		toolWindow.hIconSm              = 0;

		RegisterClassEx( &toolWindow );

	}
									
	RECT winRect, statusBarRect;
	INT winWidth, winHeight, tbWidth, tbHeight, sbWidth, sbHeight;	
	
	if(GetWindowRect( hMDIClientArea, &winRect)) {
		winWidth = winRect.right - winRect.left;
		winHeight = winRect.bottom - winRect.top;

		GetWindowRect( hWndStatusBar, &statusBarRect );
		sbWidth = statusBarRect.right - statusBarRect.left;
		sbHeight = statusBarRect.bottom - statusBarRect.top;
						
		tbWidth = 250;
		tbHeight = (INT)floor(( (float)winHeight * (float).60 ) - 1 );		
		
		// Create the Project Explorer Window
		hWnd_ProjectExplorer = CreateWindowEx(
			WS_EX_TOOLWINDOW,
			sz_ProjectExplorer_Class,
			TEXT( "Project Explorer" ),
			WS_CHILD | WS_SYSMENU | WS_CAPTION | WS_VISIBLE | WS_CLIPSIBLINGS,
			winWidth - tbWidth - 1, 1,
			tbWidth, tbHeight, 
			hWndMain, 
			NULL, 
			GetModuleHandle(0),
			NULL
		);		

		ShowWindow( hWnd_ProjectExplorer, SW_SHOW);
		UpdateWindow( hWndMain );		
	}	
	return hWnd_ProjectExplorer;
}

GeneralRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
Binu MD17-Apr-12 14:59
Binu MD17-Apr-12 14:59 
GeneralRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
jkirkerx17-Apr-12 15:49
professionaljkirkerx17-Apr-12 15:49 
AnswerRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
JohnCz25-Apr-12 1:29
JohnCz25-Apr-12 1:29 
GeneralRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
jkirkerx25-Apr-12 6:05
professionaljkirkerx25-Apr-12 6:05 
Questionhow is boost_scoped_ptr RAII ? Pin
elelont213-Apr-12 6:56
elelont213-Apr-12 6:56 
AnswerRe: how is boost_scoped_ptr RAII ? Pin
Chris Losinger13-Apr-12 10:33
professionalChris Losinger13-Apr-12 10:33 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
Aescleal14-Apr-12 9:56
Aescleal14-Apr-12 9:56 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
elelont223-May-12 4:36
elelont223-May-12 4:36 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
Chris Losinger23-May-12 4:55
professionalChris Losinger23-May-12 4:55 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
elelont223-May-12 7:22
elelont223-May-12 7:22 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
Chris Losinger23-May-12 7:29
professionalChris Losinger23-May-12 7:29 
AnswerRe: how is boost_scoped_ptr RAII ? Pin
Aescleal14-Apr-12 9:54
Aescleal14-Apr-12 9:54 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
elelont25-Jul-12 5:14
elelont25-Jul-12 5:14 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
elelont214-Jun-13 3:32
elelont214-Jun-13 3:32 
QuestionHow to use the c++ to connect sql server 2005? Pin
yu-jian12-Apr-12 21:16
yu-jian12-Apr-12 21:16 
AnswerRe: How to use the c++ to connect sql server 2005? Pin
Richard MacCutchan12-Apr-12 21:19
mveRichard MacCutchan12-Apr-12 21:19 
GeneralRe: How to use the c++ to connect sql server 2005? Pin
JosephvObrien12-Apr-12 23:55
JosephvObrien12-Apr-12 23:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.