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 / How to create dll's with Visual Studio .NET

Author
Message
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 20th Nov 2004 09:50 Edited at: 20th Nov 2004 09:52
I have just recently received VS.NET2003 and I am experimenting with Visual BASIC, and I was wondering whether it is possible to make dll's for DarkBASIC Pro using Visual BASIC.NET. The reason why I am asking is becuase I do not see any documentation for making dll's in VB and no of the tutorials are in .NET which is different from the other versions of the older programming languages.

Thanks,
1tg46





And now that was asked I am also wondering how to call dll's in Visual BASIC .NET. Keep in mind I am completely new to programming with any other languages other than DarkBASIC Professional.


Click the sig
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 20th Nov 2004 10:37
currently you need a c++ wrapper for a .net dll to work in dbp. That may change soon however...

as far as dll usage in .net, you make a reference to the dll in your project and the dll will be imported (either as native .net or com interop) and you then instance the dll as an object in your code. Once you have the instance you call the methods, assign values to properties, or respond to events.


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 20th Nov 2004 10:44 Edited at: 20th Nov 2004 10:46
I sort of understand that, and I have been trying to call dll's in VB.NET and it doesn't seem to work.

I am trying to the the On_about box from DBP_config.dll to work. This is what I have so far:




The dbp_config.dll is in the same directory as the executable, the error message says that it can't find the entry point for the dll.


Do you have any examples of how to make dll's in VB.NET, that can be called in DarkBASIC with the call dll command?

[edit]9:46:04[edit]


Click the sig
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 20th Nov 2004 16:58
you have to export it correctly for it to work..
try:

Imports System.Runtime.InteropServices

as your main import should help, there seems to be no Extern though in VB so not sure if it is entirely posssibe to export exactly; you might want to also try

<DllImport ("dbp_config.dll", CallingConvention := CallingConvention.Cdecl)>

if you put that near the top of your code in the class though, it should work... cause it'll convert; you can also use EntryPoint := "functionname" in order to tell it what you want to export once you've created the original DLL that is.


CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 20th Nov 2004 20:32 Edited at: 20th Nov 2004 20:33
Ok, the bit in my post above about "This may change soon..." is referring to this item by ZKAT8IT

http://forum.thegamecreators.com/?m=forum_view&t=42944&b=8&p=0

at the time I posted my message I had already tested his app and it works perfectly, but it wasnt my place to mention it until he did. Now that he did, I am passing along the thread.

Simply make a regular vb.net dll, run this converter on it, use the dll in DBP, sweetz0rz


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 21st Nov 2004 00:53
Finally got the dbp_config problem fixed, with this code:


Now I have to keep on experimenting with creating dll's in Visual BASIC.NET.

Thanks Raven and Cattlerustler.

Any other help on creating dlls with Visual Studio.NET would be much appreciated. (preferrably code from Visual BASIC.NET)

Thanks a lot,
1tg46


Click the sig
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 21st Nov 2004 03:20
Heh, use Visual C# .Net .. 'Static Extern' really does solve alot of headaches.

just post up any problem, will try to help best I can.


CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Nov 2004 03:22
Rave

he codes in vb.net, the switch to c# isnt usually as easy as deciding to.

Anyway ZK's util works a treat. I have to test some other aspects of it and see where it stands


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 21st Nov 2004 03:36
Yeah i know, it's a different coding style.. but my god it's the easiest language i've ever used (which includes DBP)
the guy who created it deserved a round of drinks

Luckily though, when it comes to the .Net Framework everything between VB.Net C# C++.NEt is all relatively the same to achieve.
I keep meaning to ask, does VB.Net have Delegate?


CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Nov 2004 03:48
sure does, all that fancy stuff in vbnet


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Nov 2004 04:06
anyone give this a go?
http://forum.thegamecreators.com/?m=forum_view&t=42975&b=2


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 21st Nov 2004 05:52
Right now I am only working with Visual BASIC.NET at the moment, but I do plan to switch over to C++ and C# after awhile but since VB.NET is as close to DBP as possible then I will continue to use that until I know the basics of it like the back of my hand.

Right now I am learning with a book "Sams Teach Yourself Visual Studio .NET 2003 in 21 days", but it will take more than 21 days for me since some chapters I have to skip since it requires networks, and I also have to balance that with my homework.


The hardest part will remembering all the different functions, but the development enviroment is great.

Thanks,
1tg46


Click the sig
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Nov 2004 07:04
and Object Browser is your very best friend in the VS.NET IDE, aside from break points/ step debugger


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 21st Nov 2004 10:23
I have used the Object Browser, and the searchable help is also good too. I have not yet used the breakpoint/debugging aspects yet. That is the next chapter in the book(whose title is stated preivously).

Regards,
1tg46


