Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Masm32 language

elryb2k14

Novice
Advanced Member
Messages
30
Reaction score
0
Points
26
View attachment 308257View attachment 308258

:help: HELP PLEASE MGA TS MASM32 , im using MBUILDER APPLICATION kaylangan kasi pag naglagay ako ng point or dot ( . ) dpat INVALID ang lalabas kaso d ko alam ang code nasa picture po ang reference at nasa baba ang codes , Please mga TS yung marunong , Simple code lng po yan :help:

.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\gdi32.inc
include \masm32\include\comdlg32.inc
include \masm32\include\shell32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\comdlg32.lib
includelib \masm32\lib\shell32.lib
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
RGB macro red,green,blue
xor eax,eax
mov ah,blue
shl eax,8
mov ah,green
mov al,red
endm
szText MACRO Name,Text:VARARG
LOCAL lbl
jmp lbl
Name db Text,0
lbl:
ENDM
.const
Edit2ID equ 13
Button1ID equ 12
Edit1ID equ 11
Label10ID equ 10
Label9ID equ 9
Label8ID equ 8
Label7ID equ 7
Label6ID equ 6
Label5ID equ 5
Label4ID equ 4
Label3ID equ 3
Label2ID equ 2
Label1ID equ 1
.data?
hFontN HWND ?
hwndEdit2 HWND ?
hwndButton1 HWND ?
hwndEdit1 HWND ?
hwndLabel10 HWND ?
hwndLabel9 HWND ?
hwndLabel8 HWND ?
hwndLabel7 HWND ?
hwndLabel6 HWND ?
hwndLabel5 HWND ?
hwndLabel4 HWND ?
hwndLabel3 HWND ?
hwndLabel2 HWND ?
hwndLabel1 HWND ?
hInstance HINSTANCE ?
CommandLine LPSTR ?
.data
lf LOGFONT <>
TextEdit2 db 0,0
TextButton1 db "Enter",0
TextEdit1 db 0,0
TextLabel10 db "Senior",0
TextLabel9 db "Junior",0
TextLabel8 db "Sophomore",0
TextLabel7 db "Freshmen",0
TextLabel6 db "4",0
TextLabel5 db "3",0
TextLabel4 db "2",0
TextLabel3 db "1",0
TextLabel2 db "Level",0
TextLabel1 db "Year",0
szFontName db "MS Sans Serif",0
;_______________
msg1 db "Freshmen" ,0
msg2 db "Sophomore" ,0
msg3 db "Junior" ,0
msg4 db "Senior" ,0
msg5 db "Invalid Input" ,0
ClassName db "mbuilder",0
BtnClName db "button",0
StatClName db "static",0
EditClName db "edit",0
LboxClName db "listbox",0
CboxClName db "combobox",0
ReditClName db "richedit",0
RichEditLib db "riched32.dll",0
FormCaption db "Year",0
;_______________
.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke GetCommandLine
invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
invoke ExitProcess,eax
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc :WNDCLASSEX
LOCAL msg :MSG
LOCAL hwnd :HWND
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style,CS_BYTEALIGNCLIENT
mov wc.lpfnWndProc,offset WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground,COLOR_BTNFACE+1
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx,addr wc
invoke CreateWindowEx,0,ADDR ClassName,ADDR FormCaption,WS_SYSMENU or WS_SIZEBOX,491,85,384,391,0,0,hInst,0
mov hwnd,eax
INVOKE ShowWindow,hwnd,SW_SHOWNORMAL
INVOKE UpdateWindow,hwnd
.WHILE TRUE
invoke GetMessage,ADDR msg,0,0,0
.BREAK .IF (!eax)
invoke TranslateMessage,ADDR msg
invoke DispatchMessage,ADDR msg
.ENDW
mov eax,msg.wParam
ret
WinMain endp
WndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.IF uMsg == WM_DESTROY
invoke PostQuitMessage,NULL
.ELSEIF uMsg == WM_CREATE
invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR EditClName,ADDR TextEdit2,WS_CHILD or ES_LEFT or ES_AUTOHSCROLL or WS_VISIBLE,56,288,257,24,hWnd,Edit2ID,hInstance,0
mov hwndEdit2,eax
invoke CreateWindowEx,0,ADDR BtnClName,ADDR TextButton1,WS_CHILD or BS_DEFPUSHBUTTON or WS_VISIBLE,224,224,75,25,hWnd,Button1ID,hInstance,0
mov hwndButton1,eax
invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR EditClName,ADDR TextEdit1,WS_CHILD or ES_LEFT or ES_AUTOHSCROLL or WS_VISIBLE,56,224,121,24,hWnd,Edit1ID,hInstance,0
mov hwndEdit1,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel10,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,232,176,49,20,hWnd,Label10ID,hInstance,0
mov hwndLabel10,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel9,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,232,136,46,20,hWnd,Label9ID,hInstance,0
mov hwndLabel9,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel8,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,232,96,84,20,hWnd,Label8ID,hInstance,0
mov hwndLabel8,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel7,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,232,56,72,20,hWnd,Label7ID,hInstance,0
mov hwndLabel7,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel6,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,56,176,12,20,hWnd,Label6ID,hInstance,0
mov hwndLabel6,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel5,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,56,136,12,20,hWnd,Label5ID,hInstance,0
mov hwndLabel5,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel4,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,56,96,12,20,hWnd,Label4ID,hInstance,0
mov hwndLabel4,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel3,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,56,56,12,20,hWnd,Label3ID,hInstance,0
mov hwndLabel3,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel2,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,248,16,42,20,hWnd,Label2ID,hInstance,0
mov hwndLabel2,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel1,WS_CHILD or SS_LEFT or SS_NOTIFY,0,0,48,13,hWnd,Label1ID,hInstance,0
mov hwndLabel1,eax
invoke lstrcpy,addr lf.lfFaceName,addr szFontName
mov lf.lfWeight,500
mov lf.lfHeight,-11
invoke CreateFontIndirect,addr lf
mov hFontN,eax
invoke SendMessage,hwndEdit2,WM_SETFONT,hFontN,1
invoke SendMessage,hwndEdit1,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel10,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel9,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel8,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel7,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel6,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel5,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel4,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel3,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel2,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel1,WM_SETFONT,hFontN,1
invoke SendMessage,hwndButton1,WM_SETFONT,hFontN,1
.ELSEIF uMsg == WM_COMMAND
mov eax,wParam
.IF lParam != 0
.IF ax == Label1ID
shr eax,16
.IF ax == STN_CLICKED

