Click here to Skip to main content
15,913,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Problem with Socket Pin
Divyang Mithaiwala14-Apr-09 21:31
Divyang Mithaiwala14-Apr-09 21:31 
AnswerRe: Problem with Socket Pin
KarstenK14-Apr-09 21:36
mveKarstenK14-Apr-09 21:36 
AnswerRe: Problem with Socket Pin
ParagPatel14-Apr-09 21:45
ParagPatel14-Apr-09 21:45 
GeneralRe: Problem with Socket Pin
Abhijit D. Babar14-Apr-09 21:55
Abhijit D. Babar14-Apr-09 21:55 
GeneralRe: Problem with Socket Pin
ThatsAlok14-Apr-09 23:18
ThatsAlok14-Apr-09 23:18 
GeneralRe: Problem with Socket Pin
ParagPatel14-Apr-09 23:22
ParagPatel14-Apr-09 23:22 
GeneralRe: Problem with Socket Pin
Abhijit D. Babar16-Apr-09 19:53
Abhijit D. Babar16-Apr-09 19:53 
GeneralRe: Problem with Socket Pin
ParagPatel25-Apr-09 0:52
ParagPatel25-Apr-09 0:52 
QuestionUrldownloadToFile Pin
p_196014-Apr-09 20:42
p_196014-Apr-09 20:42 
AnswerRe: UrldownloadToFile Pin
Rajesh R Subramanian14-Apr-09 20:47
professionalRajesh R Subramanian14-Apr-09 20:47 
AnswerRe: UrldownloadToFile Pin
Hamid_RT14-Apr-09 20:49
Hamid_RT14-Apr-09 20:49 
AnswerRe: UrldownloadToFile Pin
KarstenK14-Apr-09 21:38
mveKarstenK14-Apr-09 21:38 
AnswerRe: UrldownloadToFile Pin
ThatsAlok14-Apr-09 23:16
ThatsAlok14-Apr-09 23:16 
QuestionRe: UrldownloadToFile Pin
David Crow15-Apr-09 3:32
David Crow15-Apr-09 3:32 
QuestionCoonected USB Device Pin
Davitor14-Apr-09 19:32
Davitor14-Apr-09 19:32 
AnswerRe: Coonected USB Device Pin
Xing Chen14-Apr-09 19:59
Xing Chen14-Apr-09 19:59 
GeneralRe: Coonected USB Device Pin
Davitor14-Apr-09 20:43
Davitor14-Apr-09 20:43 
GeneralRe: Coonected USB Device Pin
Xing Chen14-Apr-09 21:34
Xing Chen14-Apr-09 21:34 
AnswerRe: Coonected USB Device Pin
Hamid_RT14-Apr-09 20:22
Hamid_RT14-Apr-09 20:22 
AnswerRe: Coonected USB Device Pin
Randor 14-Apr-09 23:12
professional Randor 14-Apr-09 23:12 
AnswerRe: Coonected USB Device Pin
Jonathan Davies15-Apr-09 1:22
Jonathan Davies15-Apr-09 1:22 
GeneralRe: Coonected USB Device Pin
Davitor15-Apr-09 1:40
Davitor15-Apr-09 1:40 
GeneralRe: Coonected USB Device Pin
Jonathan Davies15-Apr-09 1:53
Jonathan Davies15-Apr-09 1:53 
GeneralRe: Coonected USB Device Pin
Davitor15-Apr-09 2:04
Davitor15-Apr-09 2:04 
GeneralRe: Coonected USB Device Pin
Jonathan Davies15-Apr-09 2:53
Jonathan Davies15-Apr-09 2:53 
OK, the classes depend on WTL, but I just tried some code an MFC dialog and started getting names of devices. I put this in OnInitDialog to test it as the first wizard generated comment shows. Try it. You'll need to #include devguid.h; and then put a break point on nMemberIndex++; and look at the name in szFriendlyName. After the first name go round the loop looking at the names.

// TODO: Add extra initialization here
const GUID Guid = GUID_DEVCLASS_PORTS;
DWORD Flags = DIGCF_PRESENT |  DIGCF_DEVICEINTERFACE;
HDEVINFO hDevInfo = SetupDiGetClassDevs(&Guid, 0, 0, Flags);


BOOL bDevInfo;
int nMemberIndex = 0;
do{
    SP_DEVINFO_DATA spDevInfoData;
    spDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
    bDevInfo = ::SetupDiEnumDeviceInfo(hDevInfo, nMemberIndex, &spDevInfoData);

    DWORD Property = SPDRP_FRIENDLYNAME;
    wchar_t  szFriendlyName[1024] = {0};
    BOOL bGotRegProp = ::SetupDiGetDeviceRegistryProperty(hDevInfo, &spDevInfoData,
                                                      Property,
                                                      0L,
                                                      (PBYTE)szFriendlyName,
                                                      2048,
                                                      0);

    nMemberIndex++;
}
while(bDevInfo);

Once you have this working then change GUID_DEVCLASS_PORTS for something that finds your device, but start with it as it is then were running the same code.

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.