Dark Bit Factory & Gravity
PROGRAMMING => Freebasic => Topic started by: Paul on March 08, 2007
-
Hi, Ive got some noob questions.
1. How do i get rid of the window(the one whch always come up when i run anything)
2. Is it possible to get the commandline parameters in freebasic?
3. Is it possible to compie dlls with freebasic?
-
Yes, to all of those.
1) Compile with -s gui to get rid of the console.
2) You can get the command line parms using the Command function. From the help:
''
'' command-line arguments example
''
Print "exe name= "; Command( 0 )
Dim argc As Integer, argv As String
argc = 1
Do
argv = Command( argc )
If( Len( argv ) = 0 ) Then
Exit Do
End If
Print "arg"; argc; " = """; argv; """"
argc += 1
Loop
If( argc = 1 ) Then
Print "(no arguments)"
End If
Print "The complete list: ";Command
3) Compile with -dll to create a DLL.
You can get the current docs at the FB wiki (http://www.freebasic.net/wiki/wikka.php?wakka=FBWiki).
-
You beat me to this one :P
-
Thx for the quick answer, helped allot:)
-
One more question how, a little more exactly do i create a dll.
-
I've got this code and its compiling to a dll but i cant get it to work.
#include "windows.bi"
option explicit
declare function testfunc(in as string) as integer
'testfunc("hello")
function testfunc(in as string) EXPORT
return messagebox(0,in,"test",0)
end function
I'm using this code in Blitz to test it
bank=CreateBank(4)
Print CallDLL("dll.dll","testfunc@4",bank)
changed the code to and that works, but if i send a bank iwth anything other than 0 it craches
#include "windows.bi"
option explicit
declare function testfunc lib "dlltest" alias "testfunc" (in as string) as integer
'testfunc("hello")
function testfunc(in as string) EXPORT
return messagebox(0,in,"test",0)
end function
-
Damn, that's 2 questions that you posted today that I don't have a clue! Hopefully someone can help. Sorry.