.ENDIF
.ELSEIF ax == Button1ID
shr eax,16
.IF ax == BN_CLICKED
invoke GetDlgItemInt,hWnd,Edit1ID,0,1

.IF eax == 1
invoke SetWindowText,hwndEdit2,addr msg1
.ELSEIF eax == 2
invoke SetWindowText,hwndEdit2,addr msg2
.ELSEIF eax == 3
invoke SetWindowText,hwndEdit2,addr msg3
.ELSEIF eax == 4
invoke SetWindowText,hwndEdit2,addr msg4
.ELSEIF
invoke SetWindowText,hwndEdit2,addr msg5
.ELSEIF
.ENDIF

.ENDIF
.ENDIF
.ENDIF
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.ENDIF
xor eax,eax
ret
WndProc endp
end start
 

Attachments

  • Untitled.png
    Untitled.png
    68.8 KB · Views: 2
  • asd.png
    asd.png
    71 KB · Views: 2
View attachment 1190161View attachment 1190162

:help: HELP PLEASE MGA TS MASM32 , im using MBUILDER APPLICATION kaylangan kasi pag naglagay ako ng point or dot ( . ) dpat INVALID ang lalabas kaso d ko alam ang code nasa picture po ang reference at nasa baba ang codes , Please mga TS yung marunong , Simple code lng po yan :help:

