Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

dialog box

raniarania Member Posts: 35
hy everybody
i want to make a dialog box only (with no menu )
i try with this source code
/////////////
#include
#include
#include
#include

Comments

  • RunXC410RunXC410 Member Posts: 3
    What compiler and version of it are you using?
  • raniarania Member Posts: 35
    i am using Microsoft Visual C++6.
    can you help me?
    many thanks in advance
    regards
    rania

  • pingpongpingpong Member Posts: 937
    I looked at your code and you are trying to process WM_INITDIALOG in your main window. This message will never be sent to a window created with CreateWindow, but to a dialog created with DialogBox.

    When do you want the dialog box to show up? if right away? then replace WM_INITDIALOG with WM_CREATE.

    : i am using Microsoft Visual C++6.
    : can you help me?
    : many thanks in advance
    : regards
    : rania
    :
    :

  • raniarania Member Posts: 35
    well i try as you said first it gives the window (i want this window to be the prescreen window of my project)so i want it to be dialog box , if i press to button1 for exampe it links with program1 by WinExec, and so on.
    by compiling after changing some codes it gives error in executing and this code:"cannt open debug/tryD1.exe(which is the program name) for writing"

    this is my source code.
    #include
    #include
    #include
    #include
  • pingpongpingpong Member Posts: 937
    You get the access error because your EXE is not being unloaded from memory.

    I dont fully understand "prescreen". What are you trying to do? A dialog as your main window? In other words, instead of a normal resizable winodw, you want a dialog that has buttons etc?

    : well i try as you said first it gives the window (i want this window to be the prescreen window of my project)so i want it to be dialog box , if i press to button1 for exampe it links with program1 by WinExec, and so on.
    : by compiling after changing some codes it gives error in executing and this code:"cannt open debug/tryD1.exe(which is the program name) for writing"

  • raniarania Member Posts: 35
    yes i am trying to present first a dialog box with buttons instead of a resizable window.

    and this dialog box will have an image and 3 buttons.
    and i am working with the WinAPI32

    so can you help me?

    many thanks in advance
    regards
    rania
  • pingpongpingpong Member Posts: 937
    [b][red]This message was edited by pingpong at 2002-10-23 5:20:5[/red][/b][hr]
    Just call DialogBox then, this is the minimal code:
    [code]
    static INT WINAPI MyDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    switch(message)
    {
    case WM_INITDIALOG:
    // do initialization stuff here

    // I looked at your previous code, you need to return
    // 1 if you process a message in a dialog proc, 0 otherwise.
    return 1;

    case WM_COMMAND:
    switch(LOWORD(wParam)) // not switch(wParam) as you do
    {
    case IDOK:
    // do the OK stuff
    EndDialog(LOWORD(wParam));
    return 1;

    case IDCANCEL:
    // do the Cancel stuff
    EndDialog(LOWORD(wParam));
    return 1;

    break;
    }
    break;

    case WM_DESTROY:
    // if you need to clean up anything
    return 1;
    }

    return 0;
    }

    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
    {
    DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG), NULL, MyDlgProc);
    return 0;
    }
    [/code]
    See? No window, no WNDCLASS. However, if you need a true dialog box main window (with an icon, menu, etc) then its a bit more work. Let me know if this is satisfactory for you or not.

    : yes i am trying to present first a dialog box with buttons instead of a resizable window.
    :
    : and this dialog box will have an image and 3 buttons.
    : and i am working with the WinAPI32
    :
    : so can you help me?
    :
    : many thanks in advance
    : regards
    : rania
    :



  • raniarania Member Posts: 35
    well, i try as you said, but it does not work
    it gives same executing error" cannot open Debug/tryd1.exe for writing"



    #include
    #include
    #include
    #include
  • BAH_StrikeBAH_Strike Member Posts: 1
    rania, as someone else said, your executable is still resident/running in memory. Close out of it by hitting CTRL-ALT-DEL and forcefully close it, but you really should fix it so it will close entirely when it completes running.

    : well, i try as you said, but it does not work
    : it gives same executing error" cannot open Debug/tryd1.exe for writing"
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ( http://forcoder.org ) free video tutorials and ebooks about ( Go Python Perl Objective-C R Visual Basic PL/SQL Visual Basic .NET JavaScript MATLAB Ruby C++ Scratch C C# Assembly Java Swift PHP Delphi Lua VBScript Bash Alice ML Scheme Crystal F# Kotlin FoxPro Prolog Ada Lisp Transact-SQL Hack D Rust Julia LabVIEW SAS Dart ABAP Logo COBOL Scala Fortran Erlang Apex Awk Clojure ) ______

Sign In or Register to comment.