Hi:
I know how is to create a DLL to call coolbasic as this to function.
Can I create a DLL taken to control the parallel port for example?
How are the memblocks?
and finally ...
How do I use the INCLUDE command?
I tried to use the include but when I compile I get an error.
Your help will be very useful to me.
Thank you very much in advance.
Bye.
PLEASE HELP ME :)
Re: PLEASE HELP ME :)
As for the other questions, I can't help you. But I'll give a try for this one; include basically includes, adds the insides of another textfile (like a .cb file) to your current program. This way you can easily chop your code to smaller bits and therefore help reading and creating it.Chopepo wrote:How do I use the INCLUDE command?
I tried to use the include but when I compile I get an error.
For instance, you could have a sourcecode in functions.CB file looking like this:
Code: Select all
Function MyFunction( txt$ )
MakeError "This is MY function!"+Chr(10)+Chr(13)+txt$
EndFunction
Code: Select all
Include "functions.CB"
Repeat
If KeyHit(cbKeyReturn) Then MyFunction( "Return pressed!" )
Text 0, 0, "Press RETURN"
DrawScreen
Forever
Code: Select all
Function MyFunction( txt$ )
MakeError "This is MY function!"+Chr(10)+Chr(13)+txt$
EndFunction
Repeat
If KeyHit(cbKeyReturn) Then MyFunction( "Return pressed!" )
Text 0, 0, "Press RETURN"
DrawScreen
Forever
I hope this clears things up for you
Later!
cbEnchanted, uudelleenkirjoitettu runtime. Uusin versio: 0.4.1 — Nyt myös sorsat GitHubissa!
NetMatch - se kunnon nettimättö-deathmatch! Avoimella lähdekoodilla varustettu
vesalaakso.com
NetMatch - se kunnon nettimättö-deathmatch! Avoimella lähdekoodilla varustettu
vesalaakso.com
- Zero
- Lead Developer
- Posts: 727
- Joined: Sun Aug 26, 2007 2:30 pm
- Location: Helsinki, Finland
- Contact:
Re: PLEASE HELP ME :)
To control serial port (and the like) via CoolBasic, you'll first need to create a DLL file in C/C++ (functions must be declared with "extern C" to prevent C++ name mangling). Inside your DLL you write the necessary program logic to control the serial port; the DLL only exposes an interface for CoolBasic. You mentioned that you're already familiar with calling external code from CoolBasic, so I assume the real problem for you is to create the actual serial port controller. In this I cannot help you, but you use memblocks in exactly the same way you would otherwise pass data back to a CoolBasic program. It could be something like a poller function you'd call regularly to receive serial port state (and optionally the other way around i.e. pass data over through the serial port).
CoolBasic henkilökuntaa
Johtava Suunnittelija
CoolBasic V3, CoolBasic Classic
http://www.coolbasic.com/blog
Johtava Suunnittelija
CoolBasic V3, CoolBasic Classic
http://www.coolbasic.com/blog