flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > custom menu for fasmg with assigned source in fasmw (solved)

Author
Thread Post new topic Reply to topic
ProMiNick



Joined: 24 Mar 2012
Posts: 770
Location: Russian Federation, Sochi
ProMiNick 29 May 2017, 05:45
Hello Tomasz.
Execution of fasmg I have to do via BAT file.
I want to create custom menuitem for executing fasmg whith file that assigned for compilation in fasmw IDE.
But from what var can I get full file name of assigned file.
Thanks.

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.


Last edited by ProMiNick on 30 May 2017, 10:27; edited 1 time in total
Post 29 May 2017, 05:45
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8267
Location: Kraków, Poland
Tomasz Grysztar 29 May 2017, 07:59
Try this:
Code:
        mov     eax,[assigned_file]
        cmp     eax,-1
        jne     got_assigned_tab
        invoke  SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0
      got_assigned_tab:
        invoke  SendMessage,[hwnd_tabctrl],TCM_GETITEM,eax,ei
        invoke  MessageBox,[hwnd_main],[ei.pszpath],"Assigned path",MB_OK    
Post 29 May 2017, 07:59
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 770
Location: Russian Federation, Sochi
ProMiNick 30 May 2017, 10:26
fasmw.asm
Code:
        ...
  menu_command:
        and     eax,0FFFFh
        mov     ebx,[hwnd_fedit]
        ...
        cmp     eax,IDM_FG_COMPILE
        je      fgcompile
        ...
fgcompile:
        mov     eax,[assigned_file]
        cmp     eax,-1 
        jne     got_assigned_tab 
        invoke  SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 
      got_assigned_tab: 
        invoke  SendMessage,[hwnd_tabctrl],TCM_GETITEM,eax,ei 
        mov     [path_buffer],0
        cinvoke wsprintf,path_buffer,fgformat,[ei.pszpath]
        ;mov     [sinfo.cb],sizeof.STARTUPINFO
        ;mov     [sinfo.dwFlags],0
        ;invoke  CreateProcess,path_buffer,NULL,NULL,NULL,FALSE,CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,NULL,NULL,sinfo,pinfo
        ;invoke  CloseHandle,[pinfo.hThread]
        ;invoke  CloseHandle,[pinfo.hProcess]
        invoke  WinExec,path_buffer,SW_SHOW 
        jmp     finish
        fgformat:
                db 'C:\FASMG\searchbat.bat %s',0 
        ...
        IDM_FG_COMPILE     = 1399
        ...
  menu main_menu
        ...
       menuitem '&Run',0,MFR_POPUP
       ...
                menuitem 'FasmG compile',IDM_FG_COMPILE
                ...                
    


and added to fasmg dir 2 BAT files:
makebin.bat
Code:
@echo off
set include=C:\FASMG\examples\x86\include
/fasmg/fasmg %1 %~dpn1.bin
pause
    

makeexe.bat
Code:
@echo off
set include=C:\FASMG\examples\x86\include
/fasmg/fasmg %1 %~dpn1.exe
pause
    


and in import WinExec added, because via createprocess - nothing happens. I commented it.

that it is worked for me
Post 30 May 2017, 10:26
View user's profile Send private message Send e-mail Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 770
Location: Russian Federation, Sochi
ProMiNick 02 Jun 2017, 23:12
Post 02 Jun 2017, 23:12
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.