Click here to Skip to main content
15,886,835 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Difference between Unicode and Multibyte Pin
Richard MacCutchan31-May-11 7:40
mveRichard MacCutchan31-May-11 7:40 
AnswerRe: Difference between Unicode and Multibyte Pin
jschell31-May-11 8:26
jschell31-May-11 8:26 
Question[Win32] How compare two image Pin
Member 296547131-May-11 4:03
Member 296547131-May-11 4:03 
AnswerRe: [Win32] How compare two image Pin
David Crow31-May-11 4:07
David Crow31-May-11 4:07 
GeneralRe: [Win32] How compare two image Pin
Member 296547131-May-11 5:31
Member 296547131-May-11 5:31 
QuestionGetting floppy drive in logical drives Pin
VCProgrammer30-May-11 22:51
VCProgrammer30-May-11 22:51 
AnswerRe: Getting floppy drive in logical drives Pin
ShilpiP31-May-11 0:39
ShilpiP31-May-11 0:39 
QuestionRe: Getting floppy drive in logical drives Pin
David Crow31-May-11 3:29
David Crow31-May-11 3:29 
VCProgrammer wrote:
How can i find this??

How about something like:

bool isFloppyDevice( LPCTSTR lpszDevice )
{
    TCHAR szBuffer[MAX_PATH];
    bool bIsFloppy = false;
  
    if (QueryDosDevice(lpszDevice, szBuffer, MAX_PATH) > 0)
        bIsFloppy = (_tcsstr(_T("device\\floppy"), szBuffer) != NULL);
  
    return bIsFloppy;
}
A slightly longer way, although I cannot test it, might be:

bool isFloppyDevice( void )
{
    bool bIsFloppy = false;
  
    HANDLE hDevice = CreateFile(_T("\\\\.\\A:"), 
                                0, 
                                0, 
                                NULL, 
                                OPEN_EXISTING, 
                                0, 
                                NULL);
  
    if (hDevice != INVALID_HANDLE_VALUE)
    {
        DISK_GEOMETRY dg;
        DWORD dwBytesReturned;
  
        bIsFloppy = (DeviceIoControl(hDevice, 
                                     IOCTL_DISK_GET_DRIVE_GEOMETRY, 
                                     NULL, 
                                     0, 
                                     &dg, 
                                     sizeof(dg), 
                                     &dwBytesReturned, 
                                     NULL) != FALSE);
  
        CloseHandle(hDevice);
    }
  
    return bIsFloppy;
}

"One man's wage rise is another man's price increase." - Harold Wilson

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather


Questionstack error in char array Pin
arupsarkar30-May-11 16:18
arupsarkar30-May-11 16:18 
AnswerRe: stack error in char array Pin
«_Superman_»30-May-11 18:43
professional«_Superman_»30-May-11 18:43 
AnswerRe: stack error in char array Pin
tolw30-May-11 18:59
tolw30-May-11 18:59 
GeneralRe: stack error in char array Pin
Stefan_Lang30-May-11 22:33
Stefan_Lang30-May-11 22:33 
GeneralRe: stack error in char array Pin
tolw30-May-11 23:00
tolw30-May-11 23:00 
GeneralRe: stack error in char array Pin
Stefan_Lang30-May-11 23:07
Stefan_Lang30-May-11 23:07 
GeneralRe: stack error in char array Pin
«_Superman_»31-May-11 4:03
professional«_Superman_»31-May-11 4:03 
GeneralRe: stack error in char array Pin
Chuck O'Toole31-May-11 6:48
Chuck O'Toole31-May-11 6:48 
GeneralRe: stack error in char array Pin
Stefan_Lang31-May-11 22:59
Stefan_Lang31-May-11 22:59 
GeneralRe: stack error in char array Pin
«_Superman_»31-May-11 23:01
professional«_Superman_»31-May-11 23:01 
AnswerRe: stack error in char array Pin
Stefan_Lang30-May-11 22:40
Stefan_Lang30-May-11 22:40 
AnswerRe: stack error in char array Pin
Chuck O'Toole31-May-11 1:54
Chuck O'Toole31-May-11 1:54 
GeneralRe: stack error in char array Pin
Stefan_Lang31-May-11 23:03
Stefan_Lang31-May-11 23:03 
GeneralRe: stack error in char array Pin
MicroVirus1-Jun-11 2:15
MicroVirus1-Jun-11 2:15 
GeneralRe: stack error in char array Pin
Chuck O'Toole1-Jun-11 2:43
Chuck O'Toole1-Jun-11 2:43 
GeneralRe: stack error in char array Pin
Stefan_Lang1-Jun-11 3:15
Stefan_Lang1-Jun-11 3:15 
QuestionWhy my 64 architecture exe is not able to read registry? Pin
rahul.kulshreshtha30-May-11 2:51
rahul.kulshreshtha30-May-11 2:51 

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.