   Weird static control/dialog box issue...
  I am having some trouble with static text in dialog boxes under Windows. If I use CreateDialog with a pointer to a dialog proc or if I use DialogBox I get this:(Wrong)However, if I use CreateDialog with NULL in place of the dialog proc, I get this:(Correct)I'm going to need a dialog proc. Why is this happening and how do I stop it? There should not be a white box behind the text. I've scoured MSDN, but there is no mention of this. There is precious little information available on the static text control period.Any ideas?   
  Well, show your dialog proc code. You're probably returning TRUE when you should be returning false for WM_ERASEBKGND.   ;  Are you drawing the labels "Deadhead Miles ..." etc. using the function TextOut?If so, I have had this problem, you need to set the background as transparent.use SetBkMode(hdc, TRANSPARENT);If those labels are static controls like CreateWindowEx(0,"Static","Deadhead Miles",...); then I am not sure but there maybe a Flag you can use like SS_TRANSPARENT or something to make the background transparent, but I never get a white background when I use static controls.Check the flags you have for the static control, something like the below would intentionally create the error you are getting...CreateWindowEx(0,"Static","DeadheadMiles",WS_BORDER|WS_CHILD|WS_VISIBLE|SS_WHITERECT,x,y,100,20,...);   ;  How do you create the text? Are you creating windows (static controls)? If so then there shouldn't be a difference, regardless of the fact if its a modeless or modal dialog.   ;  What Endurion said ... make sure you aren't calling DefWindowProc from your dialog procedure or something like that. Otherwise, we need to see code.   ;  I'm using a dialog template created with a resource editor.DRIVER_DLOG DIALOG 0, 0, 370, 150STYLE DS_SETFONT | WS_BORDER | WS_POPUP | WS_VISIBLE | WS_SYSMENU | WS_CAPTION CAPTION "Edit Driver Information..."FONT 10, "MS SHELL DLG"BEGIN  CONTROL "OK",IDOK,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,100,125,50,14  CONTROL "Cancel",IDCANCEL,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,220,125,50,14  CONTROL "Single",3,"BUTTON",BS_RADIOBUTTON |BS_LEFT |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,220,80,50,14  CONTROL "Married",4,"BUTTON",BS_RADIOBUTTON |BS_LEFT |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,275,80,60,14  CONTROL "",5,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_TABSTOP |WS_VISIBLE | WS_BORDER,60,8,200,13  CONTROL "0.00",6,"EDIT",ES_AUTOHSCROLL |ES_RIGHT |WS_CHILD |WS_TABSTOP |WS_VISIBLE | WS_BORDER,110,48,40,13  CONTROL "0.00",7,"EDIT",ES_AUTOHSCROLL |ES_RIGHT |WS_CHILD |WS_TABSTOP |WS_VISIBLE | WS_BORDER,110,63,40,13  CONTROL "0.00",8,"EDIT",ES_AUTOHSCROLL |ES_RIGHT |WS_CHILD |WS_TABSTOP |WS_VISIBLE | WS_BORDER,110,78,40,13  CONTROL "0.00",9,"EDIT",ES_AUTOHSCROLL |ES_RIGHT |WS_CHILD |WS_TABSTOP |WS_VISIBLE | WS_BORDER,110,93,40,13  CONTROL "Driver Name:",10,"STATIC",SS_SIMPLE | SS_LEFT |WS_CHILD |WS_GROUP | WS_VISIBLE,10,10,44,10  CONTROL "0",11,"EDIT",ES_NUMBER |ES_AUTOHSCROLL |ES_RIGHT |WS_CHILD |WS_TABSTOP |WS_VISIBLE | WS_BORDER,310,48,40,13  CONTROL "0.00",12,"EDIT",ES_AUTOHSCROLL |ES_RIGHT |WS_CHILD |WS_TABSTOP |WS_VISIBLE | WS_BORDER,310,63,40,13  CONTROL "Deadhead Miles Pay Rate:",13,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,20,50,85,10  CONTROL "Live Miles Pay Rate:",14,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,20,65,85,10  CONTROL "Cushion Miles Pay Rate:",15,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,20,80,85,10  CONTROL "Hourly Pay Rate:",16,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,20,95,85,10  CONTROL "Allowances (Line 5 on W-4):",17,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,180,50,107,10  CONTROL "Additional Withholding (Line 6 on W-4):",12,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,180,65,125,10  CONTROL "Pay Rate",18,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,10,35,150,80  CONTROL "W-4 Information",19,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,170,35,190,65ENDAnd the dialog proc. VERY basic right now...bool CALLBACK DriverDialogProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam){switch(message){case WM_INITDIALOG:CheckDlgButton(hwndDlg,3,true);return(true);case WM_ERASEBKGND:return(false);case WM_COMMAND:switch(LOWORD(wParam)){case IDOK:case IDCANCEL:EndDialog(hwndDlg,wParam);return(true);}break;}return(false);};  When interacting with Win32 you should use TRUE and FALSE rather than true and false. I doubt that's your problem, however.   ;Quote:Original post by jwezorekWhen interacting with Win32 you should use TRUE and FALSE rather than than true and false. I doubt that's your problem, however.Nope. No effect. I am curious why though? Besides, I like the pretty blue letters!   ;Quote:Original post by maspeirQuote:Original post by jwezorekWhen interacting with Win32 you should use TRUE and FALSE rather than than true and false. I doubt that's your problem, however.Nope. No effect. I am curious why though?Because TRUE and FALSE are #define's that are defined somewhere in "windows.h", as I think 1 and 0 respectively. They pre-date the addition of the true and false reserved words to C++. I don't think true and false in C++ are guaranteed to equal 1 and 0, just not-zero and zero. (somebody correct me if I'm wrong on this...)   ;  Anyway, I'm not sure what's going on with your painting issues. Trying setting the WS_TRANSPARENT style on your static controls, I guess, but you shouldn't have to...   