flat assembler
Message board for the users of flat assembler.

Index > Windows > converting Iczelion's-Tut10 part1 to FASM

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 22 Dec 2019, 08:51
I am tring to convert Iczelion's-Tut10 part1 to FASM(using dialog box template as a class template ,register with RegisterClassEx call).Although I managed to open a dialogbox with menu, menu items not working (well only 'Exit' item should work), and the close button( in upper right) not working. File is attached with this.Could someone please help? Sad Sad


Description:
Download
Filename: win32p15.ASM
Filesize: 9.92 KB
Downloaded: 570 Time(s)

Post 22 Dec 2019, 08:51
View user's profile Send private message Send e-mail Reply with quote
Walter



Joined: 26 Jan 2013
Posts: 155
Walter 22 Dec 2019, 15:44
All of those examples are posted here somewhere from long ago.
I recall having to change 'return' to 'ret' in each example.

Code:
;******************
;* Tutorial10.asm *
;******************

include 'win32ax.inc'

.data
     hMain     dd   ?
     hInstance dd   ?

     wTitle    db   'Tutorial 10',0
     wClsName  db   'DLGCLASS',0

     wMsg      MSG
     wCls      WNDCLASS

     ;experiment variables
     expDlgName     db   'My Dialog',0
     expTxt         db   "Wow! I'm in an edit box now",0
     expBuffer:     times 513 db 0
     expHDlg        dd   ?

.code
     start:
          ; +---------------------------+
          ; | register the window class |
          ; +---------------------------+
          invoke    GetModuleHandle,NULL
                    mov  [hInstance],eax
          invoke    DialogBoxParam,[hInstance],31,NULL,dialog_procedure,NULL
          invoke    ExitProcess,0

          ; +----------------------+
          ; | the dialog procedure |
          ; +----------------------+
          proc dialog_procedure,hDlg,uMsg,wParam,lParam
               push ebx esi edi
               cmp  [uMsg],WM_COMMAND
               je   wmCOMMAND
               cmp  [uMsg],WM_CLOSE
               je   wmCLOSE
               cmp  [uMsg],WM_INITDIALOG
               je   wmINITDIALOG
               jmp  wmBYE

               wmINITDIALOG:
                    invoke    GetDlgItem,[hDlg],3000
                    invoke    SetFocus,eax
                              jmp  wmBYE
               wmCLOSE:
                    invoke    SendMessage,[hDlg],WM_COMMAND,3002,0
                              jmp  wmBYE

               wmCOMMAND:
                    cmp  [wParam],0xFFFF and 32000
                    je   wmCOMMAND_32000
                    cmp  [wParam],0xFFFF and 32001
                    je   wmCOMMAND_32001
                    cmp  [wParam],0xFFFF and 32002
                    je   wmCOMMAND_32002
                    cmp  [wParam],BN_CLICKED shl 16 or 3002
                    je   wmCOMMAND_3002
                    cmp  [wParam],BN_CLICKED shl 16 or 3001
                    je   wmCOMMAND_3001
                    jmp  wmBYE

                    wmCOMMAND_3002:     ;exit button
                         invoke    EndDialog,[hDlg],0
                                   jmp  wmBYE
                    wmCOMMAND_3001:     ;say hello button
                         invoke    SetDlgItemText,[hDlg],3000,expTxt
                                   jmp  wmBYE
                    wmCOMMAND_32000:    ;menu get text
                         invoke    GetDlgItemText,[hDlg],3000,expBuffer,512
                         invoke    MessageBox,NULL,expBuffer,expDlgName,MB_OK
                                   jmp  wmBYE
                    wmCOMMAND_32001:    ;clear text
                         invoke    SetDlgItemText,[hDlg],3000,NULL
                                   jmp  wmBYE
                    wmCOMMAND_32002:    ;exit
                         invoke    SendMessage,[hDlg],WM_COMMAND,3002,0
                                   jmp  wmBYE

               wmBYE:
                    pop  edi esi ebx
                    xor  eax,eax
                    ret
          endp

