WIN32 : Editbox non editable avec une boite de dialogue CHILD

Pistol_Pete Messages postés 1054 Date d'inscription samedi 2 octobre 2004 Statut Membre Dernière intervention 9 juillet 2013 - 25 févr. 2009 à 22:30
Pistol_Pete Messages postés 1054 Date d'inscription samedi 2 octobre 2004 Statut Membre Dernière intervention 9 juillet 2013 - 5 mars 2009 à 10:24
Bonjour
Voila mon problème: J'ai créé une fenêtre et dans cette fenêtre j'ai une boite de dialogue avec le style WS_CHILD. Tous mes contrôles de cette boite de dialogue marchent très bien (bouton, combo box...) sauf les Editbox qui ne sont plus éditable...
Avec le style WS_OVERLAPPED, tous va très bien, je peux écrire dans mes édits box mais pas avec le style child.!
Je dois avoir le style child, comment dois-je procéder?

Voila le bout de code que j'utilise:
#include <windows.h>
HINSTANCE hInst;
BOOL APIENTRY DlgProcDialog(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_COMMAND:
        switch(LOWORD(wParam))
        {
        case IDOK:    EndDialog(hDlg,1);break;
        case IDCANCEL:EndDialog(hDlg,0);break;
        }
    }
    return 0;
}

LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_CREATE:
        CreateDialog(hInst, "IDD_DIALOG" ,hwnd, (DLGPROC)DlgProcDialog);
        break;
    case WM_DESTROY:
            PostQuitMessage(0);
            return 0;
        default:
            return DefWindowProc(hwnd, uMsg, wParam, lParam);
    }
    return 0;
}

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
    HWND hwnd;
    MSG msg;
    WNDCLASS wc;
    hInst = hinstance;
    wc.style = 0;
    wc.lpfnWndProc = MainWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hinstance;
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
    wc.lpszMenuName =  NULL;
    wc.lpszClassName = "MyWinClass";

    if(!RegisterClass(&wc)) return FALSE;

    hwnd = CreateWindow("MyWinClass", "Test", WS_OVERLAPPEDWINDOW,
                CW_USEDEFAULT, CW_USEDEFAULT, 400, 400,NULL, NULL, hinstance, NULL);
    if (!hwnd) return FALSE;

    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return (int)msg.wParam;
}

//RESSOURCE
IDD_DIALOG DIALOGEX 20, 20, 186, 94
STYLE WS_CHILD|WS_VISIBLE|WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,129,7,50,14
    PUSHBUTTON      "Annuler",IDCANCEL,129,24,50,14
    EDITTEXT        ID_EDIT1,10,10,50,14
END

Merci
____________________________________________________________________________
Mon site internet :  

1 réponse

Pistol_Pete Messages postés 1054 Date d'inscription samedi 2 octobre 2004 Statut Membre Dernière intervention 9 juillet 2013 7
5 mars 2009 à 10:24
Bon si ça peut aider quelqu'un, j'ai contourné mon problème en remplaçant les édit box par des rich édit, il n'y a plus de soucis maintenant..
A+
____________________________________________________________________________
Mon site internet :  
0
Rejoignez-nous