Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7797335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:39:07+00:00 2026-06-01T23:39:07+00:00

The C++ dll is using Win32 to read from and write data to the

  • 0

The C++ dll is using Win32 to read from and write data to the Serial Port. I need that data in my C# application. Is it simply a case of referencing the dll the way I would any other dll written in C#, import that and then call the methods in it? Or do I need to do something differently?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:39:09+00:00Added an answer on June 1, 2026 at 11:39 pm

    You need to use PInvoke if this DLL is not a COM library

    Basically, every function exported by the DLL need to be defined using the syntax required.
    This is an example of the declaration required to access the function InternetGetConnectedState from wininet.dll

    [DllImport("wininet.dll")]
    private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ;
    

    After that declare you could call the function from your C# code in this way

    public static bool IsConnectedToInternet( )
    {
        try
        {
            int Desc;
            return InternetGetConnectedState(out Desc, 0);
        }
        catch 
        {
            return false;
        }
    }
    

    Of course, your DLL shuld be visible from your application (same folder or path)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to access functionality from win32 dll , for that I am using
From within a C# application(Visual Studio 2008) i am calling a win32 dll using
I have a .NET application that makes calls to a native Win32 DLL using
I am writing a Win32 DLL library that can be redistributed. I am using
I am using Win32 memcached from http://labs.northscale.com/memcached-packages/ And there is a DLL file within
I am using C++ to create a simple DLL that I can use from
I am using .dll reference to my application. i want to unload the .dll
How can I develop applications in C# that can be further extended using DLL
I tried to create a win32 dll using c++. It has a map declared
I am using Win32::API to call an arbitary function exported in a DLL which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.