PC Review


Reply
Thread Tools Rate Thread

Re: VB.net DLL ? (from VB6 ?)

 
 
Jason Keats
Guest
Posts: n/a
 
      7th Apr 2011

"DanS" <(E-Mail Removed)> wrote in message
news:Xns9EBFA8B1BDB3Athisnthatroadrunnern@216.196.97.131...

>
> Is it possible to make a .Net DLL from the class on that page,
> and instantiate and use it as an object in a VB6 app ?
>


You can't call a regular .NET DLL from VB6.

However, it is possible to create a COM (aka ActiveX) DLL in .NET that can
be called from VB6.

Note that, when deploying, you still need the .NET Framework to be
installed.




 
Reply With Quote
 
 
 
 
Mayayana
Guest
Posts: n/a
 
      7th Apr 2011
What you linked to looks like very basic winsock
functions to me. (Maybe with a function to convert
between big endian and little endian? I don't know
enough about .Net to be sure.) You can do that in
VB directly using winsock API, or with the winsock
OCX. (The winsock class from Oleg Gdalevich is still
around online.) I think you'd also need to use capicom
functions, for the MD5 encryption, which shouldn't
be a problem, but I haven't used it myself.

Maybe the question should be how you're going to
use the software. If it's just for you then it might be
easiest to do what you're doing... and learn in the
process. If it's for distribution that changes the
picture. ...Adding a 1GB+- .Muck dependency for an
OCX? Need I say more?


 
Reply With Quote
 
 
 
 
Tom Shelton
Guest
Posts: n/a
 
      7th Apr 2011
Mayayana submitted this idea :
> What you linked to looks like very basic winsock
> functions to me. (Maybe with a function to convert
> between big endian and little endian? I don't know
> enough about .Net to be sure.) You can do that in
> VB directly using winsock API, or with the winsock
> OCX. (The winsock class from Oleg Gdalevich is still
> around online.) I think you'd also need to use capicom
> functions, for the MD5 encryption, which shouldn't
> be a problem, but I haven't used it myself.
>
> Maybe the question should be how you're going to
> use the software. If it's just for you then it might be
> easiest to do what you're doing... and learn in the
> process. If it's for distribution that changes the
> picture. ...Adding a 1GB+- .Muck dependency for an
> OCX? Need I say more?


First off - it's not that big. I know you like to keep pushing that,
but it's simply not true. My .NET folder on this machine is just under
a gig, and I have basically every version of .NET installed. 32-bit and
64-bit.

