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 / C++ Wrapper for Visual Basic DLL's

Author
Message
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 28th Feb 2004 05:56 Edited at: 28th Feb 2004 06:03
I posted this in the WIP forum yesterday but just got finished with it today. Basically it allows you do the impossible (as claimed by some of the 'gurus' around here ), you can write a DLL in Visual Basic, wrap it in a C++ DLL and then call it through DBP. Unfortunately there's nothing 'showy' about it for those who don't want to do this, but here's a screenshot anyway:



You can download the ZIP file here:

http://ep.designex.net/Misc/VBinCPP.zip

This package will teach you how to write Visual Basic ActiveX DLL's
that can be compiled and imported into C++. It will tell you how to
write the source code for C++ that can call the compiled VB DLL and
run functions from it. It will also show you how it's possible to
display a modal form from VB in DBP and basic passing of integers
from DBP to C++ to VB and then returning a value back.

Finally, it also comes with a modified version of Ian Mold's DBP
Plugin Framework (http://www.matrix1.demon.co.uk) that will allow
you to call VB functions easily without any mess.

-------------------------

The zip file will come packaged with the following folders and files:

-Readme.txt
-VB DLL in DBP Documentation.doc

-DBP Visual Basic Plugin Framework
> C++ Source Code
> Visual Basic Source Code

Documentation Sample Source
> Compiled Final
> C++ Source Code
> VB Source Code
> DBP Source Code

-------------------------

The Microsoft Word file will teach you everything you need to know
about creating Visual Basic DLL's for DarkBASIC Professional. The
first subdirectory includes source code for a modified version of
Ian Mold's DBP Plugin Framework that will work for VB DLL's. The
second subdirectory includes the source code for the sample that is
created by following the tutorial in the documentation. It also
includes a "Compiled Final" directory that will have the compiled
EXE's and DLL's from the source code

The only downfall so far is that if you wish to call a function from the VB DLL then you must first register it on the client's computer. This means if you distribute a game that uses a function within a VB-DLL then they would also need to recieve the VB DLL (not the C++ one) and have someway to register it. So, if you wanted to see the sample included in the zip, you'd have to run the batch file I included first before it would work.


Wow, first thing I've contributed to the community. Now excuse me while I go and hide from IanM because I stole his framework

Edit: Eek, I just posted this in the wrong forum. Sorry, had two browsers open - one in program announcements and one in this one, accidentally posted in the wrong one. Feel free to lock/delete/whatever mods. lol.


"Computers are useless they can only give you answers."
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 28th Feb 2004 06:19
nice exeat!

can the vb dll contain anything I want? Say i have a dll that instantiates some other windows classes like MS Message Queues(MSMQ) or a dll i wrote in vb6 that calls win32api INI file functions, am i restricted in any way by what I can have in the initial vb dll?

Is there any way that this or some other mechanism could be extended to wrap .NET dlls? (I know, a whole other animal) just curious.

I haven't tried this out yet but thanks and good work.


-RUST-
"What the... Mooooooooooo!"
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 28th Feb 2004 08:50
Np, and I'm glad someone else will find this useful.

As far as what restrictions are in place, I can't really say yet because I haven't really tested it out fully.

I'm sure there are some restrictions from within VB, for instance, in my sample code I load the form from within the VB DLL with "frmMain.Show 1" which will load it modally. Trying to load it modeless from within the VB DLL will force the DBP application to quit automatically. There are ways around this though, by creating a function within VB to get it's Form hWnd:



I can then use it in C++ to load the form modelessly:



Or I could even create the form window as a MDI parent of the DBP window:



That means if I were to write a map editor, I could essentially program the whole interface in Visual Basic and then load the DBP window as a MDI child of the Interface!

Or you could even do the reverse:



Now the form is a MDI child of the DBP window! Floating toolbars can easily be made by doing this!

I know this isn't what you asked, I'm just demonstrating some of the little tricks that I've been playing around with over the past hour. As an estimated guess though, I'd say: yes, there are restrictions but they can be overcome if you're not afraid to dive into C++ a little. All the C++ code I showed above use API's that can also be accesed through VB so it's not all that hard to do.

I cannot give an answer for those two specific examples though because I don't know for sure, you just have to try and find out.

Also, I'll get to work on porting it to .NET, hopefully it shouldn't be too hard to do.


"Computers are useless they can only give you answers."
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2004 14:16
Quote: "as claimed by some of the 'gurus' around here "


Yeah, been there, done that I worked it out for CR a few months back, but as I don't 'do' VB, I didn't take it any further. Nice job though.

As for the .NET languages, it's actually easier to do this than it is with VB6 ... it's just that in doing this you place a dependency on the user having the .NET framework installed at the correct version level.

Have a look at the '#using' directive and it'll become clear.

BTW, you might want to make a small change to your zip - I noticed that I haven't updated the framework with the latest globstruct - just take the latest one from your DBPro installation.

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 28th Feb 2004 14:28
Agreed. One of the reasons I still shy away from .NET is because of the huge download the framework is for dialup users, it looks set to become the standard though so we may as well get used to it.

I just replaced the Globstruct with the latest one, thanks for that, I didn't even realise there was a new one at all. I haven't reuploaded the zip yet though as I'm going to make some more changes, hopefully so it automatically registers the VB DLL with RegSvr32 but first I need to find a way to check if the DLL has already been registered. Does anyone know if this is possible?


"Computers are useless they can only give you answers."
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2004 15:05
Yes, you just check the registry for your class ...

HKEY_CLASSES_ROOT\vbdllName.clsVB

If it exists, your DLL is registered.

Also, you don't need to use regsvr32 (with its ugly message box). You can do the following instead ...

rundll32 vbdllName.dll,DLLRegisterServer

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 28th Feb 2004 15:49
Exeat, please post up when you have something in the works for .NET dlls to be used in dbp! Not that this isn't already great but with .NET, a vb programmer is as powerful as a C++ C# guru, not to mention coding in .net is way more intuitive and truly OO, without all the need for the win32api calls etc etc, as everything is an object. I salivate at the thought of the wicked plugins I could write for the community in vb.net!

"Dare I say, I feel rather sexy" - the Roaming Gnome, Travelocity

Rock on Exeat.
Thanks
James

-RUST-
"What the... Mooooooooooo!"
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 29th Feb 2004 00:07
Cheers IanM, that's exactly what I was looking for.
CR, I'm going to start porting the code from VS6 to VS.NET later today. Hopefully I won't run into too many problems.


"Computers are useless they can only give you answers."
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 29th Feb 2004 00:18


-RUST-
"What the... Mooooooooooo!"
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 29th Feb 2004 14:17
Very nice. First thing I'll do is convert my Equation SOlver plugin to native DLL

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 29th Feb 2004 14:31
Quote: "as claimed by some of the 'gurus' around here "


I did mention in another thread, forget which one, about a thunking layer for VB to do this. You obviously and successfully took this onboard. Top job

Paul.


David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 29th Feb 2004 14:32
Well, I've returned from the compiler. And it works!

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 29th Feb 2004 15:38
Can someone explain the C++ part and what needs to be done to make the vb dll workable in dbp. I haven't tried anything yet because I am waiting to see what Mr. Exeat comes up with for vb.net. But forgetting .net for a moment, is the c++ step always the same or does the code have to be heavily modified for each vb dll?

So I have a VB dll, next....

-RUST-
"What the... Mooooooooooo!"
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 29th Feb 2004 15:54
You then have to define a c++ function for each VB function. I've only glossed over it, but I don't think it looks too hard.

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Feb 2004 16:35
@CR,

Within the C++ DLL you create a global instance of your VB class, and then call its class members. Basically you are just forwarding the calls to your DLL.

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 29th Feb 2004 16:55
Okay, I take back the comment about it being easy. I hve a VB function:

Eval(Expression as string) as long

and I'm trying to write the wrapper. Here's what I have:



There seems to be a problem with the string type. I've included STRING.H?

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Feb 2004 17:15
Ah, strings are a completely different format for VB.

The best thing that you can do is pass the DBPro string to VB as an array of bytes and convert it to a string within VB.

You'll also need to pass any strings back in the same format, and create a DBPro format string from that.

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 29th Feb 2004 18:00
Yes this is pretty much what IanM did a while back and it's all great and all that (Not taking anything away from Exeat ) but this is too tedious for me. My loss I guess. I am waiting for some brilliant C++ programmer to write some automation program or util that takes my vb dll, and wraps it up nice and neat so I never have to touch C++ code.

Anyone up for that?

(I know, wishful thinking)

-RUST-
"What the... Mooooooooooo!"
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 29th Feb 2004 18:15
Quote: "Ah, strings are a completely different format for VB.

The best thing that you can do is pass the DBPro string to VB as an array of bytes and convert it to a string within VB.

You'll also need to pass any strings back in the same format, and create a DBPro format string from that."


:/

Hmm.

Would this work (for passing the array of bytes):



"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Feb 2004 19:07
You'll need to get someone who remembers more of VB than I do to answer that for you. I do remember that you'll need to convert between ASCII and UNICODE but that's about it.

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 29th Feb 2004 20:10
Okay thanks.

While trying to make a function return an integer I think I've got my string table wrong. Here's the C++ function:



And the string table entry:

GETSECONDS[%0%?GetSeconds@@YAHXZ

Does that look wrong to anyone? DBPro says: Cannot find function ?GetSeconds@@YAHXZ in dbprocore.dll?

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Feb 2004 20:27
Change your zero to an L and see if that solves it

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 29th Feb 2004 23:05
Hi,

It works now. Thanks. Although it only returns a 0 now

It's a start though. Thanks very much.

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 1st Mar 2004 07:47 Edited at: 1st Mar 2004 07:50
David T:
Check in your VB code if you're returning the value correctly, to return a value you must have it set up like so:

Public Function NAME()
NAME = 5
End Function

That will return 5 back to C++ and then to DBP, I accidentally edited my Function Name later and forgot to change it when I returned the value and hence was confused for a good 20 minutes when I couldn't find out why I always got '0' back. Might be happening to you too.


CattleRustler:
The majority of the code will be the same in C++, if you take the modified version of IanM's framework that I included then it's very easy to make work. For instance, there is a default command included in the framework:



That's all there is to it, you write a VB command in your VB DLL, compile it, copy it to the C++ folder. Copy that function and paste it below it and then rename all the names to read your new function:



A little bit of extra coding comes into it when you're passing returning values (this is for a long):



Another step for passing values:



Then you have to write the string table (as explained in the DBP help), all this is very simple to understand if you take a couple minutes to just read the differences between each steps.

Because we have to put the code into a format that DBP likes, it's very hard (impossible maybe?) to make a fully automated process. The C++ code would also have to guess what functions are in the VB class. It's too difficult really.

There are complications with Strings because as IanM said, they're handled very differently between the languages. I *think* it's possible with a variant. Another thing I'll have to look into. Also have to work on the .NET version some more, had to use #using like IanM suggested - thanks.


"Computers are useless they can only give you answers."
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 1st Mar 2004 16:08
thanks for your hard work Exeat - I am following this closely, regardless of what I asked Lee in the Lee thread.

-RUST-
"What the... Mooooooooooo!"
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 1st Mar 2004 18:28
Hi,

The code worked

However I've started to have a go at making a TPC in pure C++. I'm having a go at an expanded date and time library, and so far have the following commands:

GetSeconds() - returns number of seconds past minutes
GetMinutes() - as above
GetHours() - as above

all working a DBP

Hopefully should save some meddling with timer()

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 1st Mar 2004 18:55
DT if this were .net you could be using a TimeSpan Object as is...



-RUST-
"What the... Mooooooooooo!"
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 1st Mar 2004 18:57 Edited at: 1st Mar 2004 18:58
lol I haven't quite become hooked on .NET yet...

argh I'm having trouble with my Format() function - this function returns a formatted string depending on its input. VC++ says:

Quote: "C:C++DBPTIMEDBPTIME.cpp(107) : error C2440: 'return' : cannot convert from 'char [256]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe."


Code:



"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 1st Mar 2004 20:38
watch out for variant when you wrap vb6 functions. Example

Mid$() returns string
Mid() returns variant

die, variant die! Oh yeah .NET made em all dead!



-RUST-
"What the... Mooooooooooo!"
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 2nd Mar 2004 08:13 Edited at: 2nd Mar 2004 08:14
David T: Your function is returning an 'int' to DBP but the variable you're returning is a 'char', C++ can't make this conversion alone. There's a list of fucntions in the MSDN help files that can convert different types, although I can't remember the URL at the moment.


Quote: "thanks for your hard work Exeat - I am following this closely, regardless of what I asked Lee in the Lee thread."


Np, but I agree, direct implentation of VB DLL's would be preferable, it takes that one extra step out of the process. Also a lot cleaner and faster. I was kidding in that post.


I'm almost done with auto-registering the VB DLL's although I'm having some problems with the 'rundll32' part, it keeps erroring with "Missing Entry: DLLRegisterServer". IanM, do you have any ideas why this would happen? I've tried it manually through DOS and it always says the same thing. Weird.

Edit: Found the problem, it's case sensitive, it doesn't like: 'DLLRegisterServer' but finds 'DllRegisterServer' acceptable. Peh! lol. Need to do some testing on other machines to see if it works fully first.


"Computers are useless they can only give you answers."
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 2nd Mar 2004 19:39
Quote: "David T: Your function is returning an 'int' to DBP but the variable you're returning is a 'char', C++ can't make this conversion alone. There's a list of fucntions in the MSDN help files that can convert different types, although I can't remember the URL at the moment."


Thanks. I found that there was second half to Lee's tutorial on TPCs >_< which explained how to return strings.

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
kojotex
20
Years of Service
User Offline
Joined: 16th Jul 2003
Location:
Posted: 2nd Mar 2004 19:58 Edited at: 2nd Mar 2004 20:01
Hi Exeat and all others!

I got 3 problems with your Wrapper:
1. I only have VB.net Standard, so I cant dll Projects
But a nice in a german VB Forum someone knew a trick: you only cant create Dll Projects in the standard version, but you can import a dll Project created in VB.net professional
So he send me a dll Project created in VB.net prof!

My second Problem is that i imported your Vb example project into VB.net, then compiled the dll, but it didn´t work

So i wanted to recompile the c++ code, but because i don´t have Vc++ i wanted to compile it in Dev c++...
But i know nothing in c/c++, so i couldnt compile anything... do you nkow, how to compile your c++ project in Dev C++, or is it impossible?

3. I can´t register the dll I created with VB.Net! if i take Regsrv32 to register it, it says that the DLLRegisterServer Entry Point can´t be found! And i don´t know the Reason

I hope you can help me

Kojo

Edit: If you want to see the dll i compiled, ill send it to you.
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 2nd Mar 2004 20:27
Quote: "3. I can´t register the dll I created with VB.Net! if i take Regsrv32 to register it, it says that the DLLRegisterServer Entry Point can´t be found! And i don´t know the Reason "


I'm not too sure, but doesn't Regsvr32 only work with ActiveX DLLs, and aren't VB.NET DLLS .NET?

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
kojotex
20
Years of Service
User Offline
Joined: 16th Jul 2003
Location:
Posted: 2nd Mar 2004 20:58
Hmm, i don´t really know...
I think i read something about that in the MSDN Help, but im not sure...

Another Question: If I change only the old functions in the VB dll, will i have to re compile both, the c++ dll and the vb dll, or just the vb dll?

Kojotex
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 2nd Mar 2004 21:10
.NET dlls are not COM/Ax dlls!!!!

They don't work with this system. Exeat's stuff is for vb6 com automation dlls, not .NET



-RUST-
"What the... Mooooooooooo!"
kojotex
20
Years of Service
User Offline
Joined: 16th Jul 2003
Location:
Posted: 2nd Mar 2004 21:37 Edited at: 2nd Mar 2004 22:21
So theres no way to use my dlls created with VB.Net???

Edit: Plz look here: http://www.dotnet247.com/247reference/msgs/12/62311.aspx
Schould i waste my time trying this method?

edit2: How can i compile the vc++ 6 files? If I try to compile them in Dev C++ 5 i get an error: [warning]: #import is obsolete
What does this mean???
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 2nd Mar 2004 22:35
Quote: ".NET dlls are not COM/Ax dlls!!!!"


Thought so.

Quote: "edit2: How can i compile the vc++ 6 files? If I try to compile them in Dev C++ 5 i get an error: [warning]: #import is obsolete
What does this mean???"


It means you can't reference to the DLL :/ Unless you find a way to #import, I don't think you can continue

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 3rd Mar 2004 00:05
This is slightly off topic, but if you're looking for a desent C++ compiler with Win32 Support, very easy to install and use, comes with an excellent IDE as well, try Dev-C++. This and other excellent GPL stuff can be found at http://www.bloodshed.net/

Seriously though, I do recommend Dev-C++, I've used DJGPP and the GNU compiler under Linux, but this is pretty good and well supported.

Paul.


Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 3rd Mar 2004 00:26
lol, funnily enough Paul, kojotex is using Dev-C++ and is having some problems trying to compile my code. Unfortunately it isn't working.

Quote: "1. I only have VB.net Standard, so I cant dll Projects
But a nice in a german VB Forum someone knew a trick: you only cant create Dll Projects in the standard version, but you can import a dll Project created in VB.net professional
So he send me a dll Project created in VB.net prof!"


What's your email? I'll email you a .NET project of the VB part of the framework, hope you can get it imported, I wouldn't think you it would be possible though.

Quote: "My second Problem is that i imported your Vb example project into VB.net, then compiled the dll, but it didn´t work

So i wanted to recompile the c++ code, but because i don´t have Vc++ i wanted to compile it in Dev c++...
But i know nothing in c/c++, so i couldnt compile anything... do you nkow, how to compile your c++ project in Dev C++, or is it impossible?"


I'll download Dev-C++ and take a look if there's another way to use the #import directive.

Quote: "3. I can´t register the dll I created with VB.Net! if i take Regsrv32 to register it, it says that the DLLRegisterServer Entry Point can´t be found! And i don´t know the Reason "


I'm a little confused by this one, I thought you didn't have .NET and that's why you wanted me to send you my .NET project files? If you do indeed have .NET then do you also have C++ .NET? Because that will work with regular VB6 files also. To answer question 3 though, VB.NET DLL's are very different from VB6 ones, VB6 uses ActiveX and the COM library but .NET uses the .NET framework so it doesn't have to be registered.

Quote: "If I change only the old functions in the VB dll, will i have to re compile both, the c++ dll and the vb dll, or just the vb dll?"


Yes, the C++ wrapper imports the VB DLL so if you recompile the VB DLL then you must also recompile the C++ one.

Quote: "So theres no way to use my dlls created with VB.Net???"


I'm currently writing a .NET version of my current code that should work with VC++ .NET and VB.NET.

Quote: "Plz look here: http://www.dotnet247.com/247reference/msgs/12/62311.aspx
Schould i waste my time trying this method?"


I honestly don't know, I guess there's no harm in just trying that method and seeing if it works. I'll try it later today.


"Computers are useless they can only give you answers."
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 3rd Mar 2004 00:36
Exeat, lol, I didn't see that By the way, did you see the post I replied to you about the resource string stuff in Lee's post?

Paul.


Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 3rd Mar 2004 00:53
Yeah, I don't think it would be that useful though because it looks as if its main purpose is reading string tables rather then writing them.


"Computers are useless they can only give you answers."
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 3rd Mar 2004 01:15
Ah ok, oh well, worth a look I suppose


kojotex
20
Years of Service
User Offline
Joined: 16th Jul 2003
Location:
Posted: 3rd Mar 2004 14:15
@Exeat: my E-Mail is AndreasHeider@gmx.de
And I have Visual Basic .net

But this is´t that important...

My main problem is that i don´t have Visual C++...
Today I tried to import your VC++ Project into Dev c+, it worked, but then i wanted to compile it and i got this error:
"vbdll.dll stray "\220" in Programm"
What does this mean???

I got this error compiling your original VC++ Project, not my old, changed version, which caused the #import problem.

I hope you get it working with VB.net and Dev C++
Good luck

Kojotex
Axel Ribenkopf
20
Years of Service
User Offline
Joined: 19th Jan 2004
Location: Paris
Posted: 3rd Mar 2004 14:54
Thank you for all this. I was looking into wrapers myself with no much hope of success.

A_R
MikeS
Retired Moderator
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 4th Mar 2004 02:25
Nice one Exeat.

I think I'm going to have some fun this weekend.




A book? I hate book. Book is stupid.
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 4th Mar 2004 07:25
Cheers everybody, glad to know some people are finding it useful.


Quote: "@Exeat: my E-Mail is AndreasHeider@gmx.de
And I have Visual Basic .net

But this is´t that important..."


Actually, that's the most important bit. Currently VB.NET won't work at all. VB.NET DLL's are so different to regular VB6 ActiveX DLL's that it's impossible to use the current code I have, no matter how much you try, it simply won't work.

I looked into using the article you put in your original post but that makes no difference. Sorry, but until I make a .NET version, there's not much you can do.


"Computers are useless they can only give you answers."
kojotex
20
Years of Service
User Offline
Joined: 16th Jul 2003
Location:
Posted: 4th Mar 2004 21:08
Ok, I think, i found another way...
Plz look here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/valrfCOMClassAttribute.asp
It's the official MS Documentaition, so i think, it schould work....
Thx to WaldiMaywood, who told me about this...

Kojotex

P.s: Ill always find a new way to create Com dlls in .net
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 7th Mar 2004 08:46
Hmmm, can't get it to work so far, I've been trying to get basic VB .NET DLL's working in C++ .NET though.

It looks as if it should work, it imports the VB DLL, it compiles, but whenever DBP tries to run a vb command from the DLL it quits instantly.

I might note I can easily run native C++ .NET commands so there must be something wrong with the VB part. Unfortunately, I don't know what.

Here's the very basic code so far in case anyone might have an idea:

C++ .NET


VB.NET


I'm puzzled.


"Computers are useless they can only give you answers."
kojotex
20
Years of Service
User Offline
Joined: 16th Jul 2003
Location:
Posted: 7th Mar 2004 11:23 Edited at: 7th Mar 2004 11:24
You could try this:



Ok, it´s just the imported VB6 code, but i think it should work...

Kojo

Login to post a reply

Server time is: 2024-05-09 03:15:55
Your offset time is: 2024-05-09 03:15:55