Author Topic: MessageBox of input?  (Read 4498 times)

x64Core

  • Member
  • **
  • Posts: 80
MessageBox of input?
« on: December 04, 2012, 03:21:13 PM »
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

  • Member
  • *****
  • Posts: 8825
  • Still using Abacus 2.0
    • DednDave
Re: MessageBox of input?
« Reply #1 on: December 04, 2012, 03:52:07 PM »
quick and easy way....

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

in the examples - Bill Cravener - popupinfo

Code: [Select]
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

  • Member
  • *****
  • Posts: 10098
  • Assembler is fun ;-)
    • MasmBasic
Re: MessageBox of input?
« Reply #2 on: December 04, 2012, 05:47:00 PM »
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

  • Member
  • **
  • Posts: 80
Re: MessageBox of input?
« Reply #3 on: December 05, 2012, 05:05:50 AM »
Thanks guys, yeah I think it will be the best solution  :biggrin:



Vortex

  • Member
  • *****
  • Posts: 2104
Re: MessageBox of input?
« Reply #4 on: December 05, 2012, 05:40:54 AM »

x64Core

  • Member
  • **
  • Posts: 80
Re: MessageBox of input?
« Reply #5 on: December 05, 2012, 06:09:04 AM »