Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Newling on October 18, 2009, 07:27:48 pm

Title: C::B_5859 - minGW - commctrls
Post by: Newling on October 18, 2009, 07:27:48 pm
Hello to everyone!

I'm just new with code block and have the following question:
   
I created a few projects and they all work normally
but I have problems when I use a trackbar.
The dialog is not displayed, the program will be terminated immediately,
and I can not embed this code :
Code
    INITCOMMONCONTROLSEX ICC;

    ICC.dwSize = sizeof(ICC);
    ICC.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(ICC);
||=== TrackBar, Debug ===|
X:\TrackBar\main.cpp||In function 'int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':|
X:\TrackBar\main.cpp|42|error: 'INITCOMMONCONTROLSEX' was not declared in this scope|
X:\TrackBar\main.cpp|42|error: expected ';' before 'ICC'|
X:\TrackBar\main.cpp|44|error: 'ICC' was not declared in this scope|
X:\TrackBar\main.cpp|46|error: 'InitCommonControlsEx' was not declared in this scope|
||=== Erstellen beendet: 4 Fehler, 0 Warnungen===|

Code
#define WIN32_LEAN_AND_MEAN

#include <windows.h>
#include <commctrl.h>
#include "resource.h"


HINSTANCE hInst;

BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
    {
    case WM_INITDIALOG:
        return TRUE;

    case WM_CLOSE:
        EndDialog(hwndDlg, 0);
        return TRUE;

    case WM_LBUTTONDOWN:
        SendMessage(hwndDlg, WM_CLOSE, 0, 0);
        return TRUE;

    case WM_COMMAND:
        switch(LOWORD(wParam))
        {
            //Button schliessen
        case IDC_cmdSchliessen:
            SendMessage(hwndDlg,WM_CLOSE,0,0);
            return TRUE;
        }
    }

    return FALSE;
}


int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{

    INITCOMMONCONTROLSEX ICC;

    ICC.dwSize = sizeof(ICC);
    ICC.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(ICC);

    hInst = hInstance;

    // The user interface is a modal dialog box
    return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, DialogProc);

Can someone tell me how I can incorporate these controls?

Thanks!
Title: Re: C::B_5859 - minGW - commctrls
Post by: MortenMacFly on October 18, 2009, 08:13:01 pm
Can someone tell me how I can incorporate these controls?
Sorry, this is in no way Code::Blocks related and thus violates our forum rules. Please try a C/C++/MFC programmer forum.

Topic locked.