Post by davy on Aug 7, 2006 4:23:15 GMT -5
Ok, this is a little sub you can work into your dll's that gives you easy access to mci calls withing basic4gl. You can do all kinds of stuff with this. I might make a small list of the things you can do, but for now I will let you find them somewhere on the net yourself.
First, create the function that the command will call... Put this somewhere in your dll (use the template and put this somewhere near the rest of the functions... You will be able to tell, they all look similar)
Now, with the function in place, go down near the bottom where all of the registers are... Once again, you will find it, the commands all look like this...
Once that is there, just compile your dll copy&paste it into the folder that your basic4gl with dll support is in... Open up basic4gl like normal, enable the dll from the "Program" menu... And you're good to go. Here is an example command...
btw, if you dont have a compiler and you are interested in writing dll's for basic4gl, go get the FREE codeblocks compiler from here: www.codeblocks.org/
Has has created the demo dll's that come with the "basic4gl with dll support" release (well, unstable release) in codeblocks, so you dont have to know anything about setting up a project or anything. Just open it up and add what you want. I am VERY new to c++ and I haven't had much trouble getting into the swing of things, so don't let c++ scare you into not creating your own plugin's. You just have to try. You can reap the rewards of having every command you want in basic4gl!
First, create the function that the command will call... Put this somewhere in your dll (use the template and put this somewhere near the rest of the functions... You will be able to tell, they all look similar)
void DLLFUNC Func_mciSendString(IDLL_Basic4GL_Runtime &basic4gl) {
const char *msg = basic4gl.GetStringParam(1);
mciSendString(msg, 0, 0, 0);
}
Now, with the function in place, go down near the bottom where all of the registers are... Once again, you will find it, the commands all look like this...
registry.RegisterVoidFunction("mciSendString", Func_mciSendString);
registry.AddParam(DLL_BASIC4GL_STRING);
Once that is there, just compile your dll copy&paste it into the folder that your basic4gl with dll support is in... Open up basic4gl like normal, enable the dll from the "Program" menu... And you're good to go. Here is an example command...
'open midi, name it "mysong"
mciSendString("open c:\song.mid alias mysong")
do
'Press right to Play
if scankeydown(VK_RIGHT) then mciSendString("play mysong") endif
'Press down to Pause/stop
if scankeydown(VK_DOWN) then mciSendString("stop mysong") endif
'Press left to Restart
if scankeydown(VK_LEFT) then mciSendString("play mysong from 0") endif
loop
btw, if you dont have a compiler and you are interested in writing dll's for basic4gl, go get the FREE codeblocks compiler from here: www.codeblocks.org/
Has has created the demo dll's that come with the "basic4gl with dll support" release (well, unstable release) in codeblocks, so you dont have to know anything about setting up a project or anything. Just open it up and add what you want. I am VERY new to c++ and I haven't had much trouble getting into the swing of things, so don't let c++ scare you into not creating your own plugin's. You just have to try. You can reap the rewards of having every command you want in basic4gl!