Click here to Skip to main content
15,899,825 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to recognize null values or not required fileds Pin
Henry Minute30-Aug-09 1:52
Henry Minute30-Aug-09 1:52 
AnswerRe: how to recognize null values or not required fileds Pin
Arindam Sinha29-Aug-09 22:12
Arindam Sinha29-Aug-09 22:12 
AnswerRe: how to recognize null values or not required fileds Pin
darkelv30-Aug-09 2:34
darkelv30-Aug-09 2:34 
QuestionUsing WPD api (Windows Portable Devices) Pin
Jacob Dixon29-Aug-09 17:06
Jacob Dixon29-Aug-09 17:06 
AnswerRe: Using WPD api (Windows Portable Devices) Pin
marines29-Aug-09 22:45
marines29-Aug-09 22:45 
GeneralRe: Using WPD api (Windows Portable Devices) Pin
Jacob Dixon30-Aug-09 3:29
Jacob Dixon30-Aug-09 3:29 
GeneralRe: Using WPD api (Windows Portable Devices) [modified] Pin
cigarhuang6-Sep-09 17:10
cigarhuang6-Sep-09 17:10 
GeneralRe: Using WPD api (Windows Portable Devices) [modified] Pin
kiquenet.com25-Aug-14 22:34
professionalkiquenet.com25-Aug-14 22:34 
Any final solution with full source code sample application ?
IMHO, better samples for minimize learning curve are real applications with full source code and good patterns.



The one line of Power-shell script below un-mounts a USB cable attached Windows Portable Device (WPD) from the Windows Operating System (XP thru W8/2012)

And just in case you have not yet started playing with Powershell, here is the equivalent VBScript (maybe be can port to C#):

Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery ("Select * from Win32ext_WPD Where strFriendlyName = 'SAMSUNG-SGH-I747'")
For Each objItem in colItems
Set objWMIWPDStatic = objWMIService.Get("Win32ext_WPD")
Set objInParam = objWMIWPDStatic.Methods_("EjectDevice").inParameters.SpawnInstance_()
objInParam.Properties_.Item("strObjectDeviceId") = objItem.strId
Set objOutParams = objWMIService.ExecMethod("Win32ext_WPD", "EjectDevice", objInParam)
Exit For
Next
Note change ‘SAMSUNG-SGH-I747′ to the phone/tablet name you see in Windows Explorer

About Win32ext_WPD

"Select * from Win32ext_WPD Where strFriendlyName = 'SAMSUNG-SGH-I747'"

Not well document googleing, not found more 2 references.

Maybe port to C# using:

var oScope = new ManagementScope(@"\\" + MachineName + @"\root\cimv2");
Reference:

http://squadratechnologies.wordpress.com/2013/07/24/windows-powershellvbscript-to-un-mount-a-smart-phone-or-tablet/
kiquenet.com


modified 26-Aug-14 4:56am.

Question[solved] Subracting two shorts [modified] Pin
Dwayner7929-Aug-09 15:26
Dwayner7929-Aug-09 15:26 
AnswerRe: Subracting two shorts Pin
Obsidian71329-Aug-09 16:25
Obsidian71329-Aug-09 16:25 
AnswerRe: Subracting two shorts Pin
PIEBALDconsult29-Aug-09 18:35
mvePIEBALDconsult29-Aug-09 18:35 
GeneralRe: Subracting two shorts Pin
Dwayner7930-Aug-09 7:18
Dwayner7930-Aug-09 7:18 
GeneralRe: Subracting two shorts Pin
Luc Pattyn30-Aug-09 10:43
sitebuilderLuc Pattyn30-Aug-09 10:43 
GeneralRe: Subracting two shorts Pin
Dwayner7930-Aug-09 15:50
Dwayner7930-Aug-09 15:50 
GeneralRe: Subracting two shorts Pin
Luc Pattyn30-Aug-09 16:28
sitebuilderLuc Pattyn30-Aug-09 16:28 
QuestionManagementBaseObject returns when invoking a WMI method? Pin
Strahan20129-Aug-09 12:08
Strahan20129-Aug-09 12:08 
AnswerRe: ManagementBaseObject returns when invoking a WMI method? Pin
Dave Kreskowiak29-Aug-09 15:17
mveDave Kreskowiak29-Aug-09 15:17 
Questionshow bit field as Checkbox in Listview Pin
Jassim Rahma29-Aug-09 9:48
Jassim Rahma29-Aug-09 9:48 
AnswerRe: show bit field as Checkbox in Listview Pin
Abhishek Sur29-Aug-09 10:51
professionalAbhishek Sur29-Aug-09 10:51 
AnswerRe: show bit field as Checkbox in Listview Pin
Mycroft Holmes29-Aug-09 15:26
professionalMycroft Holmes29-Aug-09 15:26 
Questionalways selected Listview item Pin
Jassim Rahma29-Aug-09 9:40
Jassim Rahma29-Aug-09 9:40 
AnswerRe: always selected Listview item Pin
Abhishek Sur29-Aug-09 10:55
professionalAbhishek Sur29-Aug-09 10:55 
AnswerRe: always selected Listview item Pin
Mycroft Holmes29-Aug-09 15:24
professionalMycroft Holmes29-Aug-09 15:24 
Questionhide & Show a Listview Column Pin
Jassim Rahma29-Aug-09 9:38
Jassim Rahma29-Aug-09 9:38 
AnswerRe: hide & Show a Listview Column Pin
Abhishek Sur29-Aug-09 10:56
professionalAbhishek Sur29-Aug-09 10:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.