Click here to Skip to main content
15,896,453 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Convert CString to DWORD or CString to COLORREF Pin
Rajkumar R8-Feb-08 0:11
Rajkumar R8-Feb-08 0:11 
GeneralRe: Convert CString to DWORD or CString to COLORREF [modified] Pin
CPallini8-Feb-08 0:20
mveCPallini8-Feb-08 0:20 
GeneralRe: Convert CString to DWORD or CString to COLORREF Pin
orihime10-Feb-08 18:09
orihime10-Feb-08 18:09 
GeneralRe: Convert CString to DWORD or CString to COLORREF Pin
CPallini10-Feb-08 21:46
mveCPallini10-Feb-08 21:46 
Questionprivileged instruction exception in ultimate grid Pin
Anna Anna7-Feb-08 22:44
Anna Anna7-Feb-08 22:44 
GeneralRe: privileged instruction exception in ultimate grid Pin
Iain Clarke, Warrior Programmer8-Feb-08 1:12
Iain Clarke, Warrior Programmer8-Feb-08 1:12 
GeneralRe: privileged instruction exception - Problem solved Pin
Anna Anna8-Feb-08 3:27
Anna Anna8-Feb-08 3:27 
GeneralA very strange problem (to me at least) ..... Pin
Still learning how to code7-Feb-08 22:28
Still learning how to code7-Feb-08 22:28 
I created a very simple class (CLogFile) to enable me to trace events within my applications (It writes diagnostic messages to a hard disk file during exceution of the app) Admittedly, I have generally used this in the past with Dialog-based apps, but now I have included it in a Doc/View MDI app and have a peculiar problem.
I should explain that my CLogFile class is instantiated in the InitInstance function of the app, and a global pointer created pointing to the CLogFile object. In functions that I want to trace, I simply dereference the global pointer and thereby call the Add(CString szMsg) public member function to add the string to the file.
This all works fine in all locations in which I have used it to date, but, currently having a problem in OnDraw(), I tried using it there and got a 0xC0000005 access exception but (and this is the interesting bit) on the SECOND time through !! I get the same problem in OnPrepareDC(). I have now generated an vanilla (i.e. as initially produced by AppWizard) doc/view app and added the LogFile class, and get the same problem. It appears that the exception is being generated because the member variables in the CLogFile object have been corrupted. In an attempt to find the source of the corruption, I opened a memory window and displayed the area where the class members are located. The data is correct after exiting AfxWndProc() and then it enters (windows) assembler code. Still tracing, I get to a call where it won't step through to the target. Locating the target address, I find that the location is "mid-instruction". I have no doubt that this is then leading to the access exception. Can anybody give me a clue on how this corruption might be occuring ? I just can't understand why it works perfectly well in (supposedly) ALL other areas of the code, and yet fails in this way in these two functions. Any help/explanation would be greatly appreciated !

Doug

GeneralRe: A very strange problem (to me at least) ..... Pin
CPallini7-Feb-08 23:06
mveCPallini7-Feb-08 23:06 
GeneralRe: A very strange problem (to me at least) ..... Pin
Still learning how to code7-Feb-08 23:13
Still learning how to code7-Feb-08 23:13 
QuestionRe: A very strange problem (to me at least) ..... Pin
CPallini7-Feb-08 23:16
mveCPallini7-Feb-08 23:16 
GeneralRe: A very strange problem (to me at least) ..... Pin
Still learning how to code7-Feb-08 23:58
Still learning how to code7-Feb-08 23:58 
GeneralRe: A very strange problem (to me at least) ..... Pin
CPallini8-Feb-08 0:05
mveCPallini8-Feb-08 0:05 
GeneralRe: A very strange problem (to me at least) ..... Pin
Matthew Faithfull8-Feb-08 0:09
Matthew Faithfull8-Feb-08 0:09 
GeneralRe: A very strange problem (to me at least) ..... Pin
Still learning how to code8-Feb-08 0:59
Still learning how to code8-Feb-08 0:59 
GeneralRe: A very strange problem (to me at least) ..... Pin
Still learning how to code8-Feb-08 1:31
Still learning how to code8-Feb-08 1:31 
QuestionRe: A very strange problem (to me at least) ..... Pin
CPallini8-Feb-08 2:17
mveCPallini8-Feb-08 2:17 
GeneralRe: A very strange problem (to me at least) ..... Pin
Still learning how to code8-Feb-08 2:37
Still learning how to code8-Feb-08 2:37 
GeneralRe: A very strange problem (to me at least) ..... Pin
CPallini8-Feb-08 2:50
mveCPallini8-Feb-08 2:50 
GeneralRe: A very strange problem (to me at least) ..... Pin
Still learning how to code8-Feb-08 3:23
Still learning how to code8-Feb-08 3:23 
QuestionRe: A very strange problem (to me at least) ..... Pin
David Crow8-Feb-08 2:49
David Crow8-Feb-08 2:49 
GeneralRe: A very strange problem (to me at least) ..... Pin
Still learning how to code8-Feb-08 5:19
Still learning how to code8-Feb-08 5:19 
Generalnon-const static member variale initialization Pin
George_George7-Feb-08 21:16
George_George7-Feb-08 21:16 
GeneralRe: non-const static member variale initialization Pin
Matthew Faithfull7-Feb-08 22:13
Matthew Faithfull7-Feb-08 22:13 
GeneralRe: non-const static member variale initialization Pin
George_George8-Feb-08 1:49
George_George8-Feb-08 1:49 

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.