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.

Newcomers DBPro Corner / DLL Question

Author
Message
squids
23
Years of Service
User Offline
Joined: 1st May 2003
Location: United Kingdom
Posted: 5th Jun 2003 01:13
Hi,

Sorry if this has been answered hundres of times... I have found a couple of posts regarding DLL's but they havnt quite helped.. My question is how do I make a Dialog Box pop up with a Title and a String.. I am trying to use a command in DBPro like:

Dialog "Body","Title"

But I am totally getting confused. I cant remember anything about C++ now which makes things a lot worse. The following code works find making a dialog box with just the body text.(not sure if the code snippet thing will work)



This works fine.. when used it will spit up a box with the text string you enter... However I want to include a title.. and I am to dumb to figure out how it works,.. if I add (LPSTR pStringT) for a title string variable and use it instead of the ""'s shouldnt that just work?

if that does work,. how do I format the String table ?

DIALOG%S%?DBox@@YAXPAD@Z%String
squids
23
Years of Service
User Offline
Joined: 1st May 2003
Location: United Kingdom
Posted: 5th Jun 2003 01:13
*******And the rest >.<

DIALOG%S%?DBox@@YAXPAD@Z%String <<< this works fine.

How do I make it work so I can include the title also ?

DIALOG%S%S%?DBox@@YAXPAD@Z%String%StringT << obvoiusly wrong.. but im totally lost...

******
Any help would be greatly appreciated. Sorry if the post is a bit wonky, in the sense that well,. it makes no sense!

Anyway,

Many Thanks!
Ash.
squids
23
Years of Service
User Offline
Joined: 1st May 2003
Location: United Kingdom
Posted: 5th Jun 2003 01:15 Edited at: 5th Jun 2003 01:16
P.S,

Sorry for the post spamming,. How many chars can you type in one post? And,. howd ya edit a post you made! sorry sorry ! >.< arrghhh

EDIT****

I figured it out,. yeeeeesh!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Jun 2003 02:16
Just change your code to something like this:



And your resource string should be like this:

DIALOG%SS%?DBox@@YAXPAD0@Z%String, Title
squids
23
Years of Service
User Offline
Joined: 1st May 2003
Location: United Kingdom
Posted: 5th Jun 2003 15:45
Thanks Ian,

Why did I have to put the 0 in before the @ ? I kept getting an error about 0:core dll, is that relevant to the added 0?

Anyway Thanks a lot =O)

Ash.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Jun 2003 20:33
It's required because you have changed the signature of the function. That exported name fully describes to C++ the calling convention, all parameters and the return type of the function.

The error you were getting was due to the fact that because the exported name of the function had changed, DBPro could no longer find your function using the old name you were still giving it in the string.

In summary: When you change the parameter types or the return type, the exported name can change.
squids
23
Years of Service
User Offline
Joined: 1st May 2003
Location: United Kingdom
Posted: 6th Jun 2003 13:25 Edited at: 6th Jun 2003 16:59
Kewl, understood, thanks Ian.

.Arf..
dafalsh
23
Years of Service
User Offline
Joined: 13th Jun 2003
Location: United States
Posted: 14th Jun 2003 02:45
kool i have a tuffer one for yall im trying to make a dark basic client to talk with a c++ server and are haveing mager truble making winsock api calls with db
mv first call must be WSAstartup(verson#, address of wsadata)
but i cant figure out how to do that in db

dafalsh
23
Years of Service
User Offline
Joined: 13th Jun 2003
Location: United States
Posted: 14th Jun 2003 02:50
oh the rest of mu profile

capt. flash
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Jun 2003 03:25
I assume that you want to call existing windows DLL's rather than make a new one. I wrote this code to get the local IP addresses (DBPro only).

Pull it apart and see how you go. It *should* be possible to put together a full TCP connection if you know what you are doing.

... Now, you said something about having a tough question ...
dafalsh
23
Years of Service
User Offline
Joined: 13th Jun 2003
Location: United States
Posted: 14th Jun 2003 20:36
ok ran into another stumping point
i need the pointer to ans size of a varable

capt. flash
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Jun 2003 21:08
You can't *currently* get the address or size of a structure, although I'm working on it (more a 'should I?' than 'can I?').

Check out my code again, and you'll see that I've used raw memory, working the offsets out myself. For now, you'll have to do it this way too.
dafalsh
23
Years of Service
User Offline
Joined: 13th Jun 2003
Location: United States
Posted: 16th Jun 2003 20:28
ok im all most there but it wont quite work
i need to ask you if ive got the memory area right
the c++ structure is sockaddr_in
exaple
sockaddr_in
{
short sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
}

it has a structure with in it in_addr
exaple
in_addr
{
union
{
struct
{
unsinged char s_b1,
s_b2,
s_b3,
s_b4;
}
S_un_b;
struct
{
unsigned short s_w1,
s_w2;
}
S_un w;
unsigned long S_addr;
}
S_un;
};

capt. flash
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Jun 2003 23:23
You have the size of structure right and the correct positions within the structure, but you don't quite have the right format.

Remember that network addresses and ports are in network-byte order, or big-endian, and intel uses little-endian. So you will need to switch byte-order to get the right numbers in place.

FILL MEMORY is far too clumsy for this type of work. Use the PEEK/POKE functions in the code box instead - you'll find them much easier. I've also included two functions (ReverseDword and ReverseWord) to allow you to switch byte-order.

I have to say that DBPro really isn't the best language to do this sort of low-level stuff in. You're really stretching the language about as far as it can go. Why not put together a DLL instead like Squids is doing?
dafalsh
23
Years of Service
User Offline
Joined: 13th Jun 2003
Location: United States
Posted: 22nd Jun 2003 10:26
i think i wll do a dll becouse im finding
struct sockaddr_in {
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
struct in_addr {
union {
struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { u_short s_w1,s_w2; } S_un_w;
u_long S_addr;
} S_un;
#define s_addr S_un.S_addr




IN_ADDR ipconvert;
SOCKADDR_IN addr;


ipconvert.s_addr = htonl (0x7f00007f);
addr.sin_addr = ipconvert;

to be imposabale in db pro

capt. flash

Login to post a reply

Server time is: 2026-07-06 03:57:11
Your offset time is: 2026-07-06 03:57:11