I face a strange problem with the ?EDIT? window creation by CreateWindowEx function. I use nagoa from WWW.VISUAL-ASSEMBLER.PT.VU .
. The code is as followes:


;in Window.asm file

%include "nagoa.inc"
%include "vars.inc"
[BITS 32]


;%define MFT_STRING
[SECTION CODE USE32 CLASS=CODE]

..start:
call GetModuleHandleA, 0
mov dword [Instance], eax

call GetCommandLineA
mov dword [CommandLine], eax

invoke WinMain, [Instance], NULL, eax, SW_SHOW

call ExitProcess, eax



WinMain:

%define hInstance ebp+8
%define hPrevInstace ebp+12
%define lpCmdLine ebp+16
%define nCmdShow ebp+20


enter 0, 0



mov dword [WndClassEx+WNDCLASSEX.cbSize], WNDCLASSEX_size
mov dword [WndClassEx+WNDCLASSEX.style], (CS_HREDRAW)|(CS_VREDRAW)
mov dword [WndClassEx+WNDCLASSEX.lpfnWndProc], WindowProc
mov dword [WndClassEx+WNDCLASSEX.cbClsExtra], 0
mov dword [WndClassEx+WNDCLASSEX.cbWndExtra], 0
mov eax, dword [hInstance]
mov dword [WndClassEx+WNDCLASSEX.hInstance], eax

call LoadIconA, NULL, IDI_APPLICATION
mov dword [WndClassEx+WNDCLASSEX.hIcon], eax
mov dword [WndClassEx+WNDCLASSEX.hIconSm], eax

call LoadCursorA, NULL, IDC_ARROW
mov dword [WndClassEx+WNDCLASSEX.hCursor], eax

mov dword [WndClassEx+WNDCLASSEX.hbrBackground], COLOR_BTNFACE+1
mov dword [WndClassEx+WNDCLASSEX.lpszMenuName], MENU
mov dword [WndClassEx+WNDCLASSEX.lpszClassName], ClassName

call RegisterClassExA, WndClassEx
test eax, eax
jnz .DoAndShow
jmp .erro



.DoAndShow:


call CreateWindowExA, NULL,ClassName, WindowName, (WS_OVERLAPPED)|(WS_CAPTION)|(WS_SYSMENU), CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, [Instance], NULL



test eax, eax
je near .erro
mov dword [WindowHandle], eax



mov dword [temp],eax
call ShowWindow,[temp],[nCmdShow]
call ShowWindow, [WindowHandle], [nCmdShow]






; Loop Messages in order to get all of them..
;============================
.Messageloop
call GetMessageA, Msg, NULL, 0, 0

test eax, eax
je .Fim

cmp eax, -1
je .erro

;call TranslateMessage, Msg
call DispatchMessageA, Msg

jmp .Messageloop

.Fim:
mov eax, dword [Msg+MSG.wParam]

leave
ret 16
.erro
xor eax, eax

leave
ret 16


WindowProc:
;===============================================
;here the messages that are inputed by the user are processed , did he clicked button x ....
;*****************************************************
;* WindowProc(hwnd, uMsg, wParam, lParam); *
;*****************************************************
%define hwnd ebp+8
%define uMsg ebp+12
%define wParam ebp+16
%define lParam ebp+20


enter 0, 0

mov eax, dword [uMsg]
cmp eax, WM_DESTROY
je near .Destroy
cmp eax, WM_CREATE
je near .Create
cmp eax, WM_COMMAND
je near .Command


.Defaut:
call DefWindowProcA, [hwnd], [uMsg], [wParam], [lParam]
leave
ret 16


;==================================
;Create here your front hend of your aplication!! Make a button a combobox etc..
;==================================
.Create

call CreateWindowExA,8,"STATIC","Cust Code",(WS_VISIBLE) | (WS_CHILD),20,20,150,25,[hwnd],NULL,0,NULL

call CreateWindowExA,8,"EDIT","test",(WS_VISIBLE) | (WS_CHILD) |(ES_MULTILINE) |(ES_LEFT) |(WS_EX_CLIENTEDGE),120,20,150,25,[hwnd],NULL,0,30
xor eax, eax
leave
ret 16


.Command:
mov eax, dword [wParam]
;cmp ax, ID_number ID_number is the ID of your object button combobox etc..
;je near your_procedure
;etc.. for other ID?s
;OWN:What to do when each button clicked one by one?
xor eax, eax
leave
ret 16

.work:




.Destroy

call PostQuitMessage, 0

xor eax, eax
leave
ret 16
;in vars.inc file
[SECTION DATA USE32 CLASS=DATA]

ClassName db "myWindowClassName" ; just give a name for the class

Instance dd 0
CommandLine dd 0

WndClassEx resb WNDCLASSEX_size


WindowName db "Nagoa Name of your WINDOW :)", 0
WindowHandle dd 0

Msg resb MSG_size

mii resb MENUITEMINFO
hmenu resd 00h
MENU db 'MAINMENU',0

temp dd 0



Compile and run:
nasm ?f obj window.asm
alink ?oPE window.obj nagoa.obj

note: nagoa.obj is a file with full of imported functions from dll (kernel32.dll etc).

All the above is a template except the Child window in .Create, which I have created. Well, my problem is this:
When I did the same insertion of CreateWindowEx in VC++ template I can edit the ?EDIT? window. But in asm I am not able to use my any key except the delete key. If I select the text ?test? and delete it with delete key it is getting deleted. And also if I copy from other text source and paste it in the ?EDIT? box with my mouse it does the copy and paste operation. But I cannot write a single char with the keyboard operation. I did the same with the VC++ it is working fine with the things with edit, deleting a char with backspace etc.

Can some body help what to do? If any information needed I will post further.
Posted on 2003-03-27 23:38:46 by sathyashrayan
	;call TranslateMessage, Msg

call DispatchMessageA, Msg
It looks like you commented out the call to TranslateMessage. This call generates the WM_CHAR messages needed by EDIT. Undo the commenting.
Posted on 2003-03-28 09:59:09 by tenkey
Hai,
My god, I must put some acid in my eye for over looking the program.
Thanks a lot for the help. It is working. Many thanks to you.

BY
N.Sathyashrayan
Posted on 2003-03-28 20:02:37 by sathyashrayan
are you using NaGoA ?

well pust the project in zip format , do you have the latest nagoa.inc ?



here a window example:
===============================================
%include '\lab\vasm\inc\nagoa.inc'

;;--- funcions we made
def WinMain
def WinProc


..start:

call GetModuleHandle, NULL
CONST hInstance, dd 0
mov dword, eax
call GetCommandLine, NULL
CONST CmdLine, dd 0
mov dword, eax
call WinMain, , NULL, eax, SW_SHOWDEFAULT
call ExitProcess, NULL


rotin WinMain, hInstance, hPrevInstance, lpCmdLine, nCmdShow

stack wc,WNDCLASSEX_size
stack msg, MSG_size
stack hwnd, 4

mov dword, WNDCLASSEX_size
mov dword, CS_VREDRAW | CS_HREDRAW
mov dword, WinProc
mov dword, NULL
mov dword, NULL
m2m dword,
mov dword,COLOR_WINDOW+1
mov dword, NULL
CONST ClassName, db "NombreDeClase",0
mov dword, ClassName
call LoadIconA, NULL, IDI_APPLICATION
mov dword, eax
mov dword, eax
call LoadCursor, NULL, IDC_ARROW
mov dword, eax
lea eax,
call RegisterClassEx, eax
call CreateWindowEx, NULL, ClassName, "PedroGC macro", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, , NULL
mov dword, eax
call ShowWindow, ,
call UpdateWindow,
.loop
lea eax,
call GetMessage, eax, NULL, 0, 0
cmp eax, 0
jb .erro
je .fin
lea eax,
call TranslateMessage, eax
lea eax,
call DispatchMessage, eax
jmp .loop
.erro:
call MessageBoxA, 0, "ERROR", "Saliendo", MB_OK
.fin:
mov eax, dword
endrotin

rotin WinProc, hWnd, uMsg, wParam, lParam
mov eax, dword
cmp eax, WM_DESTROY
je .WM_DESTROY
;-----DEFAULT
call DefWindowProc, , , ,
return
.WM_DESTROY
call PostQuitMessage, 0
endrotin
Posted on 2003-03-28 22:44:52 by Nguga
Sir,
I must first tell that I am not doing the project for any money but I wanted to prove it is possible to do a full application in win32 without using any of the tools given by Microsoft. I am great full to get a replay from the author himself.

I don?t have the nagoa.inc which has the ?rotin? as above. But five days before I posted a message in the mag board. I will do that again.The message is as follows:
================message===========================
Hai,
I would like to receive some help. I started to create a full win32asm application in NASM and alink. I have nagoa from WWW.VISUAL-ASSEMBLER.PT.VU .
I just use the software for including files ?nagoa.inc? and nagoa.obj for linking. As a template I used the window.asm from snippets . All I wanted to create a ?EDIT? child window on the main window.
So I did the following in a file called dylog.asm.

;dylog.asm
%include 'nagoa.inc'

proc m_child,classname,x,y,wi,hi,parent,menu,buff ;proc and endproc from nagoa.inc
call CreateWindowEx , 9, ,NULL, (WS_VISIBLE) | (WS_CHILD) | (ES_MULTILINE) | (ES_LEFT),,,,,,,0,
test eax,0
jz err

endproc




err:
xor eax,eax
leave
ret 16


Now in the main file window.asm (which comes as a snippets)

invoke m_child,'EDIT',10,10,20,20,WindowHandle,NULL,NULL

At the time of linking

Alink ?oPE window.obj nagoa.obj

the message was

ALINK v1.6 (C) Copyright 1998-9 Anthony A.J. Williams.
All Rights Reserved

Loading file window.obj
Loading file nagoa.obj
matched Externs
matched ComDefs
Generating PE file window.exe
Relocs 0:Warning 32 bit offset in 16 bit field

The line ?Relocs 0:Warning 32 bit offset in 16 bit field? is where the mistake is and as soon as the window displays the EDIT is not getting displayed and exits with a illigial operation message. In case any more information is needed I am ready to sent.
====================END====================
I don?t know weather the same over looking problem of mine as above. If not then I think it related with the %macro proc,endproc. Because I created a simple proc and called it in the application it was showing a the message

Relocs 0:Warning 32 bit offset in 16 bit field
From alink.
and showing illegal operation
Or it should be the parameter-passing problem of mine. Please clear it.

NOTE:
I don?t understand the word ?pust the project in zip format? from your replay because of language problem. I think it is paste or put.

by
N.Sathyashrayan
Posted on 2003-03-29 10:45:45 by sathyashrayan
this is working!
============


%include "\lab\vasm\inc\nagoa.inc"




CommandLine dd 0
wc resb WNDCLASSEX_size
hWnd dd 0
msg resb MSG_size
Instance dd 0
ClassName db "myWindowClassName"
ID_EDIT1 equ 100



..start:
call GetModuleHandleA, 0
mov dword , eax
call GetCommandLineA
mov dword , eax
invoke WinMain, , NULL, eax, SW_SHOW
call ExitProcess, eax

rotin WinMain, hInstance, hPrevInstance, lpCmdLine, nCmdShow

mov dword , WNDCLASSEX_size
mov dword , CS_HREDRAW|CS_VREDRAW
mov dword , WindowProc
mov dword , 0
mov dword , 0
mov eax, dword
mov dword , eax
call LoadIconA, NULL, IDI_APPLICATION
mov dword , eax
mov dword , eax
call LoadCursorA, NULL, IDC_ARROW
mov dword , eax
mov dword , COLOR_BTNFACE+1
mov dword , NULL
mov dword , ClassName
call RegisterClassExA,wc
test eax, eax
jnz .DoAndShow
return

.DoAndShow:
call CreateWindowExA, NULL,ClassName,"EDIT example!", (WS_OVERLAPPED)|(WS_VISIBLE)|(WS_CAPTION)|(WS_SYSMENU),152,145,417,272, NULL, NULL, , NULL

mov dword , eax
call ShowWindow, ,
call UpdateWindow,

.loop
lea eax,
call GetMessage, eax, NULL, 0, 0
cmp eax, 0
jb .erro
je .fin
lea eax,
call TranslateMessage, eax
lea eax,
call DispatchMessage, eax
jmp .loop
.erro:
call MessageBoxA, 0, "ERROR", "Saliendo", MB_OK
.fin:
mov eax, dword
endrotin


rotin WindowProc,hwnd,uMsg,wParam,lParam

mov eax, dword
cmp eax, WM_DESTROY
je near .Destroy
cmp eax, WM_CREATE
je near .Create
cmp eax, WM_COMMAND
je near .Command

.Defaut:
call DefWindowProcA, , , ,
return

.Create:

; -- create EDIT window here

%assign .style WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_AUTOHSCROLL |ES_AUTOVSCROLL|ES_MULTILINE

call CreateWindowExA, WS_EX_CLIENTEDGE, "EDIT","initial text!", .style ,8,16,385,213,, ID_EDIT1, , NULL


xor eax,eax
return



.Command:

mov eax, dword
;cmp ax, ID_number ;ID of your object button combobox etc..
;je near your_procedure
;etc.. for other ID?s
xor eax,eax
return

.Destroy:

call PostQuitMessage, 0
xor eax,eax
endrotin
Posted on 2003-03-29 12:32:27 by Nguga
fuck the commercial and capitalism !
you can use whatever you want from NAGOA make money be HAPPY...


friends are the best we take from this short period in this state!!!

we leave on error!!!!!!!

be happy!
Posted on 2003-03-29 12:35:28 by Nguga
%include '\lab\vasm\inc\nagoa.inc'

;;--- funcions we made
def WinMain
def WinProc


..start:

call GetModuleHandle, NULL
CONST Instance, dd 0
mov dword, eax
call GetCommandLine, NULL
CONST CmdLine, dd 0
mov dword, eax
call WinMain, , NULL, eax, SW_SHOWDEFAULT
call ExitProcess, NULL


rotin WinMain, hInstance, hPrevInstance, lpCmdLine, nCmdShow

stack wc,WNDCLASSEX_size,msg, MSG_size,hwnd, 4

mov dword, WNDCLASSEX_size
mov dword, CS_VREDRAW | CS_HREDRAW
mov dword, WinProc
mov dword, NULL
mov dword, NULL
m2m dword,
mov dword,COLOR_WINDOW+1
mov dword, NULL
CONST ClassName, db "NombreDeClase",0
mov dword, ClassName
call LoadIconA, NULL, IDI_APPLICATION
mov dword, eax
mov dword, eax
call LoadCursor, NULL, IDC_ARROW
mov dword, eax
lea eax,
call RegisterClassEx, eax
call CreateWindowEx, NULL, ClassName, "PedroGC macro", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, , NULL
mov dword, eax
call ShowWindow, ,
call UpdateWindow,
.loop
lea eax,
call GetMessage, eax, NULL, 0, 0
cmp eax, 0
jb .erro
je .fin
lea eax,
call TranslateMessage, eax
lea eax,
call DispatchMessage, eax
jmp .loop
.erro:
call MessageBoxA, 0, "ERROR", "Saliendo", MB_OK
.fin:
mov eax, dword
endrotin

rotin WinProc, hWnd, uMsg, wParam, lParam
mov eax, dword
cmp eax, WM_DESTROY
je near .DESTROY
cmp eax,WM_CREATE
je .CREATE
cmp eax,WM_COMMAND
je .COMMAND
;-----DEFAULT
call DefWindowProc, , , ,
return
;-----CREATE EDIT WINDOW
.CREATE:

CONST ID_EDIT1, equ 100

%assign .style WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_AUTOHSCROLL |ES_AUTOVSCROLL|ES_MULTILINE

call CreateWindowExA, WS_EX_CLIENTEDGE, "EDIT","initial text!", .style ,8,16,385,213,, ID_EDIT1, , NULL

return FALSE
.COMMAND:
;mov eax, dword
;cmp ax, ID_number ; ID of your edit
;je near your_procedure
return FALSE

.DESTROY:
call PostQuitMessage, 0
endrotin
Posted on 2003-03-29 12:45:23 by Nguga
Sir,
The proc macro is working in the new version (13-mar-2003) of nagoa.inc.
I don?t have the rotin macro but that is OK.
Thanks
N.Sathyashrayan.
Posted on 2003-03-29 22:56:24 by sathyashrayan
the proc macro is not very good becouse we can not use the same parameter in other proc its way there is new one!


for example this can not be done with proc macro

proc FuncionName_1 , Arg_1 , Arg_2

endproc

proc FuncionName_2 , Arg_1 , Arg_2

endproc


;=============================

its way NAGOA has a new macro called rotin made by PedroGC
were we can use same Arguments and stack vars names in other
Funcions.


rotin FuncionName_1 , Arg_1 , Arg_2

stack var_1,4 ; var_1 = ebp-4
stack var_2,4 ; var_2 = ebp-4-4
stack msg,MSG_size ; msg = ebp-4-4-MSG_size


; code to do

return ; were return is a jump to endrotin

return 1 ; were return is a jump to endrotin and eax=1

return 0 ; were return is a jump to endrotin and eax=0

endrotin

rotin FuncionName_2 , Arg_1 , Arg_2

stack var_1,4 ; var_1 = ebp-4
stack var_2,4 ; var_2 = ebp-4-4
stack msg,MSG_size ; msg = ebp-4-4-MSG_size


; code to do

return ; were return is a jump to endrotin

return 1 ; were return is a jump to endrotin and eax=1

return 0 ; were return is a jump to endrotin and eax=0

endrotin



there was a old macro made by hgb but we need to make

points before the Arguments or Stack vars that was resolved

with a tryck by PedroGC called undef resolved



the new version of NAGOA will be based only in 2 macros

the hgb macro and the PedroGC macro so that the proc will
be also = to rotin . and the hgb funcion will be there also
becouse the future will be with no linker and no resource builder
all made in NASM , nuMIT_or has already an EXE , DLL , and
a RESOURCE EXE example made only using NASM , so us you
know there already the EXE only NASM in last NAGOA very soon
DLL and RESOURCE only NASM !! , so hgb macro is and also
nuMIT_or PROC macro is very usefull for onlyNASM !

but for normal NAGOA using NASM + GORC + ALINK is better
using rotin macro .
Posted on 2003-03-30 11:28:48 by Nguga