×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    4

    using c# and .net for connectivity

    Hi

    I've seen a couple of messages about using C# and .NET for development but I'm having trouble really getting started. Is there a post or link somewhere which will give me some pointers to get rolling with this?

    I've figured out (I think) that I need to convert the COM dlls to .NET dlls with

    tlbimp <com.dll> /out:<.netdll>

    for instance I just converted one like this ..

    tlbimp NclMsg.dll /out:NokiaCLMessaging.dll

    and I've then been looking at the results with ildasm and they seem to have something like the right objects and methods in them.

    ok - what do I do now? What parameters are required to csc.exe to compile with these .dlls? No I don't have the benefit of visual studio, I have just the 1.1 SDK :-(

    Also - what do connection points look like when COM libraries are converted to C# .NET-style libraries? Do I have to get a IConnectionPoint interface and then call Advise()/Unadvise() on it?

  2. #2
    Regular Contributor
    Join Date
    Nov 2003
    Posts
    221
    Hi,

    using tlbimp was the first step to success. Note that the generated interop file is just a wrapper to the original COM component and both are required at runtime.

    A overview of the CSC is included with the .NET SDK docs and online (at http://msdn.microsoft.com/library/de...ommandline.asp for instance).

    Basically you could write:
    "CSC *.cs /out:MyApp.exe /reference:NokiaCLMessaging.dll"
    which compiles all *.cs files in the working directory into a console application (is the default) called MyApp.exe. The only external reference is the previously created NokiaCLMessaging.dll file.

    A note on connection points:
    The interop file also wraps the original connection points into .NET-style events, which you can register. But, as experience shows, this does not always work and you may have to additionally do the traditional "Advise", as happened to me when using components of the Nokia PC SDK.
    I don't have code at hand for the Advise, but if you need it, you'll start with the System.Runtime.InteropServices namespace with the UCOMIConnectionPoint interface.


    Zamba

  3. #3
    Registered User
    Join Date
    Dec 2003
    Posts
    4
    thanks Zamba, I managed to figure some of that stuff out and I'm learning a lot more about .NET than I intended to! It's good to have it all in a thread for other people to reference, I'm sure we're not the only people going to be doing this and I have no idea if Nokia is even thinking about releasing a .NET native version of their kit (be nice though huh).

    I'll see how well I do with those connection points, I found code on microsoft for the Advise()/Unadvise() calls which I can use if necessary. It's here

    here

    Error handling seems a little messed up using COM in .NET, I have to get to the bottom of that, error returns appear to be turned into Exceptions, which is fine, but I haven't yet managed to dig any useful info out of the exception.

    It kind of sort of works doesn't it, this whole COM/.NET thing, I don't think it's really the best way to get into .NET though!

  4. #4
    Registered User
    Join Date
    Dec 2003
    Posts
    4
    thanks Zamba, I managed to figure some of that stuff out and I'm learning a lot more about .NET than I intended to! It's good to have it all in a thread for other people to reference, I'm sure we're not the only people going to be doing this and I have no idea if Nokia is even thinking about releasing a .NET native version of their kit (be nice though huh).

    I'll see how well I do with those connection points, I found code on microsoft for the Advise()/Unadvise() calls which I can use if necessary. It's here.

    Error handling seems a little messed up using COM in .NET, I have to get to the bottom of that, error returns appear to be turned into Exceptions, which is fine, but I haven't yet managed to dig any useful info out of the exception.

    It kind of sort of works doesn't it, this whole COM/.NET thing, I don't think it's really the best way to get into .NET though!

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    2

    Re: using c# and .net for connectivity

    I'm also doing the same thing developing a .net application to send sms Via My mobile Connected to PC using USB

    can you go in depth what are the events that were firing in NokiaCLMessaging.dll class

    what events i need to write to make that COM object work for me??

    Thanks in advance...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×