Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

urgent::code to connect pc and mobile

Posted on 2006-11-23
2
Medium Priority
?
240 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn different types of Android Layout and some basics of an Android App.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

971 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