473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

USB communications using StreamReader and StreamWriter

I'm doing some USB communications in C# and am running into a minor
annoyance. I'm using the Windows API CreateFile function to get a
SafeFileHandle, which I then stuff into a FileStream and from there
into StreamReader and StreamWriter objects.
i do this code for streamreader
Expand|Select|Wrap|Line Numbers
  1.  StreamReader fPipein = new StreamReader(WinAPIWrapper.GetStreamFromGuid(m, @"\PIPE00"));
but visual-studio-c# show this error to me
Unable to find an entry point named 'GetStreamFromGuid' in DLL 'User32.dll'.
Unable to find an entry point named 'GetStreamFromGuid' in DLL 'User32.dll'.

and also for chenging to setupapi.dll

Unable to find an entry point named 'GetStreamFromGuid' in DLL 'setupapi.dll'.

i dont know what should i do... for a safe handle to access usb for reading ang writing

thanks
Feb 15 '12 #1
2 1091
PsychoCoder
465 Expert Mod 256MB
Show us the code where you're declaring the Win32 API GetStreamFromGuid and how you're populating m
Feb 15 '12 #2
Expand|Select|Wrap|Line Numbers
  1. namespace WindowsFormsApplication6
  2. {
  3.     public partial class Form1 : Form
  4.     {
  5.  
  6.         public Form1()
  7.         {
  8.             InitializeComponent();
  9.         }
  10.  
  11.         private void Form1_Load(object sender, EventArgs e)
  12.         {
  13.         }
  14.         class WinAPIWrapper
  15.         {
  16.             // Use DllImport to import the Win32 GetFocus function.
  17.             //[STAThread]
  18.             //[DllImport("User32.dll")]
  19.             [DllImport("setupapi.dll", CharSet = CharSet.Auto,SetLastError = true)]
  20.             //[DllImport("Kernel32.dll")]
  21.             //[DllImport("gdi32.dll")]
  22.  
  23.             public static extern string GetStreamFromGuid(Guid b,string a);
  24.  
  25.         }
  26.         /*[DllImport("setupapi.dll")]
  27.         public static Guid m = new Guid();//"53f56307-b6bf-11d0-94f2-00a0c91efb8b");
  28.         StreamReader fPipein = new StreamReader(WinAPIWrapper.GetStreamFromGuid(m, @"\PIPE00"));
  29.     }
  30. }
thanks
Feb 15 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Joecx | last post by:
Using vb.net, I am using Streamreader to read a text file and searching for a line to delete, the I close the file and open it as a streamwriter so I can put the new file back to disk without the...
5
by: Lyle | last post by:
How do get a line control on the end of a line using the streamwriter.writeline (not carriage line control)? How do you get the following command to print a quote in the file? I have tried using...
1
by: Stephen | last post by:
Hi, I am reading a file (c:\address.txt) using streamreader and I want to make changes to a line in the file and save it. will there be a locking issue if I read and write to the samefile...
1
by: JM | last post by:
Hi, I have been trying to read a file, using "StreamReader" to pass the info to an string that is: ....dim stream as new FileStream(file,...) dim sr as new StreamReader(stream) dim data as...
5
by: jkristia | last post by:
StreamReader throws an exception if I attempt to open a .csv file which is also opened by Excel. I checked this list and found what I though was the solution, first open the file stream in read...
2
by: Thelonious Monk | last post by:
I have a problem where some data is being eliminated. The problem is that the data contains signed numeric fields (the low-order byte of a negative number uses the first 4 bits as a sign and...
5
by: Rob | last post by:
Hi, I have a VB.Net application that parses an HTML file. This file was an MS Word document that was saved as web page. My application removes all unnecessary code generated by MS Word and does...
1
by: xitij9 | last post by:
Hi, I am importing a .csv file using StreamReader. I can not use Jet Engine as I cannot install it on client. I am reading it line by line and then split the line with comma and get the array. (Is...
7
by: =?Utf-8?B?TWFuanJlZSBHYXJn?= | last post by:
Hi, I am using StreamReader to read an ASCII file that contains blank lines. How can I omit reading blank lines? I tried somting like... FileStream inFile = new...
3
by: stumorgan | last post by:
I'm doing some USB communications in C# and am running into a minor annoyance. I'm using the Windows API CreateFile function to get a SafeFileHandle, which I then stuff into a FileStream and from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...
0
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...

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.