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 / VB Express DLL

Author
Message
Conor B
18
Years of Service
User Offline
Joined: 10th May 2005
Location: Dublin, Ireland
Posted: 12th Dec 2007 20:32 Edited at: 12th Dec 2007 20:36
Hey, I know its possible to use C# to make a DLL by using this tool I got on the internet but I'm just wondering how could you make a DLL using VB express 2005?

Heres a link to the tool I'm using:
http://winch.pinkbile.com/dll_tool.php

Oh yeah and there was one other thing I wanted to ask, in C# I know how to make a simple DLL for DB which does things like simple maths and return the date/time etc, but I was wondering how it would be possible to add GUI functions to the DLL. I tried playing around with system.windows.forms.messagebox but I am getting nowhere, if anyone can help please post.

Thanks in advance.

Don't look behind you.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 12th Dec 2007 22:45 Edited at: 12th Dec 2007 22:48
its no different than c#. I have written many dbp plugins using vb.net and converting with ZK's Converter. It handles C# and VB.NET and you can make dll's or plugins with the string tables built for you.

As far as the code, what do you mean you got nowhere? can you show us what you were trying to do?

One thing I vaguely remember (and will have to verify later when I get home) is to use winforms inside of your dll, you might need to inherit winforms to the class that intends to use them. I know that sounds odd since your class may not be trying to be a form, but for some reason this is sticking in my head atm. Like I said, I'll try and verify it when I get home. My DBP NETLIB plugin for dbp has a form that is used as a variable watcher so Ill look there.

My DBP plugins page is now hosted [href]here[/href]
Conor B
18
Years of Service
User Offline
Joined: 10th May 2005
Location: Dublin, Ireland
Posted: 12th Dec 2007 23:01 Edited at: 12th Dec 2007 23:17
Well I am a complete noob at making DLLs and am interested to learn. Anyway about the VB 2005 Express, when I use the DLL Tool on it it is unable to build the DLL. Since VB cant create a class library I have created a console app and then saved and closed it and opened the project file in notpade and changed the "exe" part to "library" and then saved and reopened as it says on the site but It still wont work, Anyway here is the code I am using for the test, please if you have any ideas what I'm doing wrong just post, thanks.

Edit: Sorry dont know why I said VB was unable to create a class library, I very tired today, Well anyway i still cant seem to get it to work with VB

Code:



Also does anyone know how to make a messagebox in a DLL in C#?

Don't look behind you.

Attachments

Login to view attachments
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 13th Dec 2007 02:06
If I tried to compile that code with ZK's tool, it would work. So its not your code.

Heres an example of a message box function from netlib:

it uses the old holdover Msgbox, instead of Messagebox.Show for some reason (written in 2004)

regarding forms in a dll, you need not inherit them in the class. I guess I was thinking of something else. The forms in netlib are called like any winform would be in any winforms app, via an instance object.

look for ZKAT8IT's converter by searching these forums, and I know he is usually on the dbp irc channel.

My DBP plugins page is now hosted [href]here[/href]
Conor B
18
Years of Service
User Offline
Joined: 10th May 2005
Location: Dublin, Ireland
Posted: 23rd Dec 2007 18:03 Edited at: 23rd Dec 2007 18:42
@ CattleRustler... When I use that code in VB it won't work and it says Msgbox is a namespace and can not be used as an expression, pic attached.

Edit: Anyway I'v decided to use C# for the DLLs but does anybody know how to make say a messagebox in a C# Dll?

Don't look behind you.

Attachments

Login to view attachments
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 23rd Dec 2007 20:42 Edited at: 23rd Dec 2007 20:48
that code works here in .net 1.1,2.0, and 3.5 - but nevermind that

I'm messing about with a c# dll that throws a message box...