section '.rsrc' resource data readable
     directory RT_MENU,appMenu,\
               RT_DIALOG,appDialog

     resource  appMenu,\
               30,LANG_NEUTRAL,menuMain
     resource  appDialog,\
               31,LANG_NEUTRAL,dlgMain

     menu menuMain
          menuitem  'Test Controls',0,MFR_POPUP + MFR_END
          menuitem       'Get Text',32000,MFT_STRING
          menuitem       'Clear Text',32001,MFT_STRING
                         menuseparator
          menuitem       'E&xit',32002,MFR_END

     dialog dlgMain,'Our First Dialog Box',10,10,205,60,\
          DS_CENTER + WS_CAPTION + WS_MINIMIZEBOX + WS_SYSMENU + WS_VISIBLE + WS_OVERLAPPED + DS_MODALFRAME + DS_3DLOOK,,30
          dialogitem     'EDIT','',3000,15,17,111,13,ES_AUTOHSCROLL + ES_LEFT + WS_BORDER + WS_VISIBLE + WS_TABSTOP
          dialogitem     'BUTTON','Say Hello',3001,141,10,52,13,BS_DEFPUSHBUTTON + WS_VISIBLE + WS_TABSTOP
          dialogitem     'BUTTON','E&xit',3002,141,26,52,13,WS_VISIBLE + WS_TABSTOP
     enddialog

.end start

    
Post 22 Dec 2019, 15:44
View user's profile Send private message Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 22 Dec 2019, 17:07
Walter thank you for your kind reply.but your post shows how to create a dialogbox with
"DialogBoxParam" and calling dialog box procedure for handling messages.I want to create dialogbox with "CreateDialogParam" and handling messages with window procedure.(registering dialog box template as a class template).
Actually there are posts in this message board which shows the Iczelion's tutorials in FASM, but they shows only the way you posted. Sad Sad
Post 22 Dec 2019, 17:07
View user's profile Send private message Send e-mail Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 23 Dec 2019, 09:07
Come on guys please help me....?
it seems dialogbox created here dosen't made from the registered template.
Sad


Code:
format PE GUI 4.0
entry start


 include 'WIN32Ax.inc'
 ;include 'rcWin32.inc'                 ;a custom inc file
 ;--------------------------------------------------------------
 IDR_MAINMENU   =  2000
 IDR_DIALOG     =  2001

 IDC_EDIT       =  5000

 IDB_BUTTON     =  4000


 IDM_HELLO      =  1000
 IDM_CLEAR      =  1001
 IDM_GETTEXT    =  1002
 IDM_EXIT       =  1003
 IDM_EDIT       =  1004
;--------------------------------------------------------------

;/////////////////////////////////////////////////////////////////////////////////////////////////////
 section '.data' data readable writeable
;========================================================================================================
    MenuName            = IDR_MAINMENU
    DlgsName            db 'MNSdlgName',0
    DlgClassName        = IDR_DIALOG
    EditName            db 'EDIT',0
    ButtonClassName     db 'BUTTON',0

    ButtonText          db 'my button',0
    ErrTxt1             db 'Registering window class Failed',0
    ErrTxt2             db 'Fail to create a window using DlgClassName',0
    ErrTxt3             db 'Error in the message loop of the window',0
    ErrMsgBoxCaption    db 'Program Error',0
    TestString          db 'Hello edit',0
    text2               db 'menu',0
    buffer              rb 520

    msg                 MSG
    wc                  WNDCLASSEX
    cmdLine             dd ?
    hInst               dd ?
    hwndDlg             dd ?
    hwndEdit            dd ?
    hwndButton          dd ?
;======================================================================================================
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;//////////////////////////////////////////////////////////

;/////////////////////////////////////////////////////////////////////////////////////////////////////
 section '.code' code readable executable
;=====================================================================================================
    start:
       invoke      GetModuleHandle,0
       mov         [hInst],eax
       invoke      GetCommandLine
       mov         [cmdLine],eax
       stdcall     WinMain,[hInst],NULL,[cmdLine],SW_SHOWDEFAULT
       invoke      ExitProcess,eax

