• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

how show a dialog?

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);
 
  switch(uMsg)
  {
    case WM_INITDIALOG:
      return TRUE;  

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

__declspec(dllexport) LONG  APIENTRY  SetIniValue (HWND hwnd, LPLONG lpIValue, LPSTR lpszValue) {
 
     CreateDialog(
      g_hInst,          
      MAKEINTRESOURCE (IDD_DIALOG1),  
      hwnd,                    
      (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?

0
alexBrasil
Asked:
alexBrasil
1 Solution
 
GGRUNDYCommented:
Does your dialog resource have the WS_VISIBLE bit set?
0
 
mblatCommented:
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?
0
 
DanRollinsCommented:
You are creating a modeless dialog.  It might be a easier for you to create a Modal dialog like this:

int nErt= ::DialogBox(
     g_hInst,          
     MAKEINTRESOURCE (IDD_DIALOG1),  
     hwnd,                    
     (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
0
 
alexBrasilAuthor Commented:
Thank you.

sorry for i am beginner..
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now