Thread: Dialog Boxes and Sliders

  1. #1
    Registered User AtomRiot's Avatar
    Join Date
    Jan 2003
    Posts
    120

    Dialog Boxes and Sliders

    for some reason i cant open a dialog box when i have two slide bars (sliders) in them. if i take them out, the dialog opens just fine but when they are in the DialogBox command returns -1. the code in my rsrc.rc file is as follows
    Code:
    CONTROL         "Slider1",IDD_SLIDER_MUSIC,"msctls_trackbar32",
                        TBS_AUTOTICKS | TBS_VERT | TBS_BOTH,215,23,29,81
    CONTROL         "Slider2",IDD_SLIDER_CLUE,"msctls_trackbar32",
                        TBS_AUTOTICKS | TBS_VERT | TBS_BOTH,245,23,29,81
    and in my resource.h i have numbers set up as follows
    Code:
    #define IDD_SLIDER_CLUE   204
    #define IDD_SLIDER_MUSIC  205
    other than that, i just use a normal DialogBox command to call the dialog and it will work if i take them out. as far as sliders go, i know that the limits have to be set and what not but where in a dialog would i set them, my dialog box function is as follows
    Code:
    LRESULT CALLBACK ConfigDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    {	
    	switch (message)
    	{
    		case WM_INITDIALOG:
    				return TRUE;
    		case WM_COMMAND:
    		{
    		    if (LOWORD(wParam) == IDD_BUTTON_OK) 
    			{
    				EndDialog(hDlg, LOWORD(wParam));
    				return TRUE;
    			}
    			break;
    		}
    		case WM_DESTROY:
    		case WM_CLOSE:
    			{
    				EndDialog(hDlg, LOWORD(wParam));
    				return TRUE;
    			}
    	}
        return FALSE;
    }
    what do i do to fix this?
    All Your Base Are Still Belong to Someone!!!
    And you Remember that!!!

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    If the resource ID numbers do not confilct with any others then have you used

    InitCommonControls();

    or

    InitCommonControlsEx();
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User AtomRiot's Avatar
    Join Date
    Jan 2003
    Posts
    120
    do i have to link any special libraries to use this? and should i initialize this before i call the dialog box or should it be in hte dialog box?
    All Your Base Are Still Belong to Someone!!!
    And you Remember that!!!

  4. #4
    Registered User AtomRiot's Avatar
    Join Date
    Jan 2003
    Posts
    120
    and i am using the win32 api for this, not mfc
    All Your Base Are Still Belong to Someone!!!
    And you Remember that!!!

  5. #5
    Registered User AtomRiot's Avatar
    Join Date
    Jan 2003
    Posts
    120
    ok, i added comctl32.lib in my project link area and now i am set
    All Your Base Are Still Belong to Someone!!!
    And you Remember that!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visual C++ 6.0 Sliders in Dialog Boxes
    By The Letter J in forum C++ Programming
    Replies: 24
    Last Post: 12-30-2004, 12:00 PM