;-----------------------WinMain Procedure-------------------------------------------------------------
       proc WinMain   hInstance:DWORD,hPrvinstance:DWORD,commandLine:DWORD,cmdshow:DWORD


       ;----declare window struct----------------------------
         push        [hInst]
         pop         [wc.hInstance]
         mov         [wc.cbSize], sizeof.WNDCLASSEX
         mov         [wc.style], 0
         mov         [wc.lpfnWndProc],WindowProc
         xor         eax,eax
         mov         [wc.cbClsExtra],eax
         mov         [wc.cbWndExtra],DLGWINDOWEXTRA            ;***** this needed
         mov         [wc.hbrBackground], COLOR_BTNFACE+1
         mov         [wc.lpszMenuName],MenuName
         mov         [wc.lpszClassName],DlgClassName
         invoke      LoadIcon, NULL, IDI_APPLICATION
         mov         [wc.hIcon], eax
         mov         [wc.hIconSm], eax
         invoke      LoadCursor, NULL, IDC_ARROW
         mov         [wc.hCursor], eax

       ;----Registering window class----------
         invoke      RegisterClassEx, wc
         or          eax,eax
         jz          err1;end_loop

       ;-----Create modeless dialogbox---------
         invoke      CreateDialogParam,[hInst],DlgClassName,NULL,0,0
         mov         [hwndDlg],eax
         or          eax,eax
         jz          err2;end_loop

       ;-----Show window----------------------
         invoke      ShowWindow, [hwndDlg],SW_SHOWNORMAL

       ;-----Update window---------------------
         invoke      UpdateWindow, [hwndDlg]

       ;-----Set focus on dialog item-------------
         invoke      GetDlgItem,[hwndDlg],IDC_EDIT          ;return the control's window handle in eax from control id
         invoke      SetFocus,eax
         ;jmp         end_loop

       ;-----message loop----------------------
         msg_loop:
              invoke      GetMessage,msg,NULL,0,0
              cmp         eax,0
              je          end_loop
              jb          err3
              invoke      IsDialogMessage, [hwndDlg],msg
              or          eax,eax
              jnz         msg_loop
              invoke      TranslateMessage,msg
              invoke      DispatchMessage,msg
              jmp         msg_loop

        err1:
              invoke      MessageBox, 0,ErrTxt1,ErrMsgBoxCaption, MB_OK
              jmp         end_loop
        err2:
              invoke      MessageBox, 0,ErrTxt2,ErrMsgBoxCaption, MB_OK
              jmp         end_loop
        err3:
              invoke      MessageBox, 0,ErrTxt3,ErrMsgBoxCaption, MB_OK
              jmp         end_loop

         end_loop:
              mov         eax,[msg.wParam]
              ret
       endp

;----------------------------------------------------------------------------------------------------------

;------------------------------------window procedure------------------------------------------------------
       proc       WindowProc hwnd:DWORD,umsg:DWORD,wParam:DWORD,lparam:DWORD

         push        ebx esi edi
         cmp         [umsg],WM_CLOSE
         je          ..endProgrm
         cmp         [umsg],WM_DESTROY
         je          .wmdestroy
         cmp         [umsg],WM_COMMAND
         je          .Commands
         .defwndproc:
               invoke     DefWindowProc,[hwnd],[umsg],[wParam],[lparam]
               jmp        .finish
         .Commands:
               xor        eax,eax
               mov        eax,[lparam]
               cmp        eax,0
               jne        ..chldCntrl
               mov        eax,[wParam]
               cmp        ax,IDM_EXIT
               je         ..endProgrm
               ;cmp        ax,IDM_HELLO
               ;je         ..wrtStrg
               ;cmp        ax,IDM_CLEAR
               ;je         ..clrStr
               ;cmp        ax,IDM_GETTEXT
               ;je         ..getText
               jmp        .finish

               ..wrtStrg:
                     ;invoke     SetWindowText,[hwndEdit],TestString
                     jmp        .finish

               ..clrStr:
                     ;invoke     SetWindowText,[hwndEdit],0
                     jmp        .finish

                ..getText:
                     ;invoke     GetWindowText,[hwndEdit],buffer,512
                     ;invoke     MessageBox,NULL,buffer,AppName,MB_OK
                     jmp        .finish

               ..chldCntrl:
                     mov        eax,[wParam]
                     cmp        ax,IDB_BUTTON
                     jne        .finish
                     shr        eax,16
                     cmp        ax,BN_CLICKED
                     jne        ..endProgrm
                     ;invoke     SendMessage,[hwnd],WM_COMMAND,IDM_GETTEXT,0
                     jmp        .finish

               ..endProgrm:
                    invoke      DestroyWindow,[hwnd]
         .wmdestroy:
               invoke     PostQuitMessage,0
               xor        eax,eax
         .finish:
               pop     edi esi ebx
        ret
       endp
