Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Static text invisible on dialog

Status
Not open for further replies.

Mechy

Programmer
Sep 29, 2003
11
US
Hi,

I've searched the forum but coudn't find a post about this, sorry about reposting if there is any.

I am using Create and ShowWindow functions to show an "initializing..." window before my program runs. The problem is, the static text on the window is invisible although the window shows correctly.

Can anybody help? I found the answer on another forum but they want me to pay them... %-(

Mechy
 
You can show a dialog instead:
//Modeless dialog
HWND hDlg = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_MY_DLG), NULL, (DLGPROC)DlgMy_Proc, (LPARAM)NULL);
ShowWindow(hDlg, SW_SHOWNOACTIVATE);
RedrawWindow(hDlg, NULL, NULL, RDW_UPDATENOW); //To show texts
//Make inits You needs
if(IsWindow(hDlg))
DestroyWindow(hDlg); //Destroy it
Create IDD_MY_DLG with VC++ editor.
//Callback
BOOL CALLBACK DlgMy_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL ret = FALSE; //Not processed
switch(uMsg) {
case WM_INITDIALOG:
//Init here
break;
case WM_COMMAND:
//Work with buttons and menu
{
WORD wID = LOWORD(wParam);
switch(wID) {
case IDOK:
EndDialog(hDlg, (1));
break;
case IDCANCEL:
EndDialog(hDlg, (0));
break;
default:
break;
}
break;
}
case WM_SHOWWINDOW:
if(wParam) {
//You can init here too
}
break;
case WM_CLOSE:
case WM_DESTROY:
EndDialog(hDlg, (-1));
ret = TRUE; //Processed
default:
break;
}
return ret;
}
 
Thank you for your time tchouch. I think I found another solution. [thumbsup2]

Here is the code:

Code:
	m_dInitialDlg.Create(IDD_INITIALIZING_DIALOG,this);
	m_dInitialDlg.ShowWindow(SW_SHOW);

	CStatic *ptr;
	ptr = (CStatic*)m_dInitialDlg.GetDlgItem(IDC_LABEL1);
	ptr->ModifyStyle(0,WS_VISIBLE);
	m_dInitialDlg.UpdateWindow();

// Do other stuff...

	m_dInitialDlg.DestroyWindow();

This seems to work. Hope this helps other people also.

Mechy.
 
use ShowWindow to show or to hide any windows controls.
ShowWindow(yourControlWnd, SW_HIDE);//to hide
ShowWindow(yourControlWnd, SW_SHOW);//to show

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top