Results 1 to 5 of 5

Thread: Problem with the dialog!

  1. #1

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    Post Problem with the dialog!

    I have created a dialog procedure, the actuall dialog.

    --The name of the dialog is MYDIALOG
    --The name of the dialog procedure DLGPROC
    --The name of my window's hwnd is WINHWND
    --The name of the Instance is hInstance

    How do I show a dialog box when the window is clicked?

    If you still need more informations then please reply!
    Baaaaaaaaah

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Maybe something like this:

    Code:
    //in the main window procedure
    switch (message)
    	{
    	case WM_LBUTTONDOWN:
                            DialogBox(hInstance(LPCTSTR)IDD_DIALOG1, NULL, (DLGPROC)DLGPROC);
                    break;
                     }
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    Unhappy I get these errors.

    The dialog name is: IDD_MYDLG
    The dialog's procedure is: DlgProc

    When I put this text in the "Move" event:
    Code:
    CreateDialog(hInstance(LPCTSTR)IDD_MYDLG, NULL, (DlgProc)DlgProc);
    It gives me these error in vc++ 6.0:


    Deleting intermediate files and output files for project 'winprog - Win32 Debug'.

    --------------------Configuration: winprog - Win32 Debug--------------------
    Compiling...
    file1.cpp
    c:\program files\microsoft visual studio\myprojects\winprog\file1.cpp(48) : warning C4003: not enough actual parameters for macro 'CreateDialogA'
    c:\program files\microsoft visual studio\myprojects\winprog\file1.cpp(48) : error C2065: 'hInstance' : undeclared identifier
    c:\program files\microsoft visual studio\myprojects\winprog\file1.cpp(48) : error C2275: 'LPCTSTR' : illegal use of this type as an expression
    c:\program files\microsoft visual studio\vc98\include\winnt.h(196) : see declaration of 'LPCTSTR'
    c:\program files\microsoft visual studio\myprojects\winprog\file1.cpp(48) : error C2146: syntax error : missing ')' before identifier 'IDD_MYDLG'
    c:\program files\microsoft visual studio\myprojects\winprog\file1.cpp(48) : error C2059: syntax error : ')'
    Error executing cl.exe.

    winprog.exe - 4 error(s), 1 warning(s)






    What is the problem?
    Baaaaaaaaah

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    The name of the dialog is MYDIALOG
    whad do you mean now your dialog name is IDD_MYDLG ???

    Anyway in the code above
    You forgot a comma
    Code:
    CreateDialog(hInstance,(LPCTSTR)IDD_MYDLG, NULL, (DlgProc)DlgProc);
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  5. #5

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    Post Sorry both times!

    I was rong both times.
    Now this is the information

    --The name of the dialog is IDD_MAINDLG

    oooh

    I used this code:

    Code:
    CreateDialog(hInstance,(LPCTSTR)IDD_MAINDLG, NULL, (DlgProc)DlgProc);
    and I got the following errors:



    C:\Program Files\Microsoft Visual Studio\MyProjects\winprog\file1.cpp(48) : error C2065: 'hInstance' : undeclared identifier
    C:\Program Files\Microsoft Visual Studio\MyProjects\winprog\file1.cpp(48) : error C2146: syntax error : missing ')' before identifier 'DlgProc'
    C:\Program Files\Microsoft Visual Studio\MyProjects\winprog\file1.cpp(48) : error C2059: syntax error : ')'



    I think that It has some problem with the hInstance. I have declared it in the window procedure.

    What is the problem again?
    Baaaaaaaaah

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width