DialogBox in Win32 - Prevent multiple instance

Posted by UK on Stack Overflow See other posts from Stack Overflow or by UK
Published on 2010-05-14T03:24:49Z Indexed on 2010/05/14 3:34 UTC
Read the original article Hit count: 260

Filed under:
|
|

Hello all,

I have a program which creates DialogBox window when user clicks the menu item from tray icon,

 case ID_OPTIONS:
        DialogBox ( GetModuleHandle ( NULL ), MAKEINTRESOURCE ( IDD_SETUP_DIALOG ), hWnd, reinterpret_cast<DLGPROC>(SetupDlgProc) );
        return 0;

But the problem here is everytime when users clicks item from tray , a new instance of the dialogbox appears. Is there anyway to prevent this multiple instance ?

BTW, my SetupDlgProc looks like this,

BOOL CALLBACK SetupDlgProc ( HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam )
{
    switch ( Message )
    {
    case WM_INITDIALOG:
     ...
    }
}

Thanks for your help.

© Stack Overflow or respective owner

Related posts about win32

Related posts about c