News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

MessageBox of input?

Started by x64Core, December 04, 2012, 03:21:13 PM

Previous topic - Next topic

x64Core

Hello all, I would like to know if there is a Message Box to user input, sometimes I want to get an input of mine ( numbers or strings ) via a
quick way for testing code or like that, but can not find a quick way to get user input.  :biggrin:


dedndave

quick and easy way....

create a dialog box with an edit control in the resource file   :P

in the examples - Bill Cravener - popupinfo

POPUPINFO DIALOGEX 0, 0, 193, 106
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "How to popup help info for controls."
FONT 8, "MS Sans Serif"
BEGIN
    CTEXT           "Click on the question mark button in the above titlebar.",
                    IDC_STATIC,8,5,177,10,SS_CENTERIMAGE
    CTEXT           "Your cursor then turns into a question mark.",
                    IDC_STATIC,8,15,177,10,SS_CENTERIMAGE
    CTEXT           "Now click on one of the controls below.",IDC_STATIC,8,
                    25,177,10,SS_CENTERIMAGE
    CTEXT           "You should see a pop-up help message appear.",
                    IDC_STATIC,8,35,177,10,SS_CENTERIMAGE
    EDITTEXT        IDC_EDIT1,26,56,138,15,ES_AUTOHSCROLL
    CONTROL         "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH |
                    TBS_NOTICKS | WS_TABSTOP,25,76,139,21,
                    WS_EX_DLGMODALFRAME | WS_EX_STATICEDGE
END

jj2007

Console mode or Windows? Here are two options in MB.

If it's a Windows app, you might as well add an extra edit control, or use an existing one to get the string.

include \masm32\MasmBasic\MasmBasic.inc        ; download
  Init

  Let esi=Input$("What's your name? ", "RHL")   ; console mode assembly!!

DlgDefine "Hello:", 0, 0, 150, -2, , 14
  DlgControl dcEdit,   "My name", WS_BORDER or WS_TABSTOP, 1, -2              ; first control gets the focus
  DlgControl dcStatic,   "Type your name:", SS_LEFT, 1, -1, 70.0           ; 70 means 70% - the buttons need space
  DlgControl dcButton,   "OK", BS_DEFPUSHBUTTON or WS_TABSTOP, 71.0, -1, 12.0, , IDOK        ; x=71%, y, width=14%, height, ID
  DlgControl dcButton,   "Quit", BS_PUSHBUTTON or WS_TABSTOP, 84.0, -1, 16.0, , IDCANCEL
  DlgShow
  .if eax==IDOK
   MsgBox 0, Cat$(Utf8$(Dlg$(0))+CrLf$+Utf8$(Dlg$(1))), "Please confirm:", MB_OKCANCEL
   wMsgBox 0, wCat$(Dlg$(0)+wCrLf$+Dlg$(1)), "Please confirm:", MB_OKCANCEL
  .endif
  Exit
end start

x64Core

Thanks guys, yeah I think it will be the best solution  :biggrin: