?
Solved

how show a dialog?

Posted on 2002-04-04
4
Medium Priority
?
264 Views
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);
 
  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
Comment
Question by:alexBrasil
[X]
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
4 Comments
 
LVL 3

Accepted Solution

by:
GGRUNDY earned 210 total points
ID: 6919452
Does your dialog resource have the WS_VISIBLE bit set?
0
 
LVL 4

Expert Comment

by:mblat
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?
0
 
LVL 49

Expert Comment

by:DanRollins
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(
     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
 

Author Comment

by:alexBrasil
ID: 6925460
Thank you.

sorry for i am beginner..
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

752 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