473,832 Members | 2,118 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to import the Windows serial communication structure into Visual C#.NET

Hello Experts,
I am porting the C++ code into the Visual C#.NET. My C++ code is
mainly based on the serial communication. So I am using the windows
structure such as DCB.. etc and the windows functions frequently in my
C++ code. I came to know how to import the windows functions into
Visual C#.NET. But what is the method to import windows structure into
Visual C#.NET?

It will be very helpful for me if anybody can give me the WebID that
has information regarding importing the windows functions and the
structure into the Visual C#.NET

Thanks in advance for any help.

Regards,
Vidya Bhagwath
Nov 17 '05 #1
4 4740
Hi,

Take a look at an article from MSDN magazine that explain how to interact
with the serial port.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Vidya Bhagwath" <vi************ @gmail.com> wrote in message
news:85******** *************** ***@posting.goo gle.com...
Hello Experts,
I am porting the C++ code into the Visual C#.NET. My C++ code is
mainly based on the serial communication. So I am using the windows
structure such as DCB.. etc and the windows functions frequently in my
C++ code. I came to know how to import the windows functions into
Visual C#.NET. But what is the method to import windows structure into
Visual C#.NET?

It will be very helpful for me if anybody can give me the WebID that
has information regarding importing the windows functions and the
structure into the Visual C#.NET

Thanks in advance for any help.

Regards,
Vidya Bhagwath

Nov 17 '05 #2
Hi..

