none
How to create a dialog within a stream interface driver project? RRS feed

  • Question

  • Hi all,
    I've added the following code to create a dialog box in a stream interface driver project. But driver has caused a "Raised Exception" on that source code (CreateDialog code line). Does Windows Embedded CE 6.0 allow to create a dialog box in stream interface driver? What can the problem be?

    // RC FILE CONTENT

    #include "resource.h"
    #include "windows.h"

    IDD_PMU DIALOG DISCARDABLE 0, 0, 186, 95
    STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    CAPTION "Dialog"
    BEGIN
    END

    // RESOURCE.h FILE CONTENT
    #define IDD_PMU                     101

    // DRIVER SOURCE CODE
    g_hModule = (HINSTANCE)hinstDLL; // in DLLENTRY
    g_hDlg = CreateDialog (g_hModule, MAKEINTRESOURCE(IDD_PMU), NULL, (DLGPROC)GPDlgProc);   // in XXX_Init
    BOOL CALLBACK GPDlgProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
    {
        switch (msg) {
        case WM_INITDIALOG:
        RETAILMSG (1, (L"GPDlgProc: WM_INITDIALOG\n\r"));
            return TRUE;

        case WM_COMMAND:
        RETAILMSG (1, (L"GPDlgProc: WM_COMMAND\n\r"));

                switch (GET_WM_COMMAND_ID(wp,lp))
            {
            case IDOK:
                   DestroyWindow(hwnd);
                   g_hDlg = NULL;
               RETAILMSG (1, (L"GPDlgProc: IDOK: DestroyWindow has been called!\n\r"));
                   break;
            case IDCANCEL:
               RETAILMSG (1, (L"GPDlgProc: IDCANCEL\n\r"));

                   DestroyWindow(hwnd);
                   g_hDlg = NULL;
                   break;
            }
        break;
        }
        return FALSE;
    }

    Thanks a lot for your helps and explanations,
    Yasemin
    Wednesday, July 13, 2011 5:49 AM

Answers

All replies