my dialog box did not show up whene i compile it using sdk 7.1,

Posted by zirek on Stack Overflow See other posts from Stack Overflow or by zirek
Published on 2013-10-17T15:33:01Z Indexed on 2013/10/17 15:55 UTC
Read the original article Hit count: 226

Filed under:
|

hello and welcom everyone .. i'd like to build a win32 application using sdk 7.1, i create the dialog box using visual c++ 2012 resource editor, i copy resource.rc and resource.h to my folder and i write this simple main.cpp file:

#include <windowsx.h>
#include <Windows.h>
#include <tchar.h>

#include "resource.h"

#define my_PROCESS_MESSAGE(hWnd, message, fn)   \
    case(message):  \
        return( \
            SetDlgMsgResult(hWnd, uMsg, \
                HANDLE_##message((hWnd), (wParam), (lParam), (fn)) ))   \

LRESULT CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM);
BOOL Cls_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam);
void Cls_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);

int WINAPI _tWinMain(   HINSTANCE   hInstance,
                        HINSTANCE,
                        LPTSTR,
                        int         iCmdLine    )
{
    DialogBoxParam(     hInstance,
                        MAKEINTRESOURCE(IDD_INJECTOR),
                        NULL,
                        (DLGPROC) DlgProc,
                        NULL
                        );

    return FALSE;
}

LRESULT CALLBACK DlgProc(   HWND    hwnd,
                            UINT    uMsg,
                            WPARAM  wParam,
                            LPARAM  lParam  )
{
    switch (uMsg)
    {
        my_PROCESS_MESSAGE(hwnd, WM_INITDIALOG, Cls_OnInitDialog);
        my_PROCESS_MESSAGE(hwnd, WM_COMMAND, Cls_OnCommand);

    default:
        break;
    }

    return DefWindowProc(hwnd, uMsg, wParam, lParam);
}


BOOL Cls_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{


    return TRUE;
}

void Cls_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
    switch(id)
    {
    case IDCANCEL:
        EndDialog(hwnd, id);
        break;

    default:
        break;
    }
}

then i use the following command line to compile my code, wich i found on this forum

cl main.cpp /link /SUBSYSTEM:WINDOWS user32.lib

my problem is that my dialog box did not show up, and when i use procexp, to see what happen, i found that that my application is created then closed in the same time, and what make me wondering is that its working fine on visual c++ 2012.

my sdk 7.1, installed correctly, i testing it against a basic window without any resource file

any ideas, ill be really thankful

Best, Zirek

© Stack Overflow or respective owner

Related posts about c++

Related posts about visual-studio-2012