Click here to Skip to main content
15,884,176 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Caret not displayed in CEdit control with focus when dialog initially displayed Pin
Member 1106593315-May-20 0:36
Member 1106593315-May-20 0:36 
GeneralRe: Caret not displayed in CEdit control with focus when dialog initially displayed Pin
Richard MacCutchan15-May-20 0:48
mveRichard MacCutchan15-May-20 0:48 
QuestionPossible to #if in case an enum exists? Pin
arnold_w11-May-20 22:21
arnold_w11-May-20 22:21 
AnswerRe: Possible to #if in case an enum exists? Pin
CPallini11-May-20 22:48
mveCPallini11-May-20 22:48 
AnswerRe: Possible to #if in case an enum exists? Pin
Richard MacCutchan11-May-20 23:29
mveRichard MacCutchan11-May-20 23:29 
GeneralRe: Possible to #if in case an enum exists? Pin
Greg Utas15-May-20 0:22
professionalGreg Utas15-May-20 0:22 
GeneralRe: Possible to #if in case an enum exists? Pin
Richard MacCutchan15-May-20 0:29
mveRichard MacCutchan15-May-20 0:29 
QuestionReading sectors Pin
_Flaviu8-May-20 5:46
_Flaviu8-May-20 5:46 
I have written a little piece of code to read few (first 512) bytes from USB drive. here is the code:
C++
HANDLE hVolume = ::CreateFile(sVolume, GENERIC_READ,
    FILE_SHARE_READ | FILE_SHARE_WRITE,
    NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
TRACE("Volume handle: %p\n", hVolume);
LONG lDistLow = 0;
PLONG plDistHigh = 0;
if (INVALID_SET_FILE_POINTER == SetFilePointer(hVolume, lDistLow, plDistHigh, FILE_BEGIN) &&
    NO_ERROR != GetLastError())
{
    TRACE("Error: %d\n", GetLastError());
    return FALSE;
}
else
{
    TRACE("%d\t%d\n", lDistLow, plDistHigh);
}

DWORD dwLen = 512;
DWORD dwNum = 0;
void* pBuffer = NULL;
ReadFile(hVolume, pBuffer, dwLen, &dwNum, NULL);
TRACE("%p\t%d\t%d\n", pBuffer, dwLen, dwNum);

but the result is:
C++
Volume handle: 00000438
0	0
00000000	512	0

this pBuffer NULL tell me that I am not able to read that sectors ... why ? The program is running as admin and sVolume is feed by _T("\\\\.\\F:"), first TRACE macro printed is a prove that is OK that part. SetFilePointer is used to position the reading part, and I intend to setup offset to the beginning, right ?
AnswerRe: Reading sectors Pin
Victor Nijegorodov8-May-20 6:15
Victor Nijegorodov8-May-20 6:15 
GeneralRe: Reading sectors Pin
_Flaviu9-May-20 19:55
_Flaviu9-May-20 19:55 
GeneralRe: Reading sectors Pin
Victor Nijegorodov9-May-20 20:49
Victor Nijegorodov9-May-20 20:49 
GeneralRe: Reading sectors Pin
_Flaviu9-May-20 21:21
_Flaviu9-May-20 21:21 
AnswerRe: Reading sectors Pin
Graham Breach8-May-20 6:22
Graham Breach8-May-20 6:22 
AnswerRe: Reading sectors Pin
Richard MacCutchan8-May-20 6:46
mveRichard MacCutchan8-May-20 6:46 
GeneralRe: Reading sectors Pin
_Flaviu9-May-20 20:31
_Flaviu9-May-20 20:31 
GeneralRe: Reading sectors Pin
Richard MacCutchan9-May-20 21:32
mveRichard MacCutchan9-May-20 21:32 
GeneralRe: Reading sectors Pin
_Flaviu9-May-20 21:34
_Flaviu9-May-20 21:34 
GeneralRe: Reading sectors Pin
Richard MacCutchan9-May-20 22:13
mveRichard MacCutchan9-May-20 22:13 
GeneralRe: Reading sectors Pin
_Flaviu9-May-20 22:24
_Flaviu9-May-20 22:24 
GeneralRe: Reading sectors Pin
Victor Nijegorodov9-May-20 22:57
Victor Nijegorodov9-May-20 22:57 
GeneralRe: Reading sectors Pin
Richard MacCutchan9-May-20 23:31
mveRichard MacCutchan9-May-20 23:31 
GeneralRe: Reading sectors Pin
_Flaviu10-May-20 0:24
_Flaviu10-May-20 0:24 
GeneralRe: Reading sectors Pin
_Flaviu10-May-20 0:27
_Flaviu10-May-20 0:27 
GeneralRe: Reading sectors Pin
Victor Nijegorodov10-May-20 0:54
Victor Nijegorodov10-May-20 0:54 
GeneralRe: Reading sectors Pin
Richard MacCutchan10-May-20 1:32
mveRichard MacCutchan10-May-20 1:32 

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.