Lame question on dialog controls appearance

This is a discussion on Lame question on dialog controls appearance within the Windows Programming forums, part of the Platform Specific Boards category; Ok, I am totally aware this is probably a lame question. The fact is that I have been working on ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    42

    Lame question on dialog controls appearance

    Ok, I am totally aware this is probably a lame question. The fact is that I have been working on this for so long that I can find an answer anymore. I´m getting (even more) retarded.

    My question is simple:
    Why can´t an Edit Control created at WM_CREATE using CreateWindowEx and a Edit Control created at a resource file have the exact same appearance? The one created in the resource file has that "3D style" no matter how much I play with it´s styles, I can´t get rid of it and make it "Flat" like the one created at WM_CREATE.
    The same thing happens with ListBoxes, and Static controls.
    Here´s an example using a listbox:

    Code:
    //This is in my WNDPROC at WM_CREATE:
    textdebug = CreateWindowEx (0, TEXT ("listbox"), TEXT("test"), 
                WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | LBS_NOINTEGRALHEIGHT | LBS_NOSEL |
                LBS_DISABLENOSCROLL, 15, 252, 333, 104, mainWindow, (HMENU) 1201, hInstance, NULL) ;
    
    
    //This is in dialogs.rc
    ID_STATUSDLG DIALOG DISCARDABLE 1, 12, 237, 223
    //EXSTYLE I have tried all possible styles here
    STYLE WS_CHILD /*I have tried all possible styles here*/ 
    FONT 1, "MS Sans Serif"                               
    BEGIN 
    LISTBOX "test", IDC_TEXTDEBUG, 5, 141, 223, 64, WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL |
    LBS_NOINTEGRALHEIGHT | LBS_NOSEL | LBS_DISABLENOSCROLL 
    END
    If you add this example above to a sample program you´ll see what I am talking about. Besides the normal difference in metrics, there´s that 3D border around the control created into the resource file. I need to get rid of that.
    Any help will be great, thanks

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,263
    You'd probably need to get rid of the WS_EX_CLIENTEDGE style that is applied to the control by the system. You can do this by doing this in the dialog's WM_INITDIALOG:-
    Code:
    DWORD dwExStyles;
    HWND hwndEdit;
    
    hwndEdit = GetDlgItem(hDlg, IDC_TEXTDEBUG);
    dwExStyles = GetWindowLong(hwndEdit, GWL_EXSTYLE);
    SetWindowLong(hwndEdit, GWL_EXSTYLE, dwExStyles ^ WS_EX_CLIENTEDGE);
    SetWindowPos(hwndEdit, NULL, 0, 0, 0, 0, SWP_NOACTIVATE
     | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    42
    Thank you Do you believe there´s some way for me to take that style away from all my dlg controls without having to intercept each of them at wm_initdialog like you described?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Edit controls of a dialog from another dialog...
    By Snake in forum Windows Programming
    Replies: 9
    Last Post: 07-01-2005, 02:18 PM
  2. what does this warningmean???
    By kreyes in forum C Programming
    Replies: 5
    Last Post: 03-04-2002, 06:53 AM
  3. Resource question for dialog boxes.
    By Unregistered in forum Windows Programming
    Replies: 2
    Last Post: 02-13-2002, 07:58 AM
  4. Newbie question on tab controls
    By Robert602 in forum Windows Programming
    Replies: 3
    Last Post: 01-20-2002, 01:13 PM
  5. Diff between window controls and dialog controls
    By Garfield in forum Windows Programming
    Replies: 13
    Last Post: 01-18-2002, 04:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21