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

Discussion in 'Microsoft VB .NET' started by Jason Keats, Apr 7, 2011.

  1. Jason Keats

    Jason Keats Guest

    "DanS" <> 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.
     
    Jason Keats, Apr 7, 2011
    #1
    1. Advertisements

  2. Jason Keats

    Mayayana Guest

    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?
     
    Mayayana, Apr 7, 2011
    #2
    1. Advertisements

  3. Jason Keats

    Tom Shelton Guest

    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
     
    Tom Shelton, Apr 7, 2011
    #3
  4. Jason Keats

    Tom Shelton Guest

    DanS has brought this to us :
    > "Mayayana" <> wrote in news:inkc8g$ui0
    > $:
    >
    >> 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
     
    Tom Shelton, Apr 7, 2011
    #4
  5. Jason Keats

    Mayayana Guest

    |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?
     
    Mayayana, Apr 7, 2011
    #5
  6. Jason Keats

    Jason Keats Guest

    DanS wrote:
    > "Jason Keats"<> wrote in
    > news:DA8np.678$:
    >
    >>
    >> "DanS"<> 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
     
    Jason Keats, Apr 7, 2011
    #6
  7. 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
     
    Armin Zingler, Apr 7, 2011
    #7
  8. Jason Keats

    Tom Shelton Guest

    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
     
    Tom Shelton, Apr 7, 2011
    #8
  9. Jason Keats

    Tom Shelton Guest

    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
     
    Tom Shelton, Apr 7, 2011
    #9
  10. "DanS" <> 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?
     
    StrandElectric, Apr 7, 2011
    #10
  11. Jason Keats

    Tom Shelton Guest

    StrandElectric expressed precisely :
    > "DanS" <> 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?


    There are not killing it. There has been no indication that this is
    true, other then a link to a tweet by some guy at an ms conference -
    and attendy, not a ms guy. Believe me, if it were true - it would have
    been huge news by now.

    --
    Tom Shelton
     
    Tom Shelton, Apr 7, 2011
    #11
  12. Am 07.04.2011 20:04, schrieb DanS:
    > Armin Zingler <> wrote in
    > news:-berlin.de:
    >
    >> 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.

    >
    > Because ?


    It's not a language.

    >>>> 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.

    >
    > To make sure I'm interpreting this right......your first line is
    > sarcasm?


    It was more a kind of "SCNR". :) To be really honest, I was saying
    this knowing that C# is a little ahead of VB.Net nowadays. (I don't know
    why but I've heart of it...) I must admit this, and I'm a little bit
    frustrated about it. (Well, not really because it doesn't play a
    role for my life. :) ) I think it's a pity because I consider VB
    the better human related computer language and it does not deserve
    being treated poorly.


    --
    Armin
     
    Armin Zingler, Apr 7, 2011
    #12
  13. Jason Keats

    Cor Guest

    Armin(Schrieb)

    >>

    It was more a kind of "SCNR". :) To be really honest, I was saying
    this knowing that C# is a little ahead of VB.Net nowadays.
    />

    In what?

    Has been, even XBox and WP7 have parity in VB and C#

    Be aware, there is always something which comes earlier for VB or/and for
    C#.

    Cor
     
    Cor, Apr 10, 2011
    #13
  14. Am 10.04.2011 17:56, schrieb Cor:
    > Armin(Schrieb)
    >
    >>>

    > It was more a kind of "SCNR". :) To be really honest, I was saying
    > this knowing that C# is a little ahead of VB.Net nowadays.
    > />
    >
    > In what?


    I've heard intellisense is better, and C# has unsafe blocks.
    There was also something in LINQ. Covariance/contravariance in
    VB 2008? I'm not sure about this, but maybe Tom will tell us.

    > Has been, even XBox and WP7 have parity in VB and C#
    >
    > Be aware, there is always something which comes earlier for VB or/and for
    > C#.



    --
    Armin
     
    Armin Zingler, Apr 10, 2011
    #14
  15. Jason Keats

    Cor Guest

    Armin,

    The unsafe code was possible since version 2002 in C#.

    In version 2008 had 2010 better Linq Lambda's, but those are also in VB
    since version 2010.

    Read this what is new in version 2010

    http://msdn.microsoft.com/en-us/library/bb386063.aspx

    Don't forget to read the VB part and the C# part. Most additions are for
    making that VB parity with C#.

    However, C# got also a new one (you can check it yourself).

    A new "dynamic" keyword for variables makes programming likewise in VB with
    Option strict Off possible in C#.

    That is of course for you direct a reason to go to C# :)

    Here one of the newest articles

    http://blogs.msdn.com/b/lisa/archive/2011/03/28/xna-is-coming-to-visual-basic.aspx

    Don't forget to click on that link about co evolution

    Cor

    "Armin Zingler" wrote in message news:-berlin.de...

    Am 10.04.2011 17:56, schrieb Cor:
    > Armin(Schrieb)
    >
    >>>

    > It was more a kind of "SCNR". :) To be really honest, I was saying
    > this knowing that C# is a little ahead of VB.Net nowadays.
    > />
    >
    > In what?


    I've heard intellisense is better, and C# has unsafe blocks.
    There was also something in LINQ. Covariance/contravariance in
    VB 2008? I'm not sure about this, but maybe Tom will tell us.

    > Has been, even XBox and WP7 have parity in VB and C#
    >
    > Be aware, there is always something which comes earlier for VB or/and for
    > C#.



    --
    Armin
     
    Cor, Apr 10, 2011
    #15
  16. Cor,

    > Read this what is new in version 2010


    I bought VS 2008 Professional few month before 2010 came out
    because I needed it and couldn't wait these month anymore.
    Therefore I didn't immediatelly upgrade to the new version and
    still work with 2008. 2010 ist not a must-have, I think.
    (and I can't do without an MDI interface...)


    > A new "dynamic" keyword for variables makes programming likewise in VB with
    > Option strict Off possible in C#.
    >
    > That is of course for you direct a reason to go to C# :)


    You know me well. :)

    > Here one of the newest articles
    >
    > http://blogs.msdn.com/b/lisa/archive/2011/03/28/xna-is-coming-to-visual-basic.aspx
    >
    > Don't forget to click on that link about co evolution



    Thanks for keeping me up-to-date. :)

    --
    Armin
     
    Armin Zingler, Apr 10, 2011
    #16
  17. Jason Keats

    Tom Shelton Guest

    Armin Zingler explained on 4/10/2011 :
    > Am 10.04.2011 17:56, schrieb Cor:
    >> Armin(Schrieb)
    >>
    >>>>

    >> It was more a kind of "SCNR". :) To be really honest, I was saying
    >> this knowing that C# is a little ahead of VB.Net nowadays.
    >> />
    >>
    >> In what?

    >
    > I've heard intellisense is better


    It is. Way better. For me, the biggest problem is the VB.NET
    autocorrection. It's very line oriented - so, say if I do this in C#:

    string path = Path.Combine("C:\", "somedirectory\someotherdirector);

    and I don't have System.IO referenced, the C# IDE will recognize this
    BEFORE I hit enter, so I can hit ctrl+. and fix it right after the Path
    entry and then I get full intellisense on the rest of the line. VB.NET
    you have to type the whole expression and hit enter before it notices
    that Path doesn't exist...

    >, and C# has unsafe blocks.


    Yeah, but, I wouldn't call this an advantage really - seriously, I've
    use this feature only a handfull of times in the last 10 years :)

    > There was also something in LINQ. Covariance/contravariance in
    > VB 2008? I'm not sure about this, but maybe Tom will tell us.
    >


    As of VB10, the languages are pretty close feature wise... Though, I
    find a couple of VB's implementations of C# features a bit hockey. And
    I don't like VB's lambda syntax at all...

    class Program
    {
    static void Main ( string[] args )
    {
    var myList = new List<int> () { 1, 2, 3, 5 };
    myList.ForEach ( Console.WriteLine );
    }
    }

    vs

    Module Module1

    Sub Main()
    Dim myList As New List(Of Integer) From {1, 2, 3, 4, 5}
    myList.ForEach(Sub(i) Console.WriteLine(i))
    End Sub

    End Module

    But of course, that's very subjective. In reality, probably the
    biggest feature still missing from VB.NET is iterator support in the
    form of yield return. Which actually becomes quite a problem when
    dealing with LINQ heavily.

    --
    Tom Shelton
     
    Tom Shelton, Apr 10, 2011
    #17
  18. Am 10.04.2011 20:54, schrieb Tom Shelton:
    >> I've heard intellisense is better

    >
    > It is. Way better.


    Tom, thanks for the insight. What you've described wasn't bugging me (yet).

    >> , and C# has unsafe blocks.

    >
    > Yeah, but, I wouldn't call this an advantage really - seriously, I've
    > use this feature only a handfull of times in the last 10 years :)


    For me it would be the most interesting feature, but as I sometimes
    have to use C++ (if I have to make use of native stuff), I also use
    it for "unsafe" code if I need to instead of C#.

    --
    Armin
     
    Armin Zingler, Apr 11, 2011
    #18
  19. Jason Keats

    Tom Shelton Guest

    Armin Zingler formulated on Monday :
    > Am 10.04.2011 20:54, schrieb Tom Shelton:
    >>> I've heard intellisense is better

    >>
    >> It is. Way better.

    >
    > Tom, thanks for the insight. What you've described wasn't bugging me (yet).
    >
    >>> , and C# has unsafe blocks.

    >>
    >> Yeah, but, I wouldn't call this an advantage really - seriously, I've
    >> use this feature only a handfull of times in the last 10 years :)

    >
    > For me it would be the most interesting feature, but as I sometimes
    > have to use C++ (if I have to make use of native stuff), I also use
    > it for "unsafe" code if I need to instead of C#.


    Sorry, I'm not following? If you calling into C++ dll's you don't need
    unsafe anymore then you do in VB.NET. It's only if you want to do
    direct memory manipulations that this becomes an advantage - like some
    types of graphics processing, etc. But, that's not stuff I normally do
    :)

    Where I used it was getting at variable values exported from shared
    libraries on Linux :) Yes, I was using mono. I was working on a
    wrapper for ncurses...

    --
    Tom Shelton
     
    Tom Shelton, Apr 11, 2011
    #19
  20. Am 11.04.2011 19:56, schrieb Tom Shelton:
    >> For me it would be the most interesting feature, but as I sometimes
    >> have to use C++ (if I have to make use of native stuff), I also use
    >> it for "unsafe" code if I need to instead of C#.

    >
    > Sorry, I'm not following? If you calling into C++ dll's you don't need
    > unsafe anymore then you do in VB.NET.


    Pardon?

    > It's only if you want to do
    > direct memory manipulations that this becomes an advantage - like some
    > types of graphics processing, etc. But, that's not stuff I normally do
    > :)


    It's just: No reason for me to use C# because I use C++ if necessary.

    > Where I used it was getting at variable values exported from shared
    > libraries on Linux :) Yes, I was using mono. I was working on a
    > wrapper for ncurses...


    I see.

    --
    Armin
     
    Armin Zingler, Apr 11, 2011
    #20
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Precious

    Advantages of .NET DLL over VB6 DLL

    Precious, Nov 25, 2003, in forum: Microsoft VB .NET
    Replies:
    3
    Views:
    367
    Precious
    Nov 25, 2003
  2. Douglas Marquardt

    ComInterop: VB6 Com Interface object = VB6 Com object fails

    Douglas Marquardt, Mar 22, 2006, in forum: Microsoft VB .NET
    Replies:
    1
    Views:
    490
    Douglas Marquardt
    Mar 22, 2006
  3. Ruth
    Replies:
    3
    Views:
    424
    Herfried K. Wagner [MVP]
    Aug 18, 2006
  4. Guest

    .net dll vs vb6 dll

    Guest, May 4, 2007, in forum: Microsoft VB .NET
    Replies:
    4
    Views:
    247
    Spam Catcher
    May 4, 2007
  5. SAL
    Replies:
    3
    Views:
    5,913
    Cor Ligthert[MVP]
    Dec 19, 2007
Loading...

Share This Page