Does anyone have a working example of creating a user library using FAsm.
The samples that come with PB are for NAsm which don't work with FAsm.
Creating user libraries with FAsm
Hi Tipperton,
here is an Fasm example of my lib Morelisticongadget (sorry, it's french commented). You'll find it here :
viewtopic.php?t=6801
Your asm file must begin with this :
format MS COFF
wich is Microsoft's COFF file (format 32 bit).
Your function name must begin with PB_ and in this example, my function is SetColumnAlignment() an i declare it PB_SetColumnAlignment
I declare it as public
If you will use name instead values, use equivalence with equ
You could use external function like PB functions or your owns one.
Use extrn directive following with function name
Then for the code section use this :
You could also declare another sections, take a look at the FASM help file.
Before your code, put your function label (with ":" at the end)
PB_SetColumnAlignment:
In this exemple, i only use a local variable (on stack) wich is will be destroyed at the end of function.
If you have another questions and if i' am able to answer, i will do it.
Denis
here is an Fasm example of my lib Morelisticongadget (sorry, it's french commented). You'll find it here :
viewtopic.php?t=6801
Your asm file must begin with this :
format MS COFF
wich is Microsoft's COFF file (format 32 bit).
Your function name must begin with PB_ and in this example, my function is SetColumnAlignment() an i declare it PB_SetColumnAlignment
I declare it as public
Code: Select all
public PB_SetColumnAlignmentYou could use external function like PB functions or your owns one.
Use extrn directive following with function name
Then for the code section use this :
Code: Select all
section '.text' code readable executableBefore your code, put your function label (with ":" at the end)
PB_SetColumnAlignment:
In this exemple, i only use a local variable (on stack) wich is will be destroyed at the end of function.
If you have another questions and if i' am able to answer, i will do it.
Denis
Code: Select all
format MS COFF
;**************************************************************************
; Fonction SetColumnAlignment() *
; ----------------------------- *
; *
; Aligne les éléments de la colonne à droite, à gauche ou au centre *
; Align column items to right, left or at the centre. *
; *
; *
; Syntaxe PB de l'Appel/PB Call Syntax *
; ------------------------------------ *
; SetColumnAlignment(#Gadget, Colonne, Option) *
; SetColumnAlignment(#Gadget, Column, Flag) *
; *
; *
; Option/Flag *
; ----------- *
; PB_to_Left *
; PB_to_Right *
; PB_at_Center *
; *
; *
; Input Parameters *
; ---------------- *
; eax = #Gadget (Id de la ListiconGadget/Id of ListiconGadget) *
; At the beginning : *
; [esp + 4] --> Colonne/Column *
; [esp + 8] --> Option/Flag *
; *
; *
; Paramètre retourné/Return Parameter *
; ----------------- *
; eax value *
; eax = False --> La fonction a échouée/Function has failed *
; eax = True --> La fonction a réussie/Function has succeeded *
; *
;**************************************************************************
; ----------------------------------------------------;
; Nom de la fonction/Name of functions ;
; ----------------------------------------------------;
public PB_SetColumnAlignment
; ----------------------------------------;
; équivalences/equivalences ;
; ----------------------------------------;
LocalVar equ 32
Var.mask equ esp
Var.fmt equ esp + 4
Var.cx equ esp + 8
Var.pszText equ esp + 12
Var.cchTextMax equ esp + 16
Var.iSubitem equ esp + 20
Var.eiImage equ esp + 24
Var.eiOrder equ esp + 28
; ---------------------------------------;
; Libs externes/Extern Libs ;
; ---------------------------------------;
extrn _SendMessageA@16
extrn PB_GadgetID
; --------------------------------------;
; Section code ;
; --------------------------------------;
section '.text' code readable executable
PB_SetColumnAlignment:
SUB esp, LocalVar ; local Var LV_COLUMN
CALL PB_GadgetID ; hwnd = GadgetID(Gadget) eax = #Gadget utilisé par PB_GadgetID,
; résultat dans eax
MOV dword [Var.mask], 1 ; LVCF_FMT
MOV edx, Dword [esp+40] ; Option/Flag
MOV dword [Var.fmt], edx
LEA edx,[Var.mask]
PUSH eax ; sauvegarde temporaire du handle du gadget
PUSH edx ; push l'adresse de la variable locale
PUSH Dword [esp+44] ; push colonne
PUSH dword $101A ; LVM_SETCOLUMN
PUSH eax ; GadgetID(#Gadget)
CALL _SendMessageA@16
POP edx ; restaure GadgetID(#Gadget)
Test eax, eax ; teste le résultat du message
JZ _Retour ; si 0 alors erreur, on quitte en retournant 0 dans eax
XOR eax, eax
PUSH eax ; push 0 --> toujours à 0 pour le message LVM_UPDATE
PUSH eax ; push 0 --> pour débuter à partir du premier élément
PUSH dword $102A ; LVM_UPDATE
PUSH edx ; GadgetID(#Gadget)
CALL _SendMessageA@16 ; au retour, eax contient 0 si la fonction a échouée
_Retour:
ADD esp, LocalVar
RET 8A+
Denis
Denis
Look at the Library section of http://www.reelmediaproductions.com/pb/
Some of the librarys there have the sourcecode included.
Timo
Some of the librarys there have the sourcecode included.
Timo
quidquid Latine dictum sit altum videtur


