News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

A couple questions.

Started by sportskid300, May 12, 2007, 07:10:08 AM

Previous topic - Next topic

sportskid300

I'm new to the forum, so I'm not sure I'm posting in the correct section.
I do believe I'm correct though.
In any sae, I have a few questions.
1) Is there a tutorial for using TheGun? The only included ones (In the download) are for QEditor.
2) How limited is QEditor compared to TheGun? I know QEditor is based on macros.
3) Is there w way, in QEditor, to include color? I've been searching google, but haven't found anything.
4) Is there a way to include buttons?

Thanks for all your help!
I can't wait to make windows...

hutch--

Hi sportskid300,

Welcome on board.

1) Is there a tutorial for using TheGun? The only included ones (In the download) are for QEditor.

TheGun is a miniature text editor, its functionality is limited by its size and what is aviailable is on its menus.

2) How limited is QEditor compared to TheGun? I know QEditor is based on macros.

QE is larger but can do much more.

3) Is there w way, in QEditor, to include color? I've been searching google, but haven't found anything.

No, QE does not support sytax colour and it will not in the future.

4) Is there a way to include buttons?

No, the toolbar is not programmable but te menus are. Check how its done in the help file for QE.


Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

sportskid300

Hey, thanks for the help!
Just to clear it up, QEditor is the most extensive item included?
Unfortunately, I've been searching for online tutorials, but can't mind much.
My friend makes little text boxes appear, and stuff, WITH inputs and the like, but I can't find a tutorial on how.
Also, all the tutorial programs include a ton of libraries and stuff.
How do I know which I need to include? Is there a command to include all macros?
Lastly, how does the command 'X dd Y' work, X being a variable and Y being a byte.
I've noticed that people are using that to replace the need for something like: 'LOCAL var:DWORD'
Once again,
Thanks!
I can't wait to make windows...

MichaelW

QuoteIs there a command to include all macros?
There is a sort of master include file that will include essentially everything in a single statement. See \masm32\include\masm32rt.inc.

Quotehow does the command 'X dd Y' work
This would typically be used to load the address of Y into X.

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .data
      X dd Y
      Y dd 0
    .code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    print uhex$(X),13,10
    print uhex$(OFFSET Y),13,10

    inkey "Press any key to exit..."
    exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start


00403004
00403004
eschew obfuscation

sportskid300

#4
Umm, thanks for trying to help.
Unfortunately, I've never used uhex$()
I've only used print str$() and print chr$()
Heres a pathetic attempt of mine to put an input into a message box:

mov var1, sval(input("Want a message? Type it here: "))
invoke MessageBox, NULL, str$(var1), chr$('Message to Self'), MB_OK

I soon realized it only pops out numbers for me.
I'm trying to learn how to use DB instead of local, because I've heard it works for words.

EDIT: As I've been working, I've come to ask more questions. Sorry! Please answer the ones above as well though!

(1)
I have this code:
main proc

   Dialog "What would you like to hear?", \           
           "MS Sans Serif",8, \           
            WS_OVERLAPPED or \           
            WS_SYSMENU or DS_CENTER, \
            4, \                           
            25,20,170,90, \               
            1024                                           

    DlgButton "X" ,WS_TABSTOP,25,10,120,13,101
    DlgButton "Y"  ,WS_TABSTOP,25,25,120,13,102
    DlgButton "Z" ,WS_TABSTOP,25,40,120,13,103

    DlgButton "Close",WS_TABSTOP,50,55,60,13,IDCANCEL

    CallModalDialog hInstance,0,dlgproc,NULL

main endp

Obviously, that is not the full code.
However, as soon as I add lines (Like print chr$(), moving variables)before the initial: Dialog "What would you like to hear?", \
The dialog window won't move to the front.
I tried incorperating WS_VISIBLE, but the truth is, I have no clue where I'd put it, I just snatched it from msdn library.
I also tried ShowWindow, but couldn't figure it out.

(2) If I remove the 'WS_SYSMENU' from the text above, my 'X' (close) goes away, as planned.
I do know how to add a maximize and minimize, but how would I center my caption? (Without any buttons)



Im really sorry to keep loading you guys with questions, but I'm really trying to learn!
Any help is greatly appreciated!
FINAL EDIT: I added my AIM and MSN, in case anyone would be able to help me out over those.
I can't wait to make windows...

MichaelW

#5
Hopefully this will answer some of your questions.

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc

    DlgProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .data
      hInstance   dd 0
      msgBoxTitle db "Test",0
    .code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    call GetModuleHandle
    mov hInstance, eax

    ; ------------------------------------------------
    ; There are many other possibilites for the style
    ; parameter. Search MSDN for "Window Styles".
    ;
    ; A modal dialog is automatically made visible,
    ; so there is no need for the WS_VISIBLE style.
    ; ------------------------------------------------

    Dialog "What would you like to hear?", \
           "MS Sans Serif",8, \
            WS_OVERLAPPEDWINDOW or DS_CENTER, \
            4, \
            25,20,170,90, \
            1024

    DlgButton "X" ,WS_TABSTOP,25,10,120,13,101
    DlgButton "Y"  ,WS_TABSTOP,25,25,120,13,102
    DlgButton "Z" ,WS_TABSTOP,25,40,120,13,103

    DlgButton "Close",WS_TABSTOP,50,55,60,13,IDCANCEL

    CallModalDialog hInstance,0,DlgProc,NULL

    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

DlgProc proc hDlg:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

    Switch uMsg

      Case WM_INITDIALOG

      Case WM_COMMAND

        ; ------------------------------------------------------------
        ; When a button is clicked, the window procedure (which for a
        ; dialog is called the dialog procedure) receives a BN_CLICKED
        ; notification in a WM_COMMAND message. Referring to the MSDN
        ; documentation for the WM_COMMAND message, to make sense of
        ; this code you need to know that the BN_CLICKED notification
        ; code has a value of zero.
        ; ------------------------------------------------------------

        Switch wParam

          Case 101

            ; ------------------------------------------------------
            ; MsgBox is a macro that calls the MessageBox function.
            ; ------------------------------------------------------

            MsgBox hDlg,"You clicked X",ADDR msgBoxTitle,0

          Case 102

            MsgBox hDlg,"You clicked Y",ADDR msgBoxTitle,0

          Case 103

            MsgBox hDlg,"You clicked Z",ADDR msgBoxTitle,0

          Case IDCANCEL

            ; ------------------------------------------------
            ; This identifier is sent when a button with this
            ; identifier is clicked, or in a dialog when the
            ; user presses Escape.
            ; ------------------------------------------------

            invoke EndDialog,hDlg,0

        Endsw

      Case WM_CLOSE

        ; ----------------------------------------------------
        ; This message is sent when the user clicks the Close
        ; button (at the right end of the title bar), selects
        ; Close from the window menu, or presses Alt+F4.
        ; ----------------------------------------------------

        invoke EndDialog,hDlg,0

    Endsw

    xor eax, eax
    ret

DlgProc endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start


BTW, uhex$ is a macro that converts its argument to a hex string and returns the address of the string in ADDR format.

eschew obfuscation

sportskid300

Hey, thanks a lot!
Will uhex return in text?
Im not exactly sure what ADDR is.
I can't wait to make windows...