how show a dialog?

Posted on 2002-04-04
Last Modified: 2010-04-02
I am beginner.

I want to show a dialog box.

I want to use a DLL, and a Function.

I call the function in DLL, and it's right.

for show my dialog, i use this:

BOOL CALLBACK ReplaceDialogProc (
                    HWND hwndDlg,                       UINT uMsg,WPARAM wParam, LPARAM lParam)  

   MessageBox(NULL,"message 2 - I am in callback", "REPLACEDIALOGPROC",MB_OK);
      return TRUE;  

    case WM_COMMAND:
      switch (LOWORD(wParam))
        case IDCANCEL:
          EndDialog(hwndDlg, 0);
      return TRUE;
  return FALSE;

__declspec(dllexport) LONG  APIENTRY  SetIniValue (HWND hwnd, LPLONG lpIValue, LPSTR lpszValue) {
      (DLGPROC) ReplaceDialogProc);

     MessageBox(NULL,"message 1 - Teste da minha DLL. SetIniValue",lpszValue,MB_OK);

return 0;


it show the message 1 and message2, but don't show a dialog box.

What is it wrong?

Question by:alexBrasil
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

GGRUNDY earned 70 total points
ID: 6919452
Does your dialog resource have the WS_VISIBLE bit set?

Expert Comment

ID: 6919774
Just couple questions.

Is your dialog resource located in .exe ot in .dll?  
Do you have IDD_DIALOG1 defined in any other place in your app?
LVL 49

Expert Comment

ID: 6923585
You are creating a modeless dialog.  It might be a easier for you to create a Modal dialog like this:

int nErt= ::DialogBox(
     (DLGPROC) ReplaceDialogProc);

Also you will need to remove this line:
    MessageBox(NULL,"message 2 ... etc...
or move it into the WM_INITDIALOG case handler because otherwise, it will be executed on each message to the dialog.

But also be certain that yjr resource for the dialog is in the same module as the one represented by g_hInst.

-- Dan

Author Comment

ID: 6925460
Thank you.

sorry for i am beginner..

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question