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 / noob vb6

Author
Message
no_nm
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location:
Posted: 2nd Nov 2004 21:23
okay, http://forum.thegamecreators.com/?m=forum_view&t=26828&b=1 , exeat proved we could use vb6 to make dlls and cattleruster is using vbadvanced to export dlls to, but so, when using vb6 the only problem when porting the dlls to dbp is the string type ? because it must be on a c type allowed, in cattle ruster thread he solved the problem, so i can do anything i want with a dll right ? so how do i make one that when i call a function inside it it returns a simple hardcoded string, like hello world, so i could use dbp print command to print the returned value from the dll function.

im really new to dll's stuff, and i consider myself a general noob althoug with some knwoladge ant tons of curiosity, can u poitn me out some stuff i could read about this , dedicated to noobs, and also how to solve my problem ?

sorry for bothering you guys.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 2nd Nov 2004 22:42 Edited at: 2nd Nov 2004 22:56
when you pass a string in, you have to have the dll function looking for a Long not a string. Then you convert the string within the dll to a vbString using the vb StrConv() function. Once the string is in natve vb string form, you can do whatever you like with it within the dll as a normal vb string. Then, once you want to pass the string (or any string) back out of the dll you need to convert it using StrConv() again. I wrote 2 private functions in my dll, 1 that converts the inbound string as its passed in, and 1 that converts a string for output.

Here's the 2 converter functions, and a sample function called Greet() that accepts 1 string as an argument, and returns a string - showing how to do the inbound and outbound conversions:



Also, there is 1 module and 1 class file that need to be in your dll which can be found in the vbAdvance example of "non-vb-caller". It is necessary to have this in your dll code so the vb6 runtime is initialized properly ass your dll is instanciated. Also your dll code resides in a module in the dll, not a cls file. I will post it below momentarily....

Required cls file CRuntimeInit.cls:


The required bas module MRuntimeInit.bas:


The main bas module where you write your dll functions MExportedFunctions.bas:
(Includes the converter functions and the greet function from example above, but also includes necessary dll_process_attach code


Once you have this all working, your main module can instance any internal vb objects like forms, other modules, classes, system dlls, api's etc etc.

Have fun!


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
no_nm
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location:
Posted: 3rd Nov 2004 01:52
nice one CattleRustler, many thanks, ill give it a go after this week of exams, ill probably run in to new problems, but youre explanation was great !
carmony
19
Years of Service
User Offline
Joined: 30th Oct 2004
Location: Middlesboro, KY
Posted: 3rd Nov 2004 06:13
So if you use VB6 DLL you need the vbrun libraries? .... so ... if you created vb .net dll you would need net framework?? thats a hefty download. Also if you used vc++ net would you need the net framework?
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 4th Nov 2004 08:22
Items written in VC++ and VB6 will usually not require the user to download anything special as they make use of the system dll's aready included in windows. It is necessary on occasion for the end user to download the vb6 runtimes as they were updated a few times along the way.

.NET 1.1 framework is currently a 26 meg download and is a separate issue. As .NET becomes more prevalent (as we approach Longhorn release) it will be included with 2K/XP Service packs, and is the basis fot the next MS OS.


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!

Login to post a reply

Server time is: 2024-04-25 07:57:21
Your offset time is: 2024-04-25 07:57:21