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.

DarkBASIC Professional Discussion / help with dll, C programmers?

Author
Message
HAL
23
Years of Service
User Offline
Joined: 28th Aug 2002
Location:
Posted: 12th Apr 2003 01:27
this is just a dll to help explain what i'm after:

is it possible to return a pointer of the MSG structure and would DB be able to use it with the indirect symbol thing?

plus i know its not really the right place to ask but i get this error alot with my C compiler `return makes integer from pointer without a cast` could anyone explain what it means?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Apr 2003 01:33
Yes, you can return a pointer (as void*) and read it into a dword in DBPro. Then you can safely access the structure pointed to.

In answer to your other question, it's because you are not specifying a return type on your function, and it defaults to 'int'.

'menu()' is the same as 'int menu(void)'.

If you can give me specific examples, I can tell you how you should code it.
HAL
23
Years of Service
User Offline
Joined: 28th Aug 2002
Location:
Posted: 12th Apr 2003 02:57
i delete what i had done, but i think i was trying to return handle's like this:
menu(){
hSubMenu = CreatePopupMenu();
return hSubMenu;
}

so the function has to declare what type it might return in it's function name?
like this `int menu(void*)` ?
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 12th Apr 2003 03:22
HAL you must setup DarkBasic Pro with all of the structures you will need for developing the menu system and setup fucntions to be able to take those structures types and then populate the format data for you ...

for you example you're going to have to set the data type, in this case DWORD as that is the wParam's value cast... but also you should be setting the export value



its all about know what the structured data your passing is and howto use it.

if you wanna take this data and pass it back then it'd be


the pointer sets confuse my a little when doing them but that should return the pointer to the data

and remember if you want to actually be able to use that function outside of the DLL you'll need to add in the header



Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
HAL
23
Years of Service
User Offline
Joined: 28th Aug 2002
Location:
Posted: 12th Apr 2003 05:31
i understand how the (DWORD*) would work but in some C source code i see this '(UNIT)hSubMenu' and it loses me.
i'm go in to get myself a good book, i don't fully understand alot of things in C but i'm getting better.
the menu thing i've been trying to cheat, (i think you've guested) i thought i could get the pointer to where the messages are processed then use offsets to get the values i need and let DB handle the rest. i'll give it a go but i may need to get a bit more C knowledge so i can carry on. thanks for the help both.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 12th Apr 2003 05:39
you use the (DWORD*) as its the pointer that you use in the "globstruct.h" header file for passing pointers back into DBpro.



as you can see data type setups
all pointers are in dword form for DBpro, if you need to know what the values are then most good C books explain the data values

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?

Login to post a reply

Server time is: 2026-07-11 22:24:53
Your offset time is: 2026-07-11 22:24:53