.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\gdi32.inc
include \masm32\include\comdlg32.inc
include \masm32\include\shell32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\comdlg32.lib
includelib \masm32\lib\shell32.lib
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
RGB macro red,green,blue
xor eax,eax
mov ah,blue
shl eax,8
mov ah,green
mov al,red
endm
szText MACRO Name,Text:VARARG
LOCAL lbl
jmp lbl
Name db Text,0
lbl:
ENDM
.const
Edit2ID equ 13
Button1ID equ 12
Edit1ID equ 11
Label10ID equ 10
Label9ID equ 9
Label8ID equ 8
Label7ID equ 7
Label6ID equ 6
Label5ID equ 5
Label4ID equ 4
Label3ID equ 3
Label2ID equ 2
Label1ID equ 1
.data?
hFontN HWND ?
hwndEdit2 HWND ?
hwndButton1 HWND ?
hwndEdit1 HWND ?
hwndLabel10 HWND ?
hwndLabel9 HWND ?
hwndLabel8 HWND ?
hwndLabel7 HWND ?
hwndLabel6 HWND ?
hwndLabel5 HWND ?
hwndLabel4 HWND ?
hwndLabel3 HWND ?
hwndLabel2 HWND ?
hwndLabel1 HWND ?
hInstance HINSTANCE ?
CommandLine LPSTR ?
.data
lf LOGFONT <>
TextEdit2 db 0,0
TextButton1 db "Enter",0
TextEdit1 db 0,0
TextLabel10 db "Senior",0
TextLabel9 db "Junior",0
TextLabel8 db "Sophomore",0
TextLabel7 db "Freshmen",0
TextLabel6 db "4",0
TextLabel5 db "3",0
TextLabel4 db "2",0
TextLabel3 db "1",0
TextLabel2 db "Level",0
TextLabel1 db "Year",0
szFontName db "MS Sans Serif",0
;_______________
msg1 db "Freshmen" ,0
msg2 db "Sophomore" ,0
msg3 db "Junior" ,0
msg4 db "Senior" ,0
msg5 db "Invalid Input" ,0
ClassName db "mbuilder",0
BtnClName db "button",0
StatClName db "static",0
EditClName db "edit",0
LboxClName db "listbox",0
CboxClName db "combobox",0
ReditClName db "richedit",0
RichEditLib db "riched32.dll",0
FormCaption db "Year",0
;_______________
.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke GetCommandLine
invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
invoke ExitProcess,eax
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc :WNDCLASSEX
LOCAL msg :MSG
LOCAL hwnd :HWND
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style,CS_BYTEALIGNCLIENT
mov wc.lpfnWndProc,offset WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground,COLOR_BTNFACE+1
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx,addr wc
invoke CreateWindowEx,0,ADDR ClassName,ADDR FormCaption,WS_SYSMENU or WS_SIZEBOX,491,85,384,391,0,0,hInst,0
mov hwnd,eax
INVOKE ShowWindow,hwnd,SW_SHOWNORMAL
INVOKE UpdateWindow,hwnd
.WHILE TRUE
invoke GetMessage,ADDR msg,0,0,0
.BREAK .IF (!eax)
invoke TranslateMessage,ADDR msg
invoke DispatchMessage,ADDR msg
.ENDW
mov eax,msg.wParam
ret
WinMain endp
WndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.IF uMsg == WM_DESTROY
invoke PostQuitMessage,NULL
.ELSEIF uMsg == WM_CREATE
invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR EditClName,ADDR TextEdit2,WS_CHILD or ES_LEFT or ES_AUTOHSCROLL or WS_VISIBLE,56,288,257,24,hWnd,Edit2ID,hInstance,0
mov hwndEdit2,eax
invoke CreateWindowEx,0,ADDR BtnClName,ADDR TextButton1,WS_CHILD or BS_DEFPUSHBUTTON or WS_VISIBLE,224,224,75,25,hWnd,Button1ID,hInstance,0
mov hwndButton1,eax
invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR EditClName,ADDR TextEdit1,WS_CHILD or ES_LEFT or ES_AUTOHSCROLL or WS_VISIBLE,56,224,121,24,hWnd,Edit1ID,hInstance,0
mov hwndEdit1,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel10,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,232,176,49,20,hWnd,Label10ID,hInstance,0
mov hwndLabel10,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel9,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,232,136,46,20,hWnd,Label9ID,hInstance,0
mov hwndLabel9,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel8,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,232,96,84,20,hWnd,Label8ID,hInstance,0
mov hwndLabel8,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel7,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,232,56,72,20,hWnd,Label7ID,hInstance,0
mov hwndLabel7,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel6,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,56,176,12,20,hWnd,Label6ID,hInstance,0
mov hwndLabel6,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel5,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,56,136,12,20,hWnd,Label5ID,hInstance,0
mov hwndLabel5,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel4,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,56,96,12,20,hWnd,Label4ID,hInstance,0
mov hwndLabel4,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel3,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,56,56,12,20,hWnd,Label3ID,hInstance,0
mov hwndLabel3,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel2,WS_CHILD or SS_LEFT or SS_NOTIFY or WS_VISIBLE,248,16,42,20,hWnd,Label2ID,hInstance,0
mov hwndLabel2,eax
invoke CreateWindowEx,WS_EX_LEFT,ADDR StatClName,ADDR TextLabel1,WS_CHILD or SS_LEFT or SS_NOTIFY,0,0,48,13,hWnd,Label1ID,hInstance,0
mov hwndLabel1,eax
invoke lstrcpy,addr lf.lfFaceName,addr szFontName
mov lf.lfWeight,500
mov lf.lfHeight,-11
invoke CreateFontIndirect,addr lf
mov hFontN,eax
invoke SendMessage,hwndEdit2,WM_SETFONT,hFontN,1
invoke SendMessage,hwndEdit1,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel10,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel9,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel8,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel7,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel6,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel5,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel4,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel3,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel2,WM_SETFONT,hFontN,1
invoke SendMessage,hwndLabel1,WM_SETFONT,hFontN,1
invoke SendMessage,hwndButton1,WM_SETFONT,hFontN,1
.ELSEIF uMsg == WM_COMMAND
mov eax,wParam
.IF lParam != 0
.IF ax == Label1ID
shr eax,16
.IF ax == STN_CLICKED

