Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use windows API in assembly? 2

Status
Not open for further replies.

Hitping

Technical User
Jul 26, 2003
23
IR
Hi,
What is the syntax of using Windows Api in assembly?
For example how can I use SetWindowRgn in my assembly program?
Thanx.
 
Hitping,

If you use MASM v6.x, then you can just put "include" and "includelib"

; put this before .Data
include user32.inc
includelib user32.lib

; call the function
invoke SetWindowRgn, hWnd, hRgn, TRUE


Hope it helps

-- AirCon --
 
try this:
;i'll use the MessageBoxA API fuction. it would be better if you have the complete documetation of all apis...
Code:
;===========================================================
.386p
.model flat, stdcall
      		
extrn MessageBoxA : PROC
extrn ExitProcess : PROC
                  
.DATA
Caption  db   'blah!!!',0 ; the string-zeroes
Text     db   'my APIs', 0
			
.CODE
main:
; note that the params are pushed in reverse form.
push 10h              ; push style of Message Box
push offset Caption ; push Title
push offset Text    ; push content of Message Box
push 0              ; push handle of parent window
call MessageBoxA    ; call function

push 0
call ExitProcess    ; Exit program
End main
;=========================================================
(save as api.asm)
-->assemble this using tasm32:
tasm32 /ml api
-->and link:
tlink32 -x /Tpe /c api,api,, import32.lib,,

--> the import32.lib must be present on the current dir.

--good day!!! :)
~SMX~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top