;---------------------------------------------------------------------------------------------------------
;==========================================================================================================
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;//////////////////////////////////////////////////////////

;//////////////////////////////////////////////////////////////////////////////////////////////////////

 section '.idata' import data readable
;=======================================================================================================
  library kernel32,'KERNEL32.DLL',\
           user32,'USER32.DLL'

  include 'api/kernel32.inc'
  include 'api/USER32.inc'


;=======================================================================================================
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;//////////////////////////////////////////////////////////////////////////////////////////////////////
 section '.rsrc' resource data readable
;=======================================================================================================
  directory RT_DIALOG,dialogs,\
            RT_MENU,menus



  resource dialogs,IDR_DIALOG,LANG_ENGLISH+SUBLANG_DEFAULT,mydialogbox

   dialog mydialogbox,'dialogBox',70,70,190,175,WS_CAPTION+WS_SYSMENU+DS_MODALFRAME+WS_VISIBLE,,IDR_MAINMENU,'Times New Roman',10
     dialogitem 'EDIT','',IDC_EDIT,10,50,170,13,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL
     dialogitem 'BUTTON','open',IDB_BUTTON,50,10,52,13,WS_VISIBLE+WS_TABSTOP
     ;dialogitem 'BUTTON','OK',IDOK,10,10,45,15,WS_VISIBLE+WS_TABSTOP
   enddialog

  resource menus,IDR_MAINMENU,LANG_ENGLISH+SUBLANG_DEFAULT,mainMenu
     menu  mainMenu
    ;{
      menuitem '&File',0,MFR_POPUP
       ;{
          menuitem '&Hello',IDM_HELLO
          menuitem '&Clear',IDM_CLEAR
          menuseparator
          menuitem 'E&xit',IDM_EXIT,MFR_END
       ;}
     menuitem '&Edit',IDM_EDIT,MFR_END
    ;}






;=======================================================================================================
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\    
Post 23 Dec 2019, 09:07
View user's profile Send private message Send e-mail Reply with quote
Walter



Joined: 26 Jan 2013
Posts: 155
Walter 23 Dec 2019, 13:19
In CreateDialogParam, is it intentional that DlgProc callback paramater is 0?
Post 23 Dec 2019, 13:19
View user's profile Send private message Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 23 Dec 2019, 14:15
yes.I think, so that windows procedure can handle messages.
link to Iczelion's tutorial 10 - http://www.interq.or.jp/chubu/r6/masm32/tute/tute010.html (please see the first example)
Post 23 Dec 2019, 14:15
View user's profile Send private message Send e-mail Reply with quote
Walter



Joined: 26 Jan 2013
Posts: 155
Walter 23 Dec 2019, 15:32
More examples.

https://wasm.in/threads/uroki-iczeliona-ot-sulaiman-chang-na-dialekte-fasm.31759/

In particular, tut_10c which nulls the DlgProc and uses WndProc to handle messages.
Post 23 Dec 2019, 15:32
View user's profile Send private message Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 23 Dec 2019, 17:54
Thank you very much.Actually I have seen it and tried to understand the problem of my code compaired to it, but no luck.
Post 23 Dec 2019, 17:54
View user's profile Send private message Send e-mail Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 25 Dec 2019, 17:59
Walter when I was experimenting with the code in your link, I have encountered a strange thing which may also be the cause of the problem I have been having. The asm file in that example(tut_10c.asm) compiled with the .res file(tut_10c.res which contain dialogbox and menu resource) using fasm, menu and buttons of the resulted exe file worked properly(both are attached with this as zip file-->tut_10c.zip). but when the asm file modified(modifd_tut_10c.asm) to have dialogbox and menu resorces instead of using .res file resulting exe file from FASM not working as expected.(menu and buttons not working) see the modifiedTut10.zip attached with this.


Description:
Download
Filename: modifiedTut10.zip
Filesize: 1.82 KB
Downloaded: 518 Time(s)

Description: Original example files
Download
Filename: tut_10c.zip
Filesize: 1.97 KB
Downloaded: 524 Time(s)