Also, the "general" answer to this is to see DllImport documentation. The
doc explains how you need to "reconstruc t" C/C++ structures in C# to
manipulate them correctly. The Marshal class (under the covers) takes care
of passing the data correctly between unmanaged (C/C++) and managed (C#)
code.

John Puopolo
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:uX******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Take a look at an article from MSDN magazine that explain how to interact
with the serial port.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Vidya Bhagwath" <vi************ @gmail.com> wrote in message
news:85******** *************** ***@posting.goo gle.com...
Hello Experts,
I am porting the C++ code into the Visual C#.NET. My C++ code is
mainly based on the serial communication. So I am using the windows
structure such as DCB.. etc and the windows functions frequently in my
C++ code. I came to know how to import the windows functions into
Visual C#.NET. But what is the method to import windows structure into
Visual C#.NET?

It will be very helpful for me if anybody can give me the WebID that
has information regarding importing the windows functions and the
structure into the Visual C#.NET

Thanks in advance for any help.

Regards,
Vidya Bhagwath


Nov 17 '05 #3
"John Puopolo" <jo**********@f astsearch.com.n ospam> wrote in message news:<#l******* *******@TK2MSFT NGP09.phx.gbl>. ..
Hi..

Also, the "general" answer to this is to see DllImport documentation. The
doc explains how you need to "reconstruc t" C/C++ structures in C# to
manipulate them correctly. The Marshal class (under the covers) takes care
of passing the data correctly between unmanaged (C/C++) and managed (C#)
code.

John Puopolo
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:uX******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Take a look at an article from MSDN magazine that explain how to interact
with the serial port.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Vidya Bhagwath" <vi************ @gmail.com> wrote in message
news:85******** *************** ***@posting.goo gle.com...
Hello Experts,
I am porting the C++ code into the Visual C#.NET. My C++ code is
mainly based on the serial communication. So I am using the windows
structure such as DCB.. etc and the windows functions frequently in my
C++ code. I came to know how to import the windows functions into
Visual C#.NET. But what is the method to import windows structure into
Visual C#.NET?

It will be very helpful for me if anybody can give me the WebID that
has information regarding importing the windows functions and the
structure into the Visual C#.NET

Thanks in advance for any help.

Regards,
Vidya Bhagwath


Hi All,
I was sucessfully able to import Windows serial communication
structure into Visual C#.NET by following your suggestions. Thank you
very much for your guidance.
Regards,
Vidya Bhagwath
Nov 17 '05 #4
Vidaya, Could U please send me the class for the same...

Dear expert,

I am tring to communicate with a serial port. and I am using C# with .NET 1.1
and machine is XP. I have HSM(Host security module by THALES) to connect
with the following settings...

m_CommPort_obj. BaudRate = 9600;
m_CommPort_obj. ByteSize = 8;
m_CommPort_obj. Parity = 2;
m_CommPort_obj. PortNum = 1;
m_CommPort_obj. ReadTimeout = 100;
m_CommPort_obj. StopBits = 1;

I am using http://www.aciss.com/justin/JustinIO.zip, a class for the comm
and I am able to open, write on the port But unable to read the data from it.
Could anybody suggest, whats wrong with the code or settings ? and on which
bemt I should read.?

I do not want to use MSCOmm.ocx. Actually i am looking for the " running
code" in .NET(vb or C#) having method sends and receive data from the serial
port. On google, I have gone through almost all the link and get a lots of
code..... but not running, if running ... its with a lots of error. So if U
have tested code please give me the calss at least so that I can work with.

Thanks in ur anticipation
Reply me on "ra***********@ 3i-infotech.com" and ra*******@gmail .com
Rakesh.
"Vidya Bhagwath" wrote:
"John Puopolo" <jo**********@f astsearch.com.n ospam> wrote in message news:<#l******* *******@TK2MSFT NGP09.phx.gbl>. ..
Hi..

Also, the "general" answer to this is to see DllImport documentation. The
doc explains how you need to "reconstruc t" C/C++ structures in C# to
manipulate them correctly. The Marshal class (under the covers) takes care
of passing the data correctly between unmanaged (C/C++) and managed (C#)
code.

John Puopolo
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:uX******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Take a look at an article from MSDN magazine that explain how to interact
with the serial port.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Vidya Bhagwath" <vi************ @gmail.com> wrote in message
news:85******** *************** ***@posting.goo gle.com...
> Hello Experts,
> I am porting the C++ code into the Visual C#.NET. My C++ code is
> mainly based on the serial communication. So I am using the windows
> structure such as DCB.. etc and the windows functions frequently in my
> C++ code. I came to know how to import the windows functions into
> Visual C#.NET. But what is the method to import windows structure into
> Visual C#.NET?
>
> It will be very helpful for me if anybody can give me the WebID that
> has information regarding importing the windows functions and the
> structure into the Visual C#.NET
>
> Thanks in advance for any help.
>
> Regards,
> Vidya Bhagwath

Hi All,
I was sucessfully able to import Windows serial communication
structure into Visual C#.NET by following your suggestions. Thank you
very much for your guidance.
Regards,
Vidya Bhagwath

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4118
by: sarah | last post by:
hI, I have a project. I need to realise serial communication between PC and Altera FPGA in c or c++. The function of FPGA is working well. it can send data to uart. Does anybody know how to realise it in c or c++? Thanks
11
7099
by: sarah | last post by:
hI, I have a project. I need to realise serial communication between PC and Altera FPGA in c or c++. The function of FPGA is working well. it can send data to uart. Does anybody know how to realise it in c or c++? Thanks
1
9906
by: Jamil | last post by:
I have a target box connected to my desktop (x86 Windows 2000) PC through a serial cable (COM port). The target box running on different processor and OS. The target box needs to send a specific formatted data (2 bytes header + 128 bytes data) asynchronously through the serial port and I've to capture it at the host PC side and save those into a file. I like to have the client-server model. The PC will be a server and start a forever...
1
9727
by: Chris | last post by:
Hi, I'm trying to find out if a serial communication dll exists that would allow me to communicate to devices connected on the com port through .net. My implementation language will be C#. I was able to find MSCOMM.OCX but that is an ActiveX control which requires a gui (i believe?). Eventually, the application I will be running will be a Windows Service so I think I need a regular dll (I'm not sure though). Any suggestions?
3
3149
by: carmen | last post by:
I'm working in an aplication for a Smart Device that need to "talk" with a printer continuosly through the serial port. I'm trying to use the John Hint's sample code "Use P/Invoke to develop a .NET Base Class Library for Serial Device Communication" but I'm new with VC# and need some basic rules because I have a lot of compilation errors. Where should I create my inherited class? Thank you
0
920
by: fswfsw | last post by:
Hallo everybody: I have some questions about Seiral communication with GPS. I am using the "Serial Port" in Windows application form of Visual studio 2005. In one second I receive several messages from port. each message has different number of bytes. I know the time in one second when the data arrive. How can I make sure I receive correctly? my codes is like this: Port2->Write(Oa,0,18); //after this command, i get messages in one...
4
2144
by: nmsreddi | last post by:
Hi friends , after a long busy work happy to back to forums, i have developed a windows application(C#2,0) for serial communication. the aim of my application is to connect to external device(energy meter in my case) and have to get data from the that device . approximately the time to read complete data frfom meter is 10 minutes(may be more also up to one hour in some cases) ,during this time my application is not allowing...
1
2107
by: lakshmiRam | last post by:
hi i have written the following code to receive data from mobile using bluetooth through serial communication. but it is not working <code> #include <stdio.h> #include <conio.h> #include <windows.h> #include "stdafx.h"
1
1989
by: InduGokul | last post by:
i want to perform serial communication on selecting .Net Framework2.0--->Visual Basic--->Device application presently i am using this code Imports System.IO.Ports Imports System.IO.Ports.Serialport If Button1.Text Is "open port" then
0
9795
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10541
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9320
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7753
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3078
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.