Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Calling Db functions in Pb

Author
Message
Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 20th Oct 2004 19:14
Hello,

How can I do this? I mean for exemple call Make Object box Object, Width, Height, Depth in Pb.

Thanks in advance
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 20th Oct 2004 20:18 Edited at: 20th Oct 2004 20:20
Firstly, you must look into the dbpro DLL string table

for your example, make objct is in DBProBasic3DDebug.dll
Open it with a software like Resource Hacker.

Here, you'll find in the string table the full command :
91, "MAKE OBJECT BOX%LFFF%?MakeBox@@YAXHMMM@Z%Object Number, Width, Height, Depth"

You see the final DBPro command : MAKE OBJECT BOX.
You also see that it ask for 1 integer ( L = Object number ) and 3 floats numbers ( FFF = Sizes )
You also see the internal DLL function : ?MakeBox@@YAXHMMM@Z

Under purebasic, you must open DLL , call function and close DLL
This way :



You can also directly create sub functions to help



Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 20th Oct 2004 20:37 Edited at: 20th Oct 2004 20:37
I've no Pc around me Freddix. If this working using a dll ?
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 20th Oct 2004 20:39
yes, you can create your own DLL in purebasic and call dbpro's API ... It's what I've done for X-Quad Editor.

All source code is inside my Purebasic's DLL and call all dbpro's DLL to work ....

Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 20th Oct 2004 20:41
Ok, Thanks . I'll try this soon.
Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 21st Oct 2004 00:13
I've tried your procedure and just converted it for a Dll :



I've made the string table, no problem with the command under Db, but It don't display anything. I've made a sphere using the same number number after the function and Dbpro says me that the object already exist, but nothing on the screen.

Thanks for any help
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 21st Oct 2004 01:24
normal.

your new procedure create the object calling DBPro's DLL
if you create another object using the same number, the object exist.

Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 21st Oct 2004 01:44
I don't understand, the problem is not with the number, but there's no box on the screen
Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 21st Oct 2004 06:53
Nobody ?
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 21st Oct 2004 08:34
send me your DLL source code and the dbpro source code that'll use the DLL
and I'll find the solution

Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 21st Oct 2004 21:00
Pb source code:



String Table:



Dbpro source:

Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 22nd Oct 2004 05:04
Ok I see I'd forgotten the Glob Struct . I like to know where the Glob struct can be found. I know It's in the last tutorial or in others threads, but where the list is originally taken from?

Thanks.
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 22nd Oct 2004 08:57
Download the TPC tutorial available in Newsletter 22 and you'll get ALL you need to develop TPC using PureBasic

Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 22nd Oct 2004 17:30
Thanks !
Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 23rd Oct 2004 04:21 Edited at: 23rd Oct 2004 05:15
I've Test the tutorial. All works fine except that I've have to use a 3d command like color backdrop, before I can see my 3d box created with the Pure Basic Dll ( using a Dbpro Command ).

Any Suggestions to fix that ?

Edit : Is It best to call DBProBasic3DDebug.dll each time I have a Procedure with a Db command or calling only one time at the beginning of the code ( in a procedure ) ?

Thanks
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 23rd Oct 2004 08:01 Edited at: 23rd Oct 2004 08:02
your problem for the box is that if you call a DBPro's DLL from your plugin, compiler cannot actually know which DLL you'll call so, if there are no command that use the same DLL inside the DBPro source code, compiler will simply not include the required DLL ...
Result is that your DLL's calls make nothing
Simply add a 3D command inside your dbpro source code and the box should appear

What I've done for X4E is to create sub functions that does not open/close the library like :



so, in the main DLL procedures, I use something like :


I think it's faster

Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 23rd Oct 2004 18:36 Edited at: 23rd Oct 2004 18:43
I see.

Last Question : How do you know that a procedure needs the DBPro Core pointer ?

Thanks
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 24th Oct 2004 01:19 Edited at: 24th Oct 2004 01:21
in fact, it's usefull for advanced ( and more optimised ) work.