Further, on any new machines - beyond xp, the framework will already be
present (3.0). So - depending on which version of the framework that
is targeted, it's really only xp you might have to install the
framework (it's very common to find at least 2.0 already installed),
and you could always use the 3.5 or 4.0 client profile. My preference
would be to just target the 4.0 client profile - yes, you will probably
almost always install the framework, but, it's much smaller then a full
install and you get to use all the new features... Though, in his
particular application he could easily get away with just targeting the
2.0 runtime - and then he would probably almost never have to install
(3.0 is the 2.0 runtime, with some additional classes).

As for the rest, creating a com accesible class is pretty easy.

Here is a simple example for using a vb.net class in vba:
http://support.microsoft.com/kb/317535

The process is basically the same for vb6.

--
Tom Shelton


 
Reply With Quote
 
Tom Shelton
Guest
Posts: n/a
 
      7th Apr 2011
DanS has brought this to us :
> "Mayayana" <(E-Mail Removed)> wrote in news:inkc8g$ui0
> $(E-Mail Removed):
>
>> What you linked to looks like very basic winsock
>> functions to me. (Maybe with a function to convert
>> between big endian and little endian? I don't know
>> enough about .Net to be sure.)

>
> That's the problem, I don't know enough about .Net to know
> exactly what's going on in the Winsock part.
>


Looking at the code, you could really write the socket part fairly
easily using the winsock api (I suppose you could even use the winsock
ctrl - but I hate it, so I won't suggest it...)

Basically, the winsock stuff is going to be your basic send and
recieve.

The hardes part in there is the MD5 stuff, and I'm fairly certain you
can do that using the crypto api, but, I've not messed with that ever.

> If it would take an hour or two to rewrite in VB6, I'd go that
> route at this time. But, having to learn how winsock now works
> in .Net is a deal killer as well. The way it's used in that
> class at least.
>


Winsock in .net is a fairly think wrapper around the winsock api. That
can be a little confusing for people comming from vb - because, they
are used to even notifications for async sockets, rather than the use
of callbacks.

>
>> You can do that in
>> VB directly using winsock API, or with the winsock
>> OCX. (The winsock class from Oleg Gdalevich is still
>> around online.) I think you'd also need to use capicom
>> functions, for the MD5 encryption, which shouldn't
>> be a problem, but I haven't used it myself.
>>
>> Maybe the question should be how you're going to
>> use the software. If it's just for you then it might be
>> easiest to do what you're doing... and learn in the
>> process. If it's for distribution that changes the
>> picture.

>
> Well, it is for distribution.
>
> Ultimately, I'd like to rewrite the entire thing in C#, but
> that's not happening any time soon.


Good choice

--
Tom Shelton


 
Reply With Quote
 
Mayayana
Guest
Posts: n/a
 
      7th Apr 2011

|Adding a 1GB+- .Muck dependency for an
| > OCX? Need I say more?
|
| First off - it's not that big. I know you like to keep pushing that,
| but it's simply not true.

a.. Hardware Requirements:
a.. Recommended Minimum: Pentium 1 GHz or higher with 512 MB RAM or more
b.. Minimum disk space:
a.. x86 - 850 MB
b.. x64 - 2 GB
c..
Maybe it's not quite a GB. I haven't tried installing
it since v. 2. In any case, it's gigantic by an standard.
It's become an OS within an OS. And it's not just a
case of storing it. It also has to load in order to run
the software.

As I said, if he's writing .Net and has a new PC that
can easily handle all that muck, then he might just as
well learn more .Net. But if the software is being
distributed... why would anyone add all that in just to
avoid translating some winsock code?


 
Reply With Quote
 
Jason Keats
Guest
Posts: n/a
 
      7th Apr 2011
DanS wrote:
> "Jason Keats"<(E-Mail Removed)> wrote in
> newsA8np.678$(E-Mail Removed):
>
>>
>> "DanS"<(E-Mail Removed)> wrote
>> in message
>> news:Xns9EBFA8B1BDB3Athisnthatroadrunnern@216.196.97.131...
>>
>>>
>>> Is it possible to make a .Net DLL from the class on that
>>> page, and instantiate and use it as an object in a VB6 app
>>> ?
>>>

>>
>> You can't call a regular .NET DLL from VB6.
>>
>> However, it is possible to create a COM (aka ActiveX) DLL
>> in .NET that can be called from VB6.
>>
>> Note that, when deploying, you still need the .NET
>> Framework to be installed.

>
> I did find some instructions on the web to do this.
>
> Compile to a dll.
>
> Run asmreg.exe (maybe the wrong name, working from memory) to
> register it.....
>
> asmreg.exe mydll.dll /codebase
>
> It was telling me however that asmreg needs to use 'Signed'
> dll's......I recompiled with it 'signed', was still getting
> the same error.
>
> Any chance this is because I'm using the Express version?


Regasm is what you should have been trying.

But, these links should help:

http://www.15seconds.com/issue/040723.htm
http://msdn.microsoft.com/en-us/library/ms973802.aspx
 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      7th Apr 2011
Am 07.04.2011 17:44, schrieb DanS:
>>>
>>> Ultimately, I'd like to rewrite the entire thing in C#,
>>> but that's not happening any time soon.


Bad choice.

>> Good choice

>
> Is there another choice ? (Since MS is axing VB.Net, at least,
> that is my understanding.)


Yeah, and VB is an interpreter language for beginners only.

Some rumors persist forever.

--
Armin
 
Reply With Quote
 
Tom Shelton
Guest
Posts: n/a
 
      7th Apr 2011
DanS laid this down on his screen :
>>>
>>> Ultimately, I'd like to rewrite the entire thing in C#,
>>> but that's not happening any time soon.

>>
>> Good choice

>
> Is there another choice ? (Since MS is axing VB.Net, at least,
> that is my understanding.)


No they aren't... That was just a weird rumor. I've not seen anything
even remotely that would hint at that except for taht tweet that karl
posted.

> (FWIW, I *did* try using the import tool in VB.Net 2008X on my
> VB6 project, but that failed miserably.)


It can do that... It really depends on how the code is organized. It's
usually better to re-write anyway.

--
Tom Shelton


 
Reply With Quote
 
Tom Shelton
Guest
Posts: n/a
 
      7th Apr 2011
Mayayana formulated the question :
>> Adding a 1GB+- .Muck dependency for an
>>> OCX? Need I say more?

>>
>> First off - it's not that big. I know you like to keep pushing that,
>> but it's simply not true.

>
> a.. Hardware Requirements:
> a.. Recommended Minimum: Pentium 1 GHz or higher with 512 MB RAM or more
> b.. Minimum disk space:
> a.. x86 - 850 MB
> b.. x64 - 2 GB
> c..


And? Seriously, they haven't made a machine with those specs in
YEARS... If I got a machine like that today, I'd wipe it out and
install linux on it and use it for a small web server or something.

> Maybe it's not quite a GB.


Well, my entire c:/windows/microsoft.net folder is right at 1GB.

> I haven't tried installing
> it since v. 2. In any case, it's gigantic by an standard.


No it's not. Especially the 4.0 client profile...

XPSP3 VM - no .net installed
Web installer size 868K
Install download size 30MB (about 3 minute download for me)
size on disk 292 MB

Not even close to a gig. That's a 20GB virtual disk - so, that means
that's about 1.5% of the disk space. And 20GB is very small by todays
standards.

> It's become an OS within an OS. And it's not just a
> case of storing it. It also has to load in order to run
> the software.
>


LOL.. You keep saying taht... but it does not load the whole framework.

> As I said, if he's writing .Net and has a new PC that
> can easily handle all that muck, then he might just as
> well learn more .Net. But if the software is being
> distributed... why would anyone add all that in just to
> avoid translating some winsock code?


I personally, would probably translate the code, if this was a
maintenace scenario. Of course, I wouldn't be writing anything new in
VB6 anyway...

--
Tom Shelton


 
Reply With Quote
 
StrandElectric
Guest
Posts: n/a
 
      7th Apr 2011

"DanS" <(E-Mail Removed)> wrote in message
news:Xns9EC07776C8E7Bthisnthatroadrunnern@216.196.97.131...
>
>
> Is there another choice ? (Since MS is axing VB.Net, at least,
> that is my understanding.)


M$ axing vb.net!!! When vb6 was axed (to the fury of those of us who'd
spent years learnng it) that possibility was precisely what concerned us. If
they do that to vb6 why not then do it to vb.net in due course and so waste
everyone's time again!

No point in my continuing to learn vb.net then?


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT: Need to call VB6 DLL from C# .net application without referencing VB6 DLL csharpguy Microsoft C# .NET 4 22nd May 2006 08:06 PM
ComInterop: VB6 Com Interface object = VB6 Com object fails Douglas Marquardt Microsoft VB .NET 1 22nd Mar 2006 09:13 PM
How to Pass a form object of VB6 from .NET to VB6. pm.thirumalai@gmail.com Microsoft Dot NET 0 19th Feb 2006 01:19 PM
VB6.0 vs VB6.3 Joe Blow Microsoft Excel Programming 7 1st Jun 2004 09:50 AM
2002-2000 (or VB6.3-VB6.0) problem John Meers Microsoft Excel Discussion 1 26th Aug 2003 10:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:11 PM.