Hi all...
In Creative Basic help i find that is posibile send command line to another program( .exe).
if program is compiled as CONSOLE ONLY.
In my case i want send command line to GoRc that he compile .rc file to .res file.
So what you think is this posibile.
And if is, is there any example ?
Thanks advance ... :)
Zlatko
Zlatko,
I would try SYSTEM "gorc.exe", getstartpath+"myfile.rc"
That should create the res file and the obj file.
In EBasic I have had problems at times using SYSTEM because the call is made and immediately returns even though the exe hasn't finished.
Larry
Thanks Larry..
I try but dont work...
I mean there is no res file created.
So i made console app in same folder where is GoRc and rin this exe with
System "GoRc.exe",getstartpath + "/r mytext.rc"
but also again nothing.
Of course i tried your way first .
Maby i make rc file in wrong way.
I make this file that im use notepad and save ordinary text file with extension .rc.
Is this right way or maby i must do something else - i dont know?
Quote from: aurelCB on November 20, 2009, 11:47:07 AM
I make this file that im use notepad and save ordinary text file with extension .rc.
that's the way I make some of my rc files.
But remember I don't use Creative Basic
In Ebasic I use something that looks like this:
DECLARE IMPORT,ShellExecuteExA(info:SHELLEXECUTEINFO),int
DECLARE IMPORT,WaitForSingleObject(handle:int,ms:int),int
type SHELLEXECUTEINFO,4
def cbSize:int
def fMask:int
def hwnd:int
def lpVerb:pointer
def lpFile:pointer
def lpParameters:pointer
def lpDirectory:pointer
def nShow:int
def hInstApp:int
def lpIDList:int
def lpClass:pointer
def hkeyClass:INT
def dwHotKey:int
def hIcon:int
def hProcess:int
endtype
CONST WAITTIMEOUT = 258
CONST SEE_MASK_NOCLOSEPROCESS = 0x40
def info:SHELLEXECUTEINFO
def ret:int
info.cbSize = 15 * 4
info.fMask = SEE_MASK_NOCLOSEPROCESS
info.hwnd = 0
info.lpVerb = "Open"
info.lpFile = "gorc.exe"
info.lpParameters = getstartpath$+"myfile.rc"
info.lpDirectory = getstartpath$
info.nShow = @SWHIDE
info.hInstApp = 0
ShellExecuteExA(info)
do
ret = WaitForSingleObject(info.hprocess,0)
until ret <> WAITTIMEOUT Maybe that will help you.
Larry
OK Larry ,I will try
Hmm I try but still dont work:
' send command line by Larry...
DECLARE "shell32.dll" ,ShellExecuteExA(info:SHELLEXECUTEINFO),int
DECLARE "kernel32.dll" ,WaitForSingleObject(handle:int,ms:int),int
type SHELLEXECUTEINFO,4
def cbSize:int
def fMask:int
def hwnd:int
def lpVerb:string
def lpFile:string
def lpParameters:string
def lpDirectory:string
def nShow:int
def hInstApp:int
def lpIDList:int
def lpClass:pointer
def hkeyClass:INT
def dwHotKey:int
def hIcon:int
def hProcess:int
endtype
CONST WAITTIMEOUT = 258
CONST SEE_MASK_NOCLOSEPROCESS = 0x40
def info:SHELLEXECUTEINFO
def ret:int
def getstartpath$:string
' def getstartpath$ = "myfile.rc"
info.cbSize = 15 * 4
info.fMask = SEE_MASK_NOCLOSEPROCESS
info.hwnd = 0
info.lpVerb = "Open"
info.lpFile = "GoRc.exe"
info.lpParameters = "myfile.rc"
info.lpDirectory = getstartpath + "C:\buildrc"
info.nShow = @SWHIDE
info.hInstApp = 0
ShellExecuteExA(info)
do
ret = WaitForSingleObject(info.hprocess,0)
until ret <> WAITTIMEOUT
I recive message from windows:
Windows can't find GoRc.exe - weird
Maby becose i change pointers to strings.
Probably i must create pointers with NEW or something like that...
you defined getstartpath$ then used getstartpath which is not the same.
where gorc.exe add the full path to it and see if that helpd
Larry
Zlatko
This works in CBasic for me.
Compile it to an exe and run the exe.
'SYSTEM "gorc.exe", getstartpath+"ccd.rc"
openconsole
DECLARE "shell32.dll" ,ShellExecuteExA(info:SHELLEXECUTEINFO),int
DECLARE "kernel32.dll" ,WaitForSingleObject(handle:int,ms:int),int
type SHELLEXECUTEINFO,4
def cbSize:int
def fMask:int
def hwnd:int
def lpVerb:string
def lpFile:string
def lpParameters:string
def lpDirectory:string
def nShow:int
def hInstApp:int
def lpIDList:int
def lpClass:pointer
def hkeyClass:INT
def dwHotKey:int
def hIcon:int
def hProcess:int
endtype
CONST WAITTIMEOUT = 258
CONST SEE_MASK_NOCLOSEPROCESS = 0x40
const SW_SHOWMAXIMIZED=3
def info:SHELLEXECUTEINFO
def ret:int
def gpath:string
gpath = "c:_Creative BASIC\\samples\\test3\\"
info.cbSize = 15 * 4
info.fMask = SEE_MASK_NOCLOSEPROCESS
info.hwnd = 0
info.lpVerb = "Open"
info.lpFile = "c:\\_Creative BASIC\\gorc.exe"
info.lpParameters =gpath+ "/r ccd.rc"
info.lpDirectory = gpath
info.nShow = @SWhide
info.hInstApp = 0
ShellExecuteExA(info)
do
ret = WaitForSingleObject(info.hprocess,0)
until ret <> WAITTIMEOUT
PRINT
PRINT "Press Any Key To Close"
DO
UNTIL INKEY$ <> ""
closeconsole
Larry
sorry but not work
Zlato,
I used System already many times in "windowed" programs, all with success, so I guess there isn't a problem with using that statement at all.
But I noticed something, you used this command:
System "GoRc.exe",getstartpath + "/r mytext.rc" (Resulting in: GoRc.exe C\Somepath\/r mytext.rc)
Where I suppose it should be this:
System "GoRc.exe","/r " + getstartpath + "mytext.rc" (Resulting in: GoRc.exe /r C\Somepath\mytext.rc)
The starthpath should be before the filename, if I'm not mistaking, and not before the "/r" command...
So the program is not understanding the instructions that you gave it to do.
Hope this helps.
Greetings,
Johnny
Thanks Johnny i try this option to but this stupid program dont respond in any way - cr*p!
By the way i try also on my second computer with XP sp2 but still dont work.
First time i try on comp with XP sp3 and i think that something is wrong.
Anyway I dont worry to much but i can't see how work by Larry but for me not the same program?
Is'nt ? There is no logic at all...? >:(
zlatko
email me the exact program you are trying along with your rc file.
tlmccaughn@aol.com
Larry
Sended...
So you will see that is very simple program.
Here is your bug:
gpath = "c:_Creative BASIC\\samples\\test3\\"
One backslash is missing, and in summary you need only 3 backslashes. A current-directory should not end with a backslash. Try this:gpath = "c:\Creative BASIC\samples\test3"
Yes Spero i try this combination to but still dont work ???
zlatko
If a path has spaces in it then most command line tools require you to enclose the parameter in spaces.
System GetStartPath+"GoRc.exe","/r " + chr$(34) + getstartpath + "mytext.rc" + chr$(34)
Otherwise the tool will parse at the spaces.
And you will need to supply the full path to the tool as I have done above.
sorry Paul but still dont work.
I try your way like this:
'runGoRc.exe
OPENCONSOLE
wait 1
System GetStartPath+"GoRc.exe","/r " chr$(34) + getstartpath + "mytext.rc" + chr$(34)
PRINT
PRINT "Press Any Key To Close"
DO
UNTIL INKEY$ <> ""
CLOSECONSOLE
And made console app in same folder on C disk where is GoRc.exe and in this folder is mytext.rc file.
This code work on emergence basic and win xp
OPENCONSOLE
'wait 1
SYSTEM GetStartPath+"GoRc.exe"," /r "+ chr$(34) + getstartpath + "myres.rc" + chr$(34)
PRINT
PRINT "Press Any Key To Close"
'DO
'UNTIL INKEY$ <> ""
WAITCON
CLOSECONSOLE
Hi....
i solve problem - how?
I download new version of GoRc from Softpedia version 0.9.0.3
and finaly work :)
So old version which is included in Creative Basic package v 0.8.7.0 dont work on this way or
maby have some bug...
And one interesting thing he work runing directly from CBasic IDE- great ;D
here is code:
'runGoRc.exe - compile as Console Only
OPENCONSOLE
SYSTEM GetStartPath+"GoRc.exe","/r mytext.rc"
'SYSTEM GetStartPath+"GoRc.log"
PRINT
PRINT "Press Any Key To Close"
DO
UNTIL INKEY$ <> ""
CLOSECONSOLE
Oh my ,we almost write book about GoRc here... ;)