Solved

urgent::code to connect pc and mobile

Posted on 2006-11-23
2
219 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Image decoding from Camera 3 96
Need help making a program or form for inventory that exports to txt 8 44
SQL Insert parts by customer 12 43
youtube blocking politics 4 58
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 …
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
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…

828 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