문제

I want to write a portable application which resides on a USB. When usb attached to pc, the application automatically starts and it may set entry to registry. I want to remove these entries when USB drive removed from the PC. Is it possible to do this?

I know that I can use autorun on my USB drive to start my application, but is there any way that I inform my application that USB needs to be removed, so it can clear the registry?

I am using C#.

도움이 되었습니까?

해결책

I think you will have to P/Invoke a Win32 API - http://msdn.microsoft.com/en-us/library/aa363480%28VS.85%29.aspx.

That should give you the events you need for when it is being unplugged.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top