Click here to Skip to main content
15,921,276 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionActivate Caption Pin
The NULL Developer25-Oct-05 23:25
professionalThe NULL Developer25-Oct-05 23:25 
AnswerRe: Activate Caption Pin
John R. Shaw26-Oct-05 16:17
John R. Shaw26-Oct-05 16:17 
GeneralRe: Activate Caption Pin
The NULL Developer26-Oct-05 19:59
professionalThe NULL Developer26-Oct-05 19:59 
QuestionIImageDecodeEventSink Pin
Carsten Leue25-Oct-05 23:17
Carsten Leue25-Oct-05 23:17 
QuestionCalling from explicitly loaded .dll Pin
DaveDrPop25-Oct-05 22:41
DaveDrPop25-Oct-05 22:41 
AnswerRe: Calling from explicitly loaded .dll Pin
Chris Losinger26-Oct-05 1:39
professionalChris Losinger26-Oct-05 1:39 
QuestionDetect USB drive writable Pin
LiYS25-Oct-05 22:24
LiYS25-Oct-05 22:24 
AnswerRe: Detect USB drive writable Pin
kakan26-Oct-05 0:46
professionalkakan26-Oct-05 0:46 
Create a HANDLE to the drive, then use this code:

BOOL IsDiskWriteProtected(HANDLE hDrive)
{
DWORD dwRet;

BOOL bWritable = DeviceIoControl(hDrive,
IOCTL_DISK_IS_WRITABLE,
NULL, 0, NULL, 0,
&dwRet,
NULL);

// If you don't have the SDK, IOCTL_DISK_IS_WRITABLE is a DWORD
// with the hex value 0x00070024

if(bWritable == TRUE) return FALSE;
return TRUE;
}

To get a HANDLE to the drive, do this:

BOOL OpenDrive(char drive)
{
char NtDriveName[10];
char m_drive = drive;


if(hDrive != (HANDLE) 0) CloseDrive();

// Open and Lock the drive
//

m_drive = (char) toupper((int) m_drive);
sprintf(NtDriveName, "\\\\.\\%c:", m_drive);


hDrive = CreateFile(
NtDriveName,
GENERIC_READ | GENERIC_WRITE, // Possibly just GENERIC_READ
0,
NULL,
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING,
NULL
);

if ( hDrive == INVALID_HANDLE_VALUE ) {
// Cannot open it, Error!
return FALSE;
}
// OK
return TRUE;
}


-- modified at 7:13 Wednesday 26th October, 2005
GeneralRe: Detect USB drive writable Pin
LiYS26-Oct-05 5:32
LiYS26-Oct-05 5:32 
GeneralRe: Detect USB drive writable Pin
Blake Miller26-Oct-05 6:59
Blake Miller26-Oct-05 6:59 
GeneralRe: Detect USB drive writable Pin
kakan26-Oct-05 19:35
professionalkakan26-Oct-05 19:35 
GeneralRe: Detect USB drive writable Pin
LiYS27-Oct-05 19:19
LiYS27-Oct-05 19:19 
QuestionHow to set a Textcolor in a CListCtrl Pin
bosfan25-Oct-05 22:23
bosfan25-Oct-05 22:23 
AnswerRe: How to set a Textcolor in a CListCtrl Pin
prasad_som25-Oct-05 23:34
prasad_som25-Oct-05 23:34 
GeneralRe: How to set a Textcolor in a CListCtrl Pin
Anonymous26-Oct-05 1:02
Anonymous26-Oct-05 1:02 
QuestionHow can I get a copy of wav file with other format Pin
extraf25-Oct-05 21:38
extraf25-Oct-05 21:38 
AnswerRe: How can I get a copy of wav file with other format Pin
Blake Miller26-Oct-05 7:00
Blake Miller26-Oct-05 7:00 
QuestionHide the blue task pane in a CHtmlView Pin
gleditzsch25-Oct-05 21:26
gleditzsch25-Oct-05 21:26 
QuestionDensity sampling Pin
Arrun25-Oct-05 20:50
Arrun25-Oct-05 20:50 
Questionprime number with recursion Pin
Rajesh_K_Sharma25-Oct-05 20:07
Rajesh_K_Sharma25-Oct-05 20:07 
AnswerRe: prime number with recursion Pin
sunit525-Oct-05 22:11
sunit525-Oct-05 22:11 
GeneralRe: prime number with recursion Pin
toxcct25-Oct-05 22:25
toxcct25-Oct-05 22:25 
AnswerRe: prime number with recursion Pin
ddmcr25-Oct-05 22:57
ddmcr25-Oct-05 22:57 
JokeRe: prime number with recursion Pin
toxcct25-Oct-05 23:15
toxcct25-Oct-05 23:15 
GeneralRe: prime number with recursion Pin
ThatsAlok26-Oct-05 0:00
ThatsAlok26-Oct-05 0:00 

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.