This is shown in call stack when exception occurred:
mfc80ud.dll!CGdiObject::Attach(void * hObject=0xb90510f0) Line 1157 + 0x3 bytes
mfc80ud.dll!CBitmap::CreateCompatibleBitmap(CDC * pDC=0x004bf954, int nWidth=336, int nHeight=189) Line 251 + 0x25 bytes
AxGraph.ocx!CGraphCtrl::Initialize(CDC * pInputDC=0x004bf954, int width=336, int height=189) Line 27
I could not understand why is this happening. Help to resolve the issue.
Usually I instantiate my CDialog based classes in my view class. Then CMyView class typically creates a modal dialog and then launches a function on OK from which I can easily access the dialog variables.
Unfortunately, the wizard implementation of CPropertySheet has no default constructor. So you are forced to construct it in the view function that is called from a toolbar menu or similar. Then the property page variables have to be duplicated in CMyView class and copied. I have 2 books that show it done this way.
Here is the wizard CPropertySheet constructor code-
I wrote the below code in an attempt to set a 500ms timer. CreateWaitableTimer returns a valid handle and SetWaitableTimer() returns 1 indicating success, however TimerAPCProc() never gets called. Can anybody see what's wrong with this code?
Thanks for the reply and information. The timer is being created in the main thread so it's definitely not a problem of it exiting too soon. I also tried setting the time to -1 just to try and get it to call the TimerAPCProc but still it wouldn't.
I solved the problem by switching to SetTimer(). For some reason I thought SetTimer() worked in seconds rather than milliseconds and that's the only reason I was using SetWaitableTimer(). I was looking for an alternative time and noticed SetTimer() took a value in milliseconds so it was fine for what I needed.
I still don't understand why SetWaitableTimer() wouldn't work but it doesn't really matter now.
Just CreateFile with binary access, write it, seek to the front, and read it back record by record. If you want random access, then the records must be the same size. If you want variable length records, just precede each binary record with a DWORD with the record size when you write it, then when you read it back, read the DWORD to get the record size, then read the data block, - this also implies that the file must be sequentially accessed both for writing and reading.
I have the following program.
I want to use char array at the end of while loop so that after while loop if i use printf() statement it will be printed.I have already copy the directory in an char array.Actually i am something confusing at this time and cann't solve the problem.
if (hFind == INVALID_HANDLE_VALUE)
printf ("Invalid file handle. Error is %u\n", GetLastError());
printf("First file name is %s\n",firstdir);
while (FindNextFile(hFind, &FindFileData) != 0)
printf("Other dir is:%s\n",otherdir);
* here i want a char array *
* printf("All dir except first is:%s",array); *
dwError = GetLastError();
if (dwError != ERROR_NO_MORE_FILES)
printf ("FindNextFile error. Error is %u\n", dwError);
I have commented the line where i want the char array.Actually i want this array outside while loop.
Perhaps «_Superman_» overlooked the difference between c and c++ when it came to dynamically sized array declarations - they work just fine here too.
Um, this is really very easy.
You need to declare somewhere to hold a string.
After each new filename has been retrieved it's tacked onto the end of the existing string
When the loop's over the string is printed.
I can think of at least 3 ways around this mountain, though (surprise, surprise) went for the easiest/quickest/dodgiest (is that even a word?) way.
1. Declare a new var in main and initialize to 4096 times "\0" (since I'm testing in C:\ and I know there to be under 4kb worth of file/folder names there)
1. Dynamically resizing the memory used to hold the final string.
2. Getting a count of the number of dir-entries, then creating an array of char* with that many entries. You then alloctae some memory, point dirEntryArray[curEntryNum] at this memory, and make sure you copy the current filename into said mem.
You can probably see why I went for the 'coding-horrors' way.
EDIT: ah crap! See, that's why David is an MVP, and I'm not.
Last Visit: 31-Dec-99 19:00 Last Update: 7-Dec-23 1:23