flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > fasm with IUP toolkit Goto page 1, 2 Next |
Author |
|
sleepsleep 17 May 2012, 20:06
hi there,
i just tried the following, but i still need you guys help. to set up your environment, try the below suggestions. 1. make sure your fasm in PATH 2. download the mingw32 IUP dll file, http://sourceforge.net/projects/iup/files/3.5/Windows%20Libraries/iup-3.5_Win32_dllw4_lib.zip/download 3. unpack those dll and place them where we want to code our first application. 4. we need to generate INC file from the IUP.DLL, i attach here, you can do it yourself if you want. 5. you can fasm my sample code that come with bug Code: format PE GUI 4.0 include 'win32ax.inc' IUP_CENTER = 0xFFFF IUP_CONTINUE = -4 IUP_CLOSE = -3 IUP_DEFAULT = -2 .code start: invoke IupOpen,NULL,NULL ; controls ; -------- invoke IupButton,"Sort A-Z","btnAZ" mov [btnA],eax invoke IupSetCallback,eax,"ACTION",btnA_cb invoke IupButton,"Sort Z-A","btnZA" mov [btnZ],eax invoke IupItem,"Open",NULL mov [miOpen],eax invoke IupSetAttribute,eax,"KEY","O" invoke IupSetCallback,[miOpen],"ACTION",miOpen_cb invoke IupItem,"Close",NULL mov [miClose],eax invoke IupSetAttribute,eax,"KEY","C" invoke IupMenu,[miOpen],[miClose],NULL mov [menuTopFile],eax invoke IupSubmenu,"File",eax mov [menuTop],eax invoke IupMenu,eax,NULL mov [menuMaster],eax invoke IupSetHandle,"appmenu",eax ; layout ; ------ invoke IupHbox,[btnA],[btnZ],NULL mov [hboxh],eax ; dialog ; ------ invoke IupDialog,eax mov [dlgh],eax invoke IupFileDlg mov [fdlgh],eax invoke IupSetAttribute,[dlgh],"SIZE","300X200" invoke IupSetAttribute,[dlgh],"TITLE","IUP toolkit - FASM" invoke IupSetAttribute,[dlgh],"MENU","appmenu" invoke IupShowXY,[dlgh],IUP_CENTER,IUP_CENTER invoke IupMainLoop invoke IupClose invoke ExitProcess,0 ; callback procedure ; ------------------ proc btnA_cb uses ebp esi edi, h mov eax,IUP_CLOSE ret endp proc miOpen_cb uses ebp esi edi invoke IupSetAttribute,[fdlgh],"DIALOGTYPE=OPEN" invoke IupPopup,[fdlgh],IUP_CENTER,IUP_CENTER invoke IupMessage,"ok","message" mov eax,IUP_DEFAULT ret endp .data dlgh dd 0 fdlgh dd 0 hboxh dd 0 btnA dd 0 btnZ dd 0 ; menu variables ; -------------- menuMaster dd 0 menuTop dd 0 menuTopFile dd 0 miOpen dd 0 miClose dd 0 section '.idata' import data readable writeable library kernel32, 'kernel32.dll',\ user32, 'user32.dll',\ msvcrt, 'msvcrt.dll',\ iup, 'iup.dll' include 'API\KERNEL32.INC' include 'API\USER32.INC' include 'API\MSVCRT.INC' include 'API\IUP.INC' if everything is fine, you would get a window i am not really sure the way i code it is correct, calling convention, stack, function parameters count, am not really sure yet. if you click File > Open, it would open file dialog, but when you exit it, everything will close [bug1]
|
||||||||||||||||||||
17 May 2012, 20:06 |
|
revolution 17 May 2012, 22:11
There is a good chance that the external DLL uses the C calling convention. I suggest you try using cinvoke to call the functions.
|
|||
17 May 2012, 22:11 |
|
sleepsleep 18 May 2012, 04:20
thanks revolution,
the bug gone after i change everything to cinvoke |
|||
18 May 2012, 04:20 |
|
sleepsleep 18 May 2012, 12:53
download cd-5.5_Win32_dllw4_lib.zip file from sourceforge
http://sourceforge.net/projects/canvasdraw/files/5.5/Windows%20Libraries/Dynamic/ IUP provides the most insane easy method to control your cell sheet like matrix control, please call cinvoke IupControlsOpen after IupOpen Code: cinvoke IupSetAttributes,[mat1],<'NUMCOL="20",NUMLIN="30",NUMCOL_VISIBLE="2",NUMLIN_VISIBLE="3"'> cinvoke IupSetAttributes,[mat1],<'1:0="Row 1",2:0="Row 2"'> cinvoke IupSetAttributes,[mat1],<'0:1="Column 1",0:2="Column 2"'> cinvoke IupSetAttributes,[mat1],<'RESIZEMATRIX="YES",MARKMODE="LINCOL",MULTIPLE="YES",AREA="NOT_CONTINUOUS"'>
|
||||||||||
18 May 2012, 12:53 |
|
TmX 18 May 2012, 13:12
Looks nice. BTW, how did you make the include file?
I remember someone posted a dll to inc (of course in FASM) in this board long ago, but couldn't find it. |
|||
18 May 2012, 13:12 |
|
sleepsleep 18 May 2012, 13:23
i use this ETL.EXE
http://board.flatassembler.net/topic.php?t=7647 DLL to INC tools, somebody should stick this tools in win32 section. |
|||
18 May 2012, 13:23 |
|
TmX 18 May 2012, 13:32
Ah, yes, that's the one.
Anyway, I tried "etl.exe C:\Windows\System32\msvcrt.dll > msvcrt.inc", the resulting output is empty. Strange. |
|||
18 May 2012, 13:32 |
|
sleepsleep 18 May 2012, 13:35
strange, because i got list of functions using the same etl.exe
* i think the user is required to do a little bit polish job to the output INC file i updated with the polished one, i think i got it somewhere.
Last edited by sleepsleep on 18 May 2012, 14:06; edited 1 time in total |
|||||||||||
18 May 2012, 13:35 |
|
revolution 18 May 2012, 13:42
sleepsleep wrote: i use this ETL.EXE |
|||
18 May 2012, 13:42 |
|
sleepsleep 18 May 2012, 13:46
sometime i think, the search engine in this board is borked, even a search on ETL.exe wouldn't direct to the 7647 thread, doh!
thanks revolution. |
|||
18 May 2012, 13:46 |
|
JohnFound 18 May 2012, 13:53
Quote: I remember someone posted a dll to inc (of course in FASM) in this board long ago, but couldn't find it. Another excellent tool (written by me ) for extracting DLL functions and creating import include files is ImportDB. It supports different import macroses with or without arguments, etc. It is GUI application and supports SQLite database with the collected information about the DLL's and the exported functions, arguments and more. |
|||
18 May 2012, 13:53 |
|
sleepsleep 18 May 2012, 14:09
TmX wrote: Anyway, I assembled your code, and got this error: i think you better get madmatt include files pack, come with examples and almost everything that useful. https://secure.bluehost.com/~flatasse/subdomains/board/topic.php?t=13931 |
|||
18 May 2012, 14:09 |
|
sleepsleep 23 May 2012, 13:58
i did a csv file data browser using IUP, not complete yet, but able to load CSV file now,
i still have issue when loading file that come with quote (') or double quote (") i attach my vbscript that generate dummy data, Quote:
http://www.sinimari.com/csvdb.zip (i zipped together with iup required dll file) ( around 1mb )
|
||||||||||||||||||||||||||||||
23 May 2012, 13:58 |
|
sleepsleep 23 May 2012, 19:40
anyone could help me with this "double quote" problem?
the data file is like below Code: 1 Goo'sgle 4.30 8394883 2 Mic\"rosoft 3.5 3838888 3 Dell 2.35 1233455 4 Ac"er 8.7 9983877 5 Hp 1.35 3342245 6 C\\"ompaq 2.3 4445899 but the output on my csv viewer is
|
||||||||||
23 May 2012, 19:40 |
|
typedef 23 May 2012, 21:15
A simple comparison will do.
Code: .if index + 1 < str_len .if string[index] == '\' && string[index+1] == '"' ;double quote escapement found .endif .endif |
|||
23 May 2012, 21:15 |
|
LocoDelAssembly 24 May 2012, 00:02
By chance does using the same character twice solves the problem? (e.g. <"> -> <"">)
|
|||
24 May 2012, 00:02 |
|
LocoDelAssembly 24 May 2012, 04:45
OK, after a bit of testing I couldn't get quotes to work with the function you have used, however the following code shown Micro"soft in the first cell without a problem:
Code: cinvoke IupSetAttribute,[math], "1:1", "Micro""soft" |
|||
24 May 2012, 04:45 |
|
sleepsleep 24 May 2012, 13:55
ya,, the Iup mailing list also suggest me to use IupSetAttribute,
but i just find it weird why the double quote break in the IupSetAttributes. |
|||
24 May 2012, 13:55 |
|
sleepsleep 25 May 2012, 02:10
ok, i updated my code using the IupSetAttribute, and the double quote problem gone
next is doing sorting, sort A-Z sort Z-A sort by 1-9 sort by 9-1 i think i better do export to csv file from iup matrix control first Code: iupmatrixinsingle1 db '%i:%i',0 iupmatrixinsingle2 db '%i:%i = %s',CR,LF,0 ; required : ; [matheapattrib] : buffer for attrib name proc iupmatrix_insingle math, lns, col, straddr ; ------------------------------------------------------------------------------------------------------------------------ cinvoke wsprintf,[matheapattrib],iupmatrixinsingle1,[lns],[col] cinvoke IupSetAttribute,[math],[matheapattrib],[straddr] ;cinvoke wsprintf,buff,iupmatrixinsingle2,[lns],[col],[straddr] ;stdcall FileWriteLog,buff ret endp Code: ; ------------------------------------------------------------------------------------------------------------------------ proc iupmatrix_csv math,straddr ; ------------------------------------------------------------------------------------------------------------------------ locals lns dd 1 col dd 1 strstart dd 0 endl ; loop 1 time to count lns & col ; ------------------------------ mov esi,[straddr] mov edx,1 ; count lns mov eax,1 ; count col, select biggest value .while byte [esi] <> 0 .if byte [esi] = 9 ; found tab, increase col inc eax .endif .if byte [esi] = CR ; found CR, change it to TAB, check for biggest col value mov byte [esi],9 .if eax > [col] mov [col],eax .endif inc edx ; add next line mov eax,1 ; reset col back to 1 .endif inc esi .endw mov [lns],edx mov byte [esi],9 inc esi mov byte [esi],LF inc esi mov byte [esi],0 stdcall iupmatrix_autolc,[math],[lns],[col] stdcall iupmatrix_clearall,[math] mov esi,[straddr] mov [strstart],esi mov [lns],1 mov [col],1 .while byte [esi] <> 0 .if byte [esi] = 9 mov byte [esi],0 ; put terminator stdcall iupmatrix_insingle,[math],[lns],[col],[strstart] inc [col] mov [strstart],esi inc [strstart] .endif .if byte [esi] = LF inc [lns] mov [col],1 mov [strstart],esi inc [strstart] .endif inc esi .endw cinvoke IupSetAttribute,[math],'REDRAW','ALL' ret endp don't laugh my unoptimize code |
|||
25 May 2012, 02:10 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.