The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: MEPHiST0 on September 06, 2008, 03:54:36 AM

Title: HELP with MASM Number of Controls
Post by: MEPHiST0 on September 06, 2008, 03:54:36 AM
hey all

first off, ive never taken any courses or studied assembler, i just started reading the examples included in MASM and learned from there, so im not very aware of all the different techniques you can use to program something.. but i have coded plenty of small stuff with success.

onto my question:
I am having a problem with the Number of controls i can use, i can only have 15 on my UI..
is there a limit in MASM? is there something i need to do, or create the dialog differently to have more controls?
The program compiles, but it wont run, im not sure why!

here is the format i am using for my UI:


            "Tahoma",8, \                   ; font,pointsize
            WS_OVERLAPPED or \              ; styles for
            WS_SYSMENU or DS_CENTER, \      ; dialog window
            15, \                           ; number of controls
            50,50,310,190, \                ; x y co-ordinates
            1024                            ; memory buffer size

+ 15 controls
then the dialogproc:

;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤Ô¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
DialogProc proc hWin:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤Ô¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    LOCAL hMem  :DWORD
    LOCAL hDC   :DWORD
    LOCAL hDlg  :DWORD
    LOCAL patn  :DWORD
    LOCAL fname :DWORD
    LOCAL ps    :PAINTSTRUCT
    LOCAL rct   :RECT

    .if uMsg == WM_INITDIALOG

      invoke SendMessage,hWin,WM_SETICON,ICON_BIG,
                         FUNC(LoadIcon,hInstance,IDI_ICON1)

      invoke SendDlgItemMessage,hWin,143,WM_SETTEXT,-1, offset [MAX_LIMIT]

       m2m hWnd, hWin    ; hWnd is GLOBAL in scope
       mov ecx,wParam
       mov w_Param,ecx
       mov ecx,lParam 
       mov l_Param,ecx
       mov eax, 1
      ret
ect..
Title: Re: HELP with MASM Number of Controls
Post by: hutch-- on September 06, 2008, 04:56:44 AM
Increase the memory bufer size until it displays correctly. It is basically alloca6ed memory that the dialog memory template is written to so if you have a large number of controls, you will need more memory to store the template.
Title: Re: HELP with MASM Number of Controls
Post by: MEPHiST0 on September 06, 2008, 05:35:54 AM
That worked!

Thank you very much!