You can send/receive string like it's mentionned in the tutorial but, the true correct way is this one for strings send/receive :
Here is the InitialiseCore functions to get *GlobPtr pointer.


Here are 2 small functions that send/receive Strings to/from DBPro using the *GlobPtr and CreateDeleteString :


Here is the perfect way for no problem inside dbpro

In first case, you must clear memory used by string sended by dbpro ( entering 0 for string length )
In second case, you must allocate string memory ( entering string length + 1 )

Sorry but I did take these informations from LEE after giving tutorial to TGC

Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 24th Oct 2004 19:41
1/ So the *GlobPtr is only for handle strings ?

2/ Why the TGC officials dlls are crypted? I know about the security but now, many users are using EzRotate for instance, and no way for using them in a Tpc ?
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 25th Oct 2004 02:15
1 / Actually, it's the only USE I've found for *GlobPtr ... I'm sure it can be used for others things because the structure contain many things

2 / Even if they are crypted, you can look into the String Table to find the correct syntax to use to diectly call functions

Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 25th Oct 2004 02:37
But the string Table is Made with ???????++??????? ...

Don't know the syntax with this ...
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 25th Oct 2004 06:30
look in the TPC tutorial in the last newsletter.
All is explained . I use Resource Hacker to insert my string tables inside the TPC Plugin
and, to found native String Table, I rip them from the DBP's DLL and modify them to fit my needs

The syntax is explained inside the TPC tutorial

Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 25th Oct 2004 07:21
Ok I'll Take a Look. Thanks for All Freddix
Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 25th Oct 2004 08:25 Edited at: 29th Oct 2004 04:33
1/ I Don't understand. I know there's a way to found the build-in dbp commands, but I don't know how to get the eZrotate ( for instance, but the 3d Cloth/Physics and Enhancement Pack too), decorated functions names in the Dll ... because there's no one ....

here's one of the Enhancement Pack from the string Table ( using Res Hacker ):

16, "??+???????????

Can you see Something ?

[Edit]

2/ How do you exit from a point of a procedure without ending the program?

3/ Is a long can be used for a dword in Db?


Thanks.
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 26th Oct 2004 05:43 Edited at: 26th Oct 2004 05:45
1 / use standard DLL not the extnesion that are crypted .
try to open DBProBasiC3DDEbug.dll with Resource Hacker for example
you'll find many string table containing all commands ...
Try to use DLL Undecorator for EZRotate ... maybe it'll work It directly gives internal commands ...

2 / Don't know

3 / Yes

Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 26th Oct 2004 08:09
Ok thanks for answers
Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 29th Oct 2004 04:32
Using DBProBasic3DDEbug.dll work correctly Using DBProBasic3DDEbug.dll work correctly, but I've try to open the DBProMemblocksDebug.dll in Pb, but it doesn't seems to work.



The code inside the if statement is not executed...
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 29th Oct 2004 04:35
I recommend you to open 1 library / channel
I always open DBProBasic3DDebug.dll in channel 1
DBProCore.Dll in Channel 3
...

so use the good channel for calls ...

I use memblocks in x4E to create grounds and it work perfectly from purebasic

Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 29th Oct 2004 05:21
I'm using the same channels as you for the DBProBasic3DDebug.dll and DBProCore.Dll



Is this working fine ?

Can you give me a simple exemple using DBProBasic3DDebug.dll and DBProMemblocksDebug.dll using the same scheme?

Thanks
Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 29th Oct 2004 22:43
Oh I see my problem same as above, need to initialize Dlls :



No way to do that inside dlls ?
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 30th Oct 2004 01:26
don't forget to close dll when you finished your work with them !!!!



Tartopom
19
Years of Service
User Offline
Joined: 27th Jun 2004
Location:
Posted: 30th Oct 2004 04:00
Thanks

Login to post a reply

Server time is: 2024-04-20 11:37:23
Your offset time is: 2024-04-20 11:37:23