Solved

urgent::code to connect pc and mobile

Posted on 2006-11-23
2
210 Views
Last Modified: 2010-04-16
Hi,
I have written a code as suggested(from the link: http://www.codeproject.com\ce\mobileconnect.asp).
but i want to know how my pc will automatically detect the mobile connected via usb and give a notification that it is connected or not .

Thanks and Regards,
Sal

0
Comment
Question by:ddipro
2 Comments
 
LVL 8

Accepted Solution

by:
deadite earned 500 total points
ID: 18006481
Your link to the code didn't work.  I'm not sure what language you are using...  If you are interested in determining connected USB devices, here is a vbscript that returns the connected USB devices

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colDevices = objWMIService.ExecQuery _
    ("Select * From Win32_USBControllerDevice")

For Each objDevice in colDevices
    strDeviceName = objDevice.Dependent
    strQuotes = Chr(34)
    strDeviceName = Replace(strDeviceName, strQuotes, "")
    arrDeviceNames = Split(strDeviceName, "=")
    strDeviceName = arrDeviceNames(1)
    Set colUSBDevices = objWMIService.ExecQuery _
        ("Select * From Win32_PnPEntity Where DeviceID = '" & strDeviceName & "'")
    For Each objUSBDevice in colUSBDevices
        Wscript.Echo objUSBDevice.Description
    Next    
Next


You can modify the code a bit by adding a simple if statement to match your mobile device.  Then just run the script and it will let you know if it is connected.
0
 

Author Comment

by:ddipro
ID: 18006637
thanks for ur coperation
but i m writing this code using  mfc, c++ and win32 as described in the given link.
So i need help related to these field only

thanks,
sal
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
wordmultiple challenge 12 90
White board coding practice 3 61
Hide vba in gp 7 43
Programatically extract date from website 8 17
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now