I had this same issue recently in a vb.net dll, the proper hooks are not in place like a Winforms project where you can just say MessageBox.Show(... (or even MsgBox) but in the dll I could still use Msgbox() because it was hooking Microsoft.VisualBasic.

I am trying something similar in the C# dll test. I'll let you know what I find out.

My DBP plugins page is now hosted [href]here[/href]
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 23rd Dec 2007 21:40
if you add: using System.Windows.Forms;

at the top of the C# class code module, you should be able to access the MessageBox function from with your function.

I made a test solution in VS2005 Pro which has a C# DLL project, and both a VB, and a C#, test winforms project, that reference the test DLL. While I can build without errors there is a problem (warning) something about the function body or something, and I know jack about C#/C++ so w/e When I run the C# or VB test I get some typeload exception, something about No RVA. Bleh.

My DBP plugins page is now hosted [href]here[/href]
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 23rd Dec 2007 22:06
Example for VB.NET as the dll:

reference the dll System.Windows.Forms in your project, then:



the winforms caller looks like:


this line of code in the caller "MessageBox.Show(iret.ToString)"
shows a 1 because I pressed OK on the dll's messagebox

unforunately this doesnt seem so straight forward in C#

My DBP plugins page is now hosted [href]here[/href]
Conor B
18
Years of Service
User Offline
Joined: 10th May 2005
Location: Dublin, Ireland
Posted: 23rd Dec 2007 23:31
Thanks a million CattleRustler, you have no idea how much you've helped, and I don't have a clue why I didn't add the System.Windows.Forms reference, I must be retarded, haha, anyway I got a basic DLL working now which I made in C# and it works in DB perfectly with a messagebox and openfiledialog, anyway I'm going to expand on this DLL and see how much I can do, I'm aiming for a Blue GUI style DLL.

Don't look behind you.
Conor B
18
Years of Service
User Offline
Joined: 10th May 2005
Location: Dublin, Ireland
Posted: 24th Dec 2007 00:02
I was wondering if these DLLs require the .NET Framework to be installed to run correcty?, If you don't have the .Net FrameWork Would anybody be able to test this EXE which uses a messagebox DLL, thanks.

Don't look behind you.

Attachments

Login to view attachments
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Dec 2007 03:12
if your dll is coded in .net the end user will need the .net framework installed on their machine (same version as compiled in, or higher)

good luck with your dll

what are you using to convert for dbp? Winch's tool?

My DBP plugins page is now hosted [href]here[/href]
Conor B
18
Years of Service
User Offline
Joined: 10th May 2005
Location: Dublin, Ireland
Posted: 24th Dec 2007 03:16
Oh so you would need the .Net FrameWork if you wanted to use the DLL in Darkbasic right?, but what about EXE that use the DLL in them, the person would still need the .Net then? And does anybody know how you would create buttons and items on the DB window?

Don't look behind you.
Conor B
18
Years of Service
User Offline
Joined: 10th May 2005
Location: Dublin, Ireland
Posted: 24th Dec 2007 03:22
So basically the only way to make a DLL that doesnt require .Net is to make it in C++?, then whats the point on these converters that make C# and VB DLL useable in DB?

Don't look behind you.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Dec 2007 12:52
Quote: "but what about EXE that use the DLL in them, the person would still need the .Net then?"

doesnt matter, the end user needs the .net framework. the .NET dll (and exe's) are JIT compiled meaning the code is compiled right at runtime. for this to occur the framework needs to be on the target machine. The dll/exe is compiled into machine code, then it executes. This is not to be confused with "Interpretted" runtime, its not.

Quote: "So basically the only way to make a DLL that doesnt require .Net is to make it in C++?"

Yep, c++, or some other flavor of c/c++.

Quote: "then whats the point on these converters that make C# and VB DLL useable in DB?"

The point is that people want to use and take advantage of the ease and power of .NET as a platform. In the case of DBP which expects standard C++ style exported DLL's, the converters take the .net component, and convert it in a way that when loaded by dbp, dbp can understand and use the dll. Writing plugins and other cool stuff should not be limited to only c++ coders

My DBP plugins page is now hosted [href]here[/href]
Conor B
18
Years of Service
User Offline
Joined: 10th May 2005
Location: Dublin, Ireland
Posted: 24th Dec 2007 14:09
Ok cool, thanks, so yeah I should really learn C++ at some time if I wanted to make independent DLLs then. Anyway I got the windows dialogs working perfectly in DB but anybody know how to add controls to the DB window like say a button etc?

Don't look behind you.
Conor B
18
Years of Service
User Offline
Joined: 10th May 2005
Location: Dublin, Ireland
Posted: 24th Dec 2007 14:38
Sorry to double post but I am having trouble with this code and I don't have a clue whats wrong...


And how would I return multiple values, like for the RGB in the Colordialog?

Don't look behind you.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Dec 2007 21:49 Edited at: 24th Dec 2007 21:50
Quote: "anybody know how to add controls to the DB window like say a button etc?"

I dont think you can directly, or if you can I am not sure how. Maybe you need dbp's window handle for starters.

Quote: "Sorry to double post but I am having trouble with this code and I don't have a clue whats wrong..."

Neither do we unless you tell us what its doing wrong, or what error is thrown. Does it not like the return statement?

Quote: "And how would I return multiple values, like for the RGB in the Colordialog?"

Iirc, the color picker can return an RGB object, or has a function that returns an RGB object to a local defined rgb object. You could make your function return that instead. Or, Since dbp cant handle true Overloaded Functions, you can have multiple named functions, a few for the individual pieces r, g ,b , and one for an rgb object.... WAIT! DBP can't use any complex objects or arrays as returns from functions! gah. Well, youll need to handle everything returned from your dll's using one of the base types in dbp - and then theres strings. You have looked at the strings issue with dbp right?

Its gonna be a long day, methinks...

My DBP plugins page is now hosted [href]here[/href]
Bozzy
17
Years of Service
User Offline
Joined: 10th Sep 2006
Location: Birmingham, UK
Posted: 6th Jan 2008 00:59
Does that tool work with VB 2008 (.NET 3.5)???

Cheers,
Bozzy

"I'm a firm believer that if a team scores one goal, then the other has to score two to win."
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 6th Jan 2008 15:55
I dunno if zk has been updating it. so far it works with 1.1 and 2.0. if i see him on irc i will ask

My DBP plugins page is now hosted [href]here[/href]
Bozzy
17
Years of Service
User Offline
Joined: 10th Sep 2006
Location: Birmingham, UK
Posted: 6th Jan 2008 16:36
ok thanks

"I'm a firm believer that if a team scores one goal, then the other has to score two to win."
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 6th Jan 2008 21:42 Edited at: 6th Jan 2008 21:43
he was on irc before, but away from his machine. I PM'd him and let him know about this thread. I am curious too since I have vs2008 express and .net 3.5 on my machine as well as vs2005 pro .net 2.0. always good to keep compiling options open

Hey ZK, if you read this, any way to add the decompiler/compiler setting to the profiles, instead of as a global option in the converter app? Since someone can have multiple profiles for their projects spread across varying .NET framework versions (I know I do ), it would probably make more sense to do it that way. No big deal if not, but it would be nice . And adding 3.5 to the list would be cool too

My DBP plugins page is now hosted [href]here[/href]
ZKAT8IT
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 7th Jan 2008 08:39 Edited at: 7th Jan 2008 08:41
Bozzy, you can try my DLL conversion tool on my site here.

http://www.virtualdarkarts.net

It will allow you to use VB.Net dll's in DBP. There's an example on how to make a dll also in the help files. Yes it is possible to add buttons and other controls to DBP although it takes a little bit of work. On my site is a program called Scene Generator which I stopped working on but put on there to show that it's possible to combine VB controls with DBP. I may have included an example in the help files also but don't recall.

CattleRustler,
Quote: "
Hey ZK, if you read this, any way to add the decompiler/compiler setting to the profiles, instead of as a global option in the converter app? Since someone can have multiple profiles for their projects spread across varying .NET framework versions (I know I do ), it would probably make more sense to do it that way. No big deal if not, but it would be nice . And adding 3.5 to the list would be cool too
"


You had to ask didn't you? I'll see what I can do about it as I'm limited to my old laptop because my main computer is busted. No promises because I also have to find the source code somewhere on my flash drive, lol.

It should support .Net 3.5 etc.. I haven't tested it but as long as they didn't change the data types or anything major, it should still work, but it won't auto find the programs needed, you will have to manually select the ilasm, ildasm exe's yourself in the options.

Your signature has been erased by a mod because it's larger than 600x120
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 7th Jan 2008 12:35
no worries, was just a thought don't knock yourself out to tweak the app. if it ends up staying the way it is now, its no sweat. see ya on irc

My DBP plugins page is now hosted [href]here[/href]
Bozzy
17
Years of Service
User Offline
Joined: 10th Sep 2006
Location: Birmingham, UK
Posted: 7th Jan 2008 19:50
Sorry, where do I find the "Assembler" and "Disassembler" in 3.5? (or in any for that matter)

Cheers,
Bozzy

"I'm a firm believer that if a team scores one goal, then the other has to score two to win."
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 7th Jan 2008 19:58 Edited at: 7th Jan 2008 19:59
Quote: "you will have to manually select the ilasm, ildasm exe's yourself in the options"

Bozzy, if youre using zk's app then you can select the above exe's in his app, since the app actually decompiles and recompiles the MSIL during the conversion process. You can locate them on your machine by searching for the files in windows search. The locations may vary depending if you have framework redists vs. sdk's vs visual studio, or any combination (which is silly on the part of MS but w/e).

If youre not using his app, knowing where the compiler/decompiler are located wont help. I am assuming you are using his app, or at least the demo, to test it out.

My DBP plugins page is now hosted [href]here[/href]
Bozzy
17
Years of Service
User Offline
Joined: 10th Sep 2006
Location: Birmingham, UK
Posted: 7th Jan 2008 20:42 Edited at: 7th Jan 2008 20:42
Yeah... the demo app

Thanks

"I'm a firm believer that if a team scores one goal, then the other has to score two to win."
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 7th Jan 2008 22:20
np

My DBP plugins page is now hosted [href]here[/href]
Bozzy
17
Years of Service
User Offline
Joined: 10th Sep 2006
Location: Birmingham, UK
Posted: 7th Jan 2008 22:29
hmmm it can find the DeAssembler but the Assembler

"I'm a firm believer that if a team scores one goal, then the other has to score two to win."
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th Jan 2008 04:24
it may be the ildasm is only part of the sdk for that framework, not the redists or part of VS. you can get the sdk for any version of the framework it includes the redist files as well as additional tools and such.

My DBP plugins page is now hosted [href]here[/href]
ZKAT8IT
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 8th Jan 2008 05:45
ildasm is installed with the sdk of the framework you're using.

Your signature has been erased by a mod because it's larger than 600x120
Bozzy
17
Years of Service
User Offline
Joined: 10th Sep 2006
Location: Birmingham, UK
Posted: 8th Jan 2008 14:19
Sorry, I didn't know what I was typing then.

It was meant to be:

Quote: "hmmm it can find the Disassembler (ildasm) but not the Assembler (ilasm)"


"I'm a firm believer that if a team scores one goal, then the other has to score two to win."
ZKAT8IT
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 9th Jan 2008 01:54
The assembler should be somewhere in the folder where you installed the .Net framework. Run a window search for it. I don't think they renamed it to something else as that would be stupid.

Your signature has been erased by a mod because it's larger than 600x120
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 9th Jan 2008 03:11
assuming you have 3.5 express, you may not find ilasm.exe. I just searched that tree from prog file\...9.0 and it doesnt find it. they either renamed it, or 3.5 uses the 2.0 compiler, neither of which would surprise me

My DBP plugins page is now hosted [href]here[/href]
Bozzy
17
Years of Service
User Offline
Joined: 10th Sep 2006
Location: Birmingham, UK
Posted: 9th Jan 2008 10:30
Ok... I can find it in the 2.0 folder but I'm not sure this one is the latest one I need

"I'm a firm believer that if a team scores one goal, then the other has to score two to win."

Login to post a reply

Server time is: 2024-05-04 05:37:23
Your offset time is: 2024-05-04 05:37:23