Post 25 Dec 2019, 17:59
View user's profile Send private message Send e-mail Reply with quote
Walter



Joined: 26 Jan 2013
Posts: 155
Walter 25 Dec 2019, 23:03
mns,

Interesting. Might have been the problem all along.
Your menus were there but did not respond.

I'll give you an idea to work with here.
But I may not be much help.

I disassembled the resource sections from your modified version:

Image

and from the orginal version.

Image

The difference that I find most important is the "CLASS"
statement. That is in the orginal version produced by
a resource compiler.

Here is more detail about the "CLASS" statement:

https://docs.microsoft.com/en-us/windows/win32/menurc/class-statement

That would explain not having callbacks for menu items (?)?

I have never had to use that statement and with fasm, I don't
believe you can.

From the fasm manual:

Code:
The dialogitem has eight required parameters and one optional. First parameter
should be the quoted string containing the class name for the item. Second parameter
can be either the quoted string containing text for the item, or resource identifier in
case when the contents of item has to be defined by some additional resource (like the
item of STATIC class with the SS_BITMAP style). The third parameter is the identifier for
the item, used to identify the item by the API functions. Next four parameters specify
the horizontal, vertical coordinates, the width and height of the item respectively. The
eighth parameter specifies the style for the item, and the optional ninth specifies the
extended style flags.    


No mention for optional resource statement options. It is an optional resource statement that probably is just not used often.