.ENDIF
.ELSEIF ax == Button1ID
shr eax,16
.IF ax == BN_CLICKED
invoke GetDlgItemInt,hWnd,Edit1ID,0,1

.IF eax == 1
invoke SetWindowText,hwndEdit2,addr msg1
.ELSEIF eax == 2
invoke SetWindowText,hwndEdit2,addr msg2
.ELSEIF eax == 3
invoke SetWindowText,hwndEdit2,addr msg3
.ELSEIF eax == 4
invoke SetWindowText,hwndEdit2,addr msg4
.ELSEIF
invoke SetWindowText,hwndEdit2,addr msg5
.ELSEIF
.ENDIF

.ENDIF
.ENDIF
.ENDIF
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.ENDIF
xor eax,eax
ret
WndProc endp
end start

i think the problem lies in the return value of
GetDlgItemInt,hWnd,Edit1ID,0,1
this API, returns the integer equivalent of the text the user has given, its a basic string to int function, i dont know but i think its still treating it as a number, since 1.1 is a valid number but only in different type, the documentation from
states that you are checking for the return value only, i think you must also check for the lpTranslated , the third parameter from GetDlgItemInt, lalagyan mo sya ng variable na ma access mo later after the API executes, as this value, is either True(non zero) or False(zero), sabi sa documentation, it will also tell kung valid o invalid yung input sa API, aside sa return value na nilalagay sa EAX. i hadn't test this, just a theory.. the best way to solve this is trace it in a good debugger. breakpoint it at that API.
 
Back
Top Bottom