Click the sig
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 22nd Nov 2004 20:10
Now I am having problems with trying to run other programs from my main program. I am trying to call a .chm file to execute from the Tools directory of my programs main directory, but I do not know how to do this.

Sorry if these are very dumb questions, but searching the msdn library give too many results to look through.

Regards,
1tg46


Click the sig
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 22nd Nov 2004 22:22
you can use the shell() command, or look into diagnostics.threading for cammands that use thread objects to execute external files


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 24th Nov 2004 04:56
I have been trying to use the shell() command, and it works but I am also trying to open a chm file. How would we be able to do this?


Click the sig
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Nov 2004 05:14
if you shell a chm file it should open in the windows help console. Is it not? you should able to execute hlp and chm files.


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 24th Nov 2004 08:20 Edited at: 24th Nov 2004 08:22
I'll try again, thanks.

And sorry about asking so many questions, but I have yet another one: "how can you make hyperlinks open the default browser at the specified website". I do have books that teach me about VS.NET but none of them are telling me exactly what I want, or I can't understand how they are saying how to do it. (keep in mind that I am learning all of this on my own with no help from school (possibly next year), but I only learn from the help files and the books)

Thanks,
1tg46

I'll try to minimize the amount of questions I pester the forum members with. Sorry

@Cattlerustler and Raven
Thanks for answering lots of my questions, I very much appreciate.


Click the sig
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Nov 2004 13:27
System.Diagnostics.Process.Start(e.LinkText)

thats from the click event of a rich text box, set to find and display urls in the text. In that example e.linktext evaluates to the hyperlink including the http:// bit, and .net knows to launch the default browser. I imagine its the same for the click event of a link label. If you tell me what control youre using I could give a clearer answer.

Also you can use System.Diagnostics.Process.Start in place of shell to launch other programs if you need to do it manually


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 24th Nov 2004 22:03
Thanks I'll try that when I am out of school.

And the shell command still isn't working to opem .chm files so I'll try the other way.

I'll post and example of what I am trying to do later on today.


Click the sig
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 26th Nov 2004 07:35
fixed all the problems, this thread can be locked at any time.

Thanks again,
1tg46


Click the sig
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 26th Nov 2004 21:06
No need to lock a thread just because you've finished with it. What if someone comes in here with a similar question they'd like to ask?


"Computers are useless - They can only give you answers."
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 27th Nov 2004 08:13
Okay, and for those of you who wanted to know how I fixed the problem, I used cattlerustlers idea of using System.Diagnostics.Process.Start(e.LinkText). And right after he posted I found this same information in the help documents.

Thanks everyone,
1tg46


Click the sig
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 27th Nov 2004 10:02
well, no problem.


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 27th Nov 2004 23:43
Above you posted about a dll converter, do you know when that will be released, I have already checked the link and I haven't found any download for the program.


Click the sig
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 28th Nov 2004 01:46
I think ZK will be selling the program, since it makes dlls and plugings for dbp from .net dll's. I think we also will be embedding a trial demo version...


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 28th Nov 2004 03:29


What will the price be?


Click the sig
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 29th Nov 2004 04:25 Edited at: 29th Nov 2004 04:25
Why is this thread being locked and unlocked. About 4-6 hours ago it was locked, and now it isn't.

In VB.NET is their a command similar to right(str$,value)=string return value, or left(str$,value). RobK's BlueIDE has that in its code and it seems like VS.NET has discontinued that syntax for the command.


Click the sig
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 29th Nov 2004 04:35
You should be able to do it with Substring
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemStringMethodsTopic.asp

Quote: "this is not a quote"
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 29th Nov 2004 06:47
or imports microsoft.visualbasic at the top of your code module will reintroduce the commands.

i locked the thread. apparently someone deleted some stuff and unlocked it.

whatever


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 29th Nov 2004 06:57
Thanks, I'll try change some of the code around

Regards,
1tg46


Click the sig
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 29th Nov 2004 17:08
Quote: "i locked the thread. apparently someone deleted some stuff and unlocked it."


some mods around here have weird power issues


1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 29th Nov 2004 20:14
Are their any commands that are similar too:
listboxcontrol.list(listboxcontrol.listindex)

Because that is some more code that is in the BlueIDE code, and I am trying to convert the code that I need to VS.NET version.


Click the sig
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 29th Nov 2004 21:48
if youre trying to return a listbox item index its:

myListbox.Items.Index

or

myLstbox.SelectedItem.Index

check out the Object Browser, its your friend.


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 30th Nov 2004 07:10
I do use the object browser all the time(, but I especially like the codesense of the code editing window). And since all the BlueIDE code is in VB6(I believe), then I would try the conversion tool, but I keep on getting errors.

Thanks,
1tg46


Click the sig

Login to post a reply

Server time is: 2024-03-29 10:22:19
Your offset time is: 2024-03-29 10:22:19