Wish I could have helped more, but maybe someone else can jump in here.
Post 25 Dec 2019, 23:03
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 799
Location: Russian Federation, Sochi
ProMiNick 26 Dec 2019, 05:01
That wasn`t problem for fasm for a long time (resurces macros already customized by me)

use this dialog macros:
Code:
macro dlgdefprop prop:''& {
   local ..done
   ..done = $
   match  any =, more,prop \{ du prop,0 \}
   if $ = ..done
     if prop eqtype ''
       if prop eq ''
         dw 0
       else
         du prop,0
       end if
     else
       if ~prop
         dw 0
       else
         dw -1,prop
       end if
     end if
   end if }

macro dlgdefchild class:''& {
   local ..done,tmpclass
   ..done = $
   match  any =, more,class \{ du class,0 \}
   if $ = ..done
       if class eqtype ''
         if class eq 'BUTTON'
           dw -1, 80h
         else if class eq 'EDIT'
           dw -1, 81h
         else if class eq 'STATIC'
           dw -1, 82h
         else if class eq 'LISTBOX'
           dw -1, 83h
         else if class eq 'SCROLLBAR'
           dw -1, 84h
         else if class eq 'COMBOBOX'
           dw -1, 85h
         else if class eq ''
           dw 0
         else
           du class,0
         end if
       else
         if (class and 1Fh) =10 | (class and 1Fh) =16 | (class-(class and 80h))>18h | class<0
           .err unsupported classID = class
         end if
         dw -1,class
       end if
   end if }

macro dialog label,class,title,x,y,cx,cy,style:0,exstyle:0,menu,fontname,fontsize:0
 { local data,size,items
   label dd RVA data,size,0,0
   data dd style,exstyle
   dw items,x,y,cx,cy
   dlgdefprop menu
   dlgdefprop class
   dlgdefprop title
   if style and DS_SETFONT
     if fontname eq
       du 8,'MS Sans Serif',0
     else
       du fontsize,fontname,0
     end if
   end if
   align 4
   dialog_size equ size = $ - data
   dialog_items equ items = dialog_items_counter
   dialog_items_counter = 0

   macro dlgitmxtrdata
   \{ local fin
      store word (fin-$) at $-2
      macro enddlgitmxtrdata \\{ fin = $ \\} \}

   macro enddialog
   \{ dialog_items
   dialog_size
      purge dlgitmxtrdata,enddialog,enddlgitmxtrdata \}
   }

ANSl_CHARSET       = 0
DEFAULT_CHARSET     = 1
SYMBOL_CHARSET      = 2
MAC_CHARSET         = 77
SHIFTJIS_CHARSET    = 128
HANGEUL_CHARSET     = 129
HANGUL_CHARSET      = 129
JOHAB_CHARSET       = 130
GB2312_CHARSET      = 134
CHINESEBIG5_CHARSET = 136
GREEK_CHARSEO       = 161
TURKISH_CHARSET     = 162
VIETNAMESE_CHARSET  = 163
HEBREW_CHARSET      = 177
ARABIC_CHARSET      = 178
BALTIC_CHARSET      = 186
THAI_CHARSET        = 222
EASTEUROPE_CHARSET  = 238
RUSSIAN_CHARSET     = 204
OEM_CHARSET         = 255

macro dialogex label,class,title,x,y,cx,cy,style:0,exstyle:0,menu,helpID:0,fontname,fontsize:0,fontweight:0,italic:0,charset:1
 { local data,size,items
   label dd RVA data,size,0,0
   align 16
   data dw 1,0FFFFh
   dd helpID
   dd exstyle,style
   dw items,x,y,cx,cy
   dlgdefprop menu
   dlgdefprop class
   dlgdefprop title
   ;fontweight=0..1000; 0=default=400; bold = 700
   if style and DS_SETFONT  ;or DS_SHELLFONT=DS_SETFONT or DS_FIXEDSYS
     if fontname eq
       dw 8,400
       db italic, charset
       du 'MS Sans Serif',0
     else
       dw fontsize,fontweight
       db italic, charset
       du fontname,0
     end if
   end if
   align 4
   dialog_size equ size = $ - data
   dialog_items equ items = dialog_items_counter
   dialog_items_counter = 0

   macro dlgitmxtrdata
   \{ local fin
      store word (fin-$) at $-2
      macro enddlgitmxtrdata \\{ fin = $ \\} \}

   macro enddialog
   \{ dialog_items
   dialog_size
      purge dlgitmxtrdata,enddialog,enddlgitmxtrdata \}
   }

macro dialogitem class,title,id,x,y,cx,cy,style:0,exstyle:0
 { align 4
   dd style or WS_CHILD,exstyle
   dw x,y,cx,cy,id
   dlgdefchild class
   dlgdefprop title
   dw 0
   dialog_items_counter = dialog_items_counter + 1 }


macro dialogitemex class,title,id,x,y,cx,cy,style:0,exstyle:0,helpID:0
 { align 4
   dd helpID,exstyle,style or WS_CHILD
   dw x,y,cx,cy
   dd id ; against dialogitem here ID has dword size
   dlgdefchild class
   dlgdefprop title
   dw 0
   dialog_items_counter = dialog_items_counter + 1 }    


I don`t find practical applience (to some improvements) at the moment I designed them but thou did.
Post 26 Dec 2019, 05:01
View user's profile Send private message Send e-mail Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 26 Dec 2019, 05:46
Thank you very much Walter and ProMiNick for your kind responses. (also when I opened modified exe file with ResEdit It gives a error regarding menu statement in dialogbox resource dosen't refer to a menu.I attached the screen shot.)
I will follow your leads to correct my problem(and learn something.)Thank you again. Very Happy


Description:
Filesize: 71.16 KB
Viewed: 22065 Time(s)

Capture1.JPG


Post 26 Dec 2019, 05:46
View user's profile Send private message Send e-mail Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 26 Dec 2019, 08:28
ProMiNick I don't have much knowladege about Macro . But I copied your macro definitions and replaced every thing named dialog in "resource.inc"( in FASM \include\MACRO folder)with it.Then in my file added lable of the class name of the dialog resource(zero ended string) just after the lable of the dialog box.And tried to compile.But FASM giving a error
"Error: value out of range"
instruction:
dw-1,ClassName

Have I done it wrong?
Embarassed Confused


Description:
Download
Filename: Remodifd_tut_10c.ASM
Filesize: 4.23 KB
Downloaded: 496 Time(s)

Post 26 Dec 2019, 08:28
View user's profile Send private message Send e-mail Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 799
Location: Russian Federation, Sochi
ProMiNick 26 Dec 2019, 10:03
I guess
Code:
dialog DIALOGEXS,'DLGCLASS',"Iczelion Tutorial #10c: CreateDialogParam+WndProc+Class",10, 10, 230, 60,DS_CENTER+WS_CAPTION+WS_MINIMIZEBOX+WS_SYSMENU+WS_VISIBLE+WS_OVERLAPPED+DS_MODALFRAME+DS_3DLOOK,,IDC_MENU,'Times New Roman',10    


not

Code:
dialog DIALOGEXS,ClassName,"Iczelion Tutorial #10c: CreateDialogParam+WndProc+Class",10, 10, 230, 60,DS_CENTER+WS_CAPTION+WS_MINIMIZEBOX+WS_SYSMENU+WS_VISIBLE+WS_OVERLAPPED+DS_MODALFRAME+DS_3DLOOK,,IDC_MENU,'Times New Roman',10    
Post 26 Dec 2019, 10:03
View user's profile Send private message Send e-mail Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 26 Dec 2019, 10:26
yes I have done both ways.
The error I posted was from the second one
dialog DIALOGEXS,ClassName,"Iczelion Tutorial #10c: CreateDialogParam+WndProc+Class",10, 10, 230, 60,DS_CENTER+WS_CAPTION+WS_MINIMIZEBOX+WS_SYSMENU+WS_VISIBLE+WS_OVERLAPPED+DS_MODALFRAME+DS_3DLOOK,,IDC_MENU,'Times New Roman',10

The first one compiled without error. But the resulted exe dosen't showed a messagebox.So I have changed the asm file to show error message if "CreateDialogParam" failed. and the resulting exe suggest it failed in creating dialogbox.
(please see the attached file)


Description:
Download
Filename: Remodifd2_tut_10c.ASM
Filesize: 4.51 KB
Downloaded: 502 Time(s)

Post 26 Dec 2019, 10:26
View user's profile Send private message Send e-mail Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 799
Location: Russian Federation, Sochi
ProMiNick 26 Dec 2019, 11:58
left only compare binaries and found out what thours example produce wrong.
Post 26 Dec 2019, 11:58
View user's profile Send private message Send e-mail Reply with quote
Mikl___



Joined: 30 Dec 2014
Posts: 129
Location: Russian Federation, Irkutsk
Mikl___ 26 Dec 2019, 13:11
Code:
┌─────────────────────────┬───────┬────────┬───────┐
│                         │DlgProc│ DlgProc│WndProc│
│                         │       │+WndProc│ +Class│
├─────────────────────────┼───────┼────────┼───────┤
│DialogBoxParam           │    10a│     10b│    10c│
├───────-─────────────────┼───────┼────────┼───────┤
│CreateDialogParam        │    10d│     10e│    10f│
├──────────────-──────────┼───────┼────────┼───────┤
│DialogBoxIndirectParam   │    10g│     10i│    10k│
├─────────────────────────┼───────┼────────┼───────┤
│CreateDialogIndirectParam│    10h│     10j│    10l│
└─────────────────────────┴───────┴-───────┴───────┘    

There are twelve ways to create dialogs
It’s unfortunate that the forum engine does not support table creation Image
Post 26 Dec 2019, 13:11
View user's profile Send private message Visit poster's website Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 27 Dec 2019, 14:34
Thank you Mikl___ .But (no disrespect) it won't address my problem(I think).MY problem is to create dialogbox with FASM syntax+CreateDialogParam+wind procedure+dialogbox template(class) defined in same asm file(as "section '.rsrc' resource") not in .res file . Confused
Post 27 Dec 2019, 14:34
View user's profile Send private message Send e-mail Reply with quote
Mikl___



Joined: 30 Dec 2014
Posts: 129
Location: Russian Federation, Irkutsk
Mikl___ 27 Dec 2019, 15:53
Hi, mns!
Iczelion showed two ways to create dialogs. I show that there are 12 such methods. You will find asm- and rc-files on the link. The transition from masm to fasm dialect is quite simple. I think that you will succeed. Only I did not understand why "no disrespect"? What have I done wrong?
Post 27 Dec 2019, 15:53
View user's profile Send private message Visit poster's website Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 27 Dec 2019, 17:25
Mikl___
No. it means that, please don't think I am disrespecting you by saying "It won't address my problem". Smile



Yes your link show 12 ways to create a dialogbox in masm. But the problem I was facing is converting CreateDialogParam+wndproc+class to FASM.Especially when dialogbox resource(with menu) in '.rsrc' resource section (not in a seperate .res or .rc file)

Attached file in my first post (win32p15.ASM) I managed to convert it to FASM and resulting exe produced a dialogbox with menu and button but menu or button didn't worked.
Post 27 Dec 2019, 17:25
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.