PC Review


Reply
Thread Tools Rate Thread

Detect usb storage on windows CE

 
 
Nick
Guest
Posts: n/a
 
      28th Apr 2009
Hi, I'm Nick,

i'm getting start to program in VB.Net for Windows CE application but i
don't know how to manage the usb storage.

I need to see the plug of USB storage and in Win32 i have a lot of choices
but in CE i don't know how to start.

Someone help me please?

regards
Nicola
 
Reply With Quote
 
 
 
 
Chris Tacke, MVP
Guest
Posts: n/a
 
      28th Apr 2009
This may help:

http://blog.opennetcf.com/ctacke/200...Framework.aspx


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com

"Nick" <(E-Mail Removed)> wrote in message
news:660E6D3B-84D9-4A56-8106-(E-Mail Removed)...
> Hi, I'm Nick,
>
> i'm getting start to program in VB.Net for Windows CE application but i
> don't know how to manage the usb storage.
>
> I need to see the plug of USB storage and in Win32 i have a lot of choices
> but in CE i don't know how to start.
>
> Someone help me please?
>
> regards
> Nicola


 
Reply With Quote
 
Nick
Guest
Posts: n/a
 
      28th Apr 2009
Thank you, I'm going to try .

hope that it goes well




"Chris Tacke, MVP" wrote:

> This may help:
>
> http://blog.opennetcf.com/ctacke/200...Framework.aspx
>
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Giving back to the embedded community
> http://community.OpenNETCF.com
>
> "Nick" <(E-Mail Removed)> wrote in message
> news:660E6D3B-84D9-4A56-8106-(E-Mail Removed)...
> > Hi, I'm Nick,
> >
> > i'm getting start to program in VB.Net for Windows CE application but i
> > don't know how to manage the usb storage.
> >
> > I need to see the plug of USB storage and in Win32 i have a lot of choices
> > but in CE i don't know how to start.
> >
> > Someone help me please?
> >
> > regards
> > Nicola

>

 
Reply With Quote
 
Nick
Guest
Posts: n/a
 
      28th Apr 2009
sorry Chris,

the last thing...

I don't understand exactly what does the follow istruction do?

"monitor.DeviceNotification += delegate(object sender,
DeviceNotificationArgs e)"


 
Reply With Quote
 
Christopher Fairbairn [MVP]
Guest
Posts: n/a
 
      28th Apr 2009

"Nick" <(E-Mail Removed)> wrote in message
news:331ED68B-1BB6-431F-BF48-(E-Mail Removed)...
> I don't understand exactly what does the follow istruction do?
>
> "monitor.DeviceNotification += delegate(object sender,
> DeviceNotificationArgs e)"


This is just a C# 2.0 (or higher) language feature to make the creation of
short delegate methods easier.

In this case the DeviceStatusMonitor class exposes a DeviceNotification
event, so you need to hook up an event handler to handle it.

You could write an external method such as the following

void MyEventHandlerMethod(object sender, DeviceNotificationArgs e)
{
string message = string.Format("Disk {0} has been {1}", e.DeviceName,
e.DeviceAttached ? "inserted" : "removed");
MessageBox.Show(message, "Disk Status");
}

and then hook it up as follows

monitor.DeviceNotification += new
DeviceNotificationEventHandler(MyEventHandlerMethod);

However since there is not much code in the event handler sometimes it can
be more conveniant to define the event handler inline within the setup code.

monitor.DeviceNotification += delegate(object sender, DeviceNotificationArgs
e)
{
... same code as was in the external method ...
};

Essentially it's just the code to declare a method and to hook up the event
handler merged into one C# statement.

It's call an anonymous delegate (as you can't refer to the method that is
created via a name). It's essentially a little syntatic sugar as behind the
scenes the C# compiler is generating a standard method but giving it a
"random" name (use a tool such as reflector to take a look at the generated
code).

You can refer to the Anonymous Methods section of the C# Programming Guide
available on MSDN for a better description -
http://msdn.microsoft.com/en-us/library/0yw3tz5k(VS.80).aspx

C# 3.0 also improves the situation even further with a feature called lamba
expressions (http://msdn.microsoft.com/en-us/library/bb397687.aspx) which
can reduce the amount of syntax required even further.

Hope this helps,
Christopher Fairbairn


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detect USB storage drive D2 Microsoft Dot NET 0 16th Jan 2008 09:36 AM
Detect Structured Storage Format =?Utf-8?B?YWppdA==?= Microsoft Dot NET 5 28th Aug 2007 09:06 PM
! COOD1177 does not detect any storage media =?Utf-8?B?Q2Fyb2w=?= Windows XP Music 0 8th Aug 2006 05:57 AM
detect mass-storage device John Rauhe Microsoft Dot NET 1 27th Feb 2005 08:58 AM
Re: Windows don't detect my MP3 player (Mass Storage Device) Nathan McNulty Windows XP Hardware 0 3rd Sep 2004 10:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:40 AM.