News:

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

Create new button

Started by Live, July 03, 2011, 04:53:57 PM

Previous topic - Next topic

Live

Well I just started learning ASM and im still confused about the sytax ect. So i've been messing around with the example sources they provided.

One thing i have yet to get to work is a  windows form, and a button.

Can someone make a example on just a window form with a button that you can click and it will show a message or something.

Just so i can get the general idea of templates and their components  work.
Thanks.

qWord

take also a look in the folder  masm32/examples/
Quoteinclude masm32rt.inc
.686p
.mmx
.xmm
WndProc proto hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.data?
   hInstance   HINSTANCE   ?
   hBtn      HWND       ?
.code
main proc
LOCAL wcex:WNDCLASSEX
LOCAL msg:MSG

   mov hInstance,rv(GetModuleHandle,0)
   mov wcex.hInstance,eax
   mov wcex.cbSize,SIZEOF WNDCLASSEX
   mov wcex.style, CS_HREDRAW or CS_VREDRAW
   mov wcex.lpfnWndProc, OFFSET WndProc
   mov wcex.cbClsExtra,NULL
   mov wcex.cbWndExtra,0
   mov wcex.hbrBackground,rv(GetStockObject,WHITE_BRUSH)
   mov wcex.lpszMenuName,NULL
   mov wcex.lpszClassName,chr$("win32class")
   mov wcex.hIcon,rv(LoadIcon,NULL,IDI_APPLICATION)
   mov wcex.hIconSm,eax
   mov wcex.hCursor,rv(LoadCursor,NULL,IDC_ARROW)
   invoke RegisterClassEx, ADDR wcex
   mov esi,rv(CreateWindowEx,0,wcex.lpszClassName,"Win32App",WS_VISIBLE or WS_SYSMENU or WS_SIZEBOX or WS_MINIMIZEBOX or WS_MAXIMIZEBOX or WS_CLIPCHILDREN,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,0,hInstance,0)

   .while 1
      invoke GetMessage,ADDR msg,NULL,0,0
      .break .if !eax || eax == -1
      invoke TranslateMessage, ADDR msg
      invoke DispatchMessage, ADDR msg
   .endw

   invoke ExitProcess,msg.wParam

main endp

WndProc proc uses ebx esi edi hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

   .if uMsg == WM_CLOSE
      invoke PostQuitMessage,NULL
   .elseif uMsg == WM_DESTROY
   .elseif uMsg == WM_CREATE
      mov hBtn,rv(CreateWindowEx,0,"button","hello",WS_CHILD or WS_VISIBLE,0,0,100,30,hWnd,0,hInstance,0)
   .elseif uMsg == WM_COMMAND
      mov ebx,hBtn
      .if lParam == ebx && WORD ptr wParam[2] == BN_CLICKED
         fn MessageBox,0,"hello world","xyz",0
      .endif
   .else
      invoke DefWindowProc,hWnd,uMsg,wParam,lParam
      ret
   .endif

   xor eax,eax
   ret
WndProc endp
end main
FPU in a trice: SmplMath
It's that simple!

jj2007

There is a good example in \masm32\examples\exampl01\minifile\minifile.asm
Look for PushButton.

Vortex

Hi Live,

Have a look at Iczelion's Win32 Assembly tutorial set :

http://win32assembly.online.fr/tut9.html

hfheatherfox07

Here is a great site with examples only....

http://members.a1.net/ranmasaotome/projects.html

It has 3 Levels of examples:

BEGINNER ,INTERMEDIATE ,and ADVANCED....

This should start you off , it helped me a lot  :U

donkey

Quote from: hfheatherfox07 on July 03, 2011, 11:20:27 PM
Here is a great site with examples only....

http://members.a1.net/ranmasaotome/projects.html

It has 3 Levels of examples:

BEGINNER ,INTERMEDIATE ,and ADVANCED....

This should start you off , it helped me a lot  :U

Yup, a good set of example code that pretty much covers the basics of API programming, its too bad that Ranma_at hasn't been very vocal lately, he contributed a lot to the ASM community and his RadAsm tutorial was top notch.

Edgar.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

hfheatherfox07

Hi there I found this for you ... this are some step by step asm's for very beginners ....
I got them from installing "Source Editor 3.0.3.0"

from here:

http://www.softplatz.net/Downloads/Development/IDE/Source-Editor.html

I uploaded source Editor in case you want it....and the link dies

http://www.megaupload.com/?d=ONNIGYF3

File name: Source Editor 3.0.3.0.zip
File description: Source Editor 3.0.3.0


File size: 1.49 MB


Here are the MASM assembly for the very Beginner