Click here to Skip to main content
15,916,842 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Call a extern variable from Application class Pin
Jokcy15-Mar-11 21:35
Jokcy15-Mar-11 21:35 
AnswerRe: Call a extern variable from Application class Pin
«_Superman_»12-Mar-11 17:42
professional«_Superman_»12-Mar-11 17:42 
GeneralRe: Call a extern variable from Application class [modified] Pin
Jokcy12-Mar-11 21:16
Jokcy12-Mar-11 21:16 
GeneralRe: Call a extern variable from Application class Pin
«_Superman_»12-Mar-11 22:03
professional«_Superman_»12-Mar-11 22:03 
GeneralRe: Call a extern variable from Application class Pin
Jokcy13-Mar-11 1:34
Jokcy13-Mar-11 1:34 
AnswerRe: Call a extern variable from Application class Pin
Richard MacCutchan12-Mar-11 22:44
mveRichard MacCutchan12-Mar-11 22:44 
GeneralRe: Call a extern variable from Application class Pin
Jokcy12-Mar-11 23:01
Jokcy12-Mar-11 23:01 
GeneralRe: Call a extern variable from Application class Pin
Richard MacCutchan13-Mar-11 2:03
mveRichard MacCutchan13-Mar-11 2:03 
GeneralRe: Call a extern variable from Application class Pin
Jokcy13-Mar-11 3:14
Jokcy13-Mar-11 3:14 
GeneralRe: Call a extern variable from Application class Pin
Richard MacCutchan13-Mar-11 4:23
mveRichard MacCutchan13-Mar-11 4:23 
GeneralRe: Call a extern variable from Application class Pin
Jokcy14-Mar-11 21:40
Jokcy14-Mar-11 21:40 
QuestionLoad Bitmap with CreateCompatibleBitmap Pin
leorex12-Mar-11 16:23
leorex12-Mar-11 16:23 
AnswerRe: Load Bitmap with CreateCompatibleBitmap Pin
bob1697212-Mar-11 18:07
bob1697212-Mar-11 18:07 
GeneralRe: Load Bitmap with CreateCompatibleBitmap Pin
leorex12-Mar-11 18:11
leorex12-Mar-11 18:11 
GeneralRe: Load Bitmap with CreateCompatibleBitmap Pin
bob1697212-Mar-11 19:55
bob1697212-Mar-11 19:55 
AnswerRe: Load Bitmap with CreateCompatibleBitmap Pin
Richard MacCutchan12-Mar-11 22:49
mveRichard MacCutchan12-Mar-11 22:49 
AnswerRe: Load Bitmap with CreateCompatibleBitmap Pin
Hans Dietrich13-Mar-11 0:15
mentorHans Dietrich13-Mar-11 0:15 
QuestionGdplus::Color to DWORD Pin
csrss12-Mar-11 8:56
csrss12-Mar-11 8:56 
AnswerRe: Gdplus::Color to DWORD Pin
bob1697212-Mar-11 9:37
bob1697212-Mar-11 9:37 
AnswerRe: Gdplus::Color to DWORD Pin
Luc Pattyn12-Mar-11 10:05
sitebuilderLuc Pattyn12-Mar-11 10:05 
GeneralRe: Gdplus::Color to DWORD Pin
bob1697212-Mar-11 11:06
bob1697212-Mar-11 11:06 
GeneralRe: Gdplus::Color to DWORD Pin
csrss12-Mar-11 19:46
csrss12-Mar-11 19:46 
QuestionDebug Error While Running Program on Other Computer Pin
AmbiguousName12-Mar-11 7:20
AmbiguousName12-Mar-11 7:20 
AnswerRe: Debug Error While Running Program on Other Computer Pin
Code-o-mat12-Mar-11 8:53
Code-o-mat12-Mar-11 8:53 
QuestionUSB devices list [modified] Pin
fasked12-Mar-11 3:12
fasked12-Mar-11 3:12 
How can I get the list of USB mass storage devices of kind "C:\, D:\" and etc, using C and WINAPI? I tried to do it with SetupDi* functions and got the friendly name and full path to device, but it isn't that needed.

#include <stdio.h>
#include <tchar.h>

#include <windows.h>
#include <setupapi.h>
#include <winioctl.h>

#pragma comment(lib, "setupapi")

int _tmain()
{
    DWORD i = 0;
    DWORD required_size = 0;

    PSP_INTERFACE_DEVICE_DETAIL_DATA interface_details;
    SP_INTERFACE_DEVICE_DATA interface_info;
    HDEVINFO dev_info;

    dev_info = SetupDiGetClassDevs (&GUID_DEVINTERFACE_DISK, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
    if (dev_info == INVALID_HANDLE_VALUE) 
    {
        // ERROR
        return EXIT_FAILURE;
    }

    ZeroMemory (&interface_info, sizeof (interface_info));
    interface_info.cbSize = sizeof (interface_info);

    for (i = 0; SetupDiEnumDeviceInterfaces (dev_info, NULL, &GUID_DEVINTERFACE_DISK, i, &interface_info); ++i)
    {
        SetupDiGetInterfaceDeviceDetail (dev_info, &interface_info, NULL, 0, &required_size, NULL);
        interface_details = (PSP_INTERFACE_DEVICE_DETAIL_DATA) LocalAlloc (0, required_size);
        interface_details->cbSize = sizeof (*interface_details);

        SetupDiGetInterfaceDeviceDetail (dev_info, &interface_info, interface_details, required_size, NULL, NULL);

        // 
        // interface_details->DevicePath include full path to device
        //
        
        LocalFree (interface_details);
        interface_details = NULL;
    }

    SetupDiDestroyDeviceInfoList (dev_info);
    return EXIT_SUCCESS;
}


Can you help me with this question?

Best Regards,
Alexander S.
modified on Saturday, March 12, 2011 11:20 AM

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.