Hi, I am experiencing some strange problems. I am getting a whole bunch of access violations when I run my program. The program doesn't crash but in the debug window you can see about 200 access violation messages. I tracked this down to CMainFrame::OnCreate(). Infact, all of these access violations occur at the point where the CToolBar's CreateEx function get called. Here is what App Wizard created for my project for the CToolBar, if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } The Toolbar get created, but with a whole bunch of access violations along the way. Another thing, this doesn't happen all the time. I would guess three out of five times I run the program, I get all of these access violations. Anyway, I hope someone know why this is happening. I would really appreciate the help. Just in case someone was interested, here is a look at what the violation message looks like First-chance exception in Plas.exe (GDI32.DLL): 0xC0000005: Access Violation. Thanks
User 4315
Posts
-
access violations -
STLHi, I am trying to use the map data structure of the STL. When I declare the map, map var , I get all sorts of warnings (something like 92 of them) saying that some names are longer than 255 characters. Can someone please tell me how do get rid of these warnings? For your information, here is a few of those warnings: d:\vc98\include\utility(21) : warning C4786: 'std::reverse_bidirectional_iterator,std::map,std::allocator >::_Kfn,std::less,std::allocator >::iterator,std::pair,std::pair &,std::pair *,int>' : identifier was truncated to '255' characters in the debug information d:\vc98\include\utility(21) : warning C4786: 'std::reverse_bidirectional_iterator,std::map,std::allocator >::_Kfn,std::less,std::allocator >::const_iterator,std::pair,std::pair const &,std::pair const *,int>' : identifier was truncated to '255' characters in the debug information d:\vc98\include\utility(21) : warning C4786: 'std::pair,std::map,std::allocator >::_Kfn,std::less,std::allocator >::iterator,std::_Tree,std: :map,std::allocator >::_Kfn,std::less,std::allocator >::iterator>' : identifier was truncated to '255' characters in the debug information d:\vc98\include\utility(21) : warning C4786: 'std::pair,std::map,std::allocator >::_Kfn,std::less,std::allocator >::const_iterator,std::_Tree,std::map,std::allocator >::_Kfn,std::less,std::allocator >::const_iterator>' : identifier was truncated to '255' characters in the debug information Draggable.cpp DrawUndo.cpp
-
PreTranslateMessage(MSG* pMsg)Thanks alot mike.
-
PreTranslateMessage(MSG* pMsg)Hi, I have a tree control that fills the entire client area of a dialog box. I want to catch the left mouse button being pressed in the tree. The problem is, I can't catch WM_LBUTTONDOWN because the tree fills the whole dialog. So, when the user presses the left mouse button he is not pressing it in the dialog, he is pressing it in the tree. As a result, I am trying to make use of PreTranslateMessage. What I was wondering was how do I detect when the the user has pressed the left mouse button while holding down the shift key in PreTranslateMessage(MSG* pMsg)? Also, is there an easier way to do this? Thanks Mike
-
PreTranslateMessage(MSG* pMsg)Hi, I have a tree control that fills the entire client area of a dialog box. I want to catch the left mouse button being pressed in the tree. The problem is, I can't catch WM_LBUTTONDOWN because the tree fills the whole dialog. dialog. So, I am trying to make use of PreTranslateMessage. What I was wondering was how do I detect when the the user has pressed the left mouse button while holding down the shift key in PreTranslateMessage(MSG* pMsg)? Also, is there an easier way to do this? Thanks Mike
-
Beginner needs help with sorting objects in a CTypedPtrArrayHi, This won't answer your question but why don't you just use the STL. The STL has some very efficient sorting algorithms that I think you will find useful. If you don't know STL, I think you can get up to speed in just a few hours. If I had to do anything like this I would prefer the STL over the MFC collections. sayed
-
STLHi Uwe, I think I can use erase() to delete a single element. I know there had to be an easier way, thanks allot.
-
STLHi, I have a vector object that has some elements in it and I want to remove an item completly from the vector. Here is what I mean, vector inV; for (i=0; i<10; i++) inV.push_back(i); I would like to call a function that will remove one of the items and leave me with 9 elements in the vector. I tried using remove(...), but that doesn't do what I want. If I use remove, I have to copy the valid elements from one vector to another and I don't really want to do that each time I have to delete an element. If this is possible please let me know. Thank in advance
-
STLHi, I have a vector object that has some elements in it and I want to remove an item completly from the vector. Here is what I mean, vector inV; for (i=0; i<10; i++) inV.push_back(i); I would like to call a function that will remove one of the items and leave me with 9 elements in the vector. I tried using remove(...), but that doesn't do what I want. If I use remove, I have to copy the valid elements from one vector to another and I don't really want to do that just each time I have to delete an element. If this is possible please let me know. Thank in advance
-
OnLButtonDownWell, you catch onLButtonDown. Do you stuff there until to get the onLButtonUp. If you tell us, what the process is that would help alot. I know what I am telling you here is primitive, but, you have to tell us a bit more. sayed hashimi
-
how to get the message when the user clicked the uparrow?Actually all you have to do is catch the WM_KEYUP event. Just go to classWizard, select the class you like to handle the event, and then choose WM_KEYUP from the message entries. Then, choose add function, and finally choose edit code. Then try AfxMessageBox(" up pressed"), and that will tell you if you were able to catch it or not. It worked for me, so I am sure it will for you. I tried the suggestion of adding the ID to the accelerator table but that didn't work. If you got it to work, I would be interested in how you did it. sayed hashimi
-
(Hopefully) a simple question on classes and inheritance.Hi, If all the other classes use the one class, just #include that file in stdafx.h. That way it will be available to all the other classes. What you have here is called 'circular reference', where one header file gets included more than once. As the replies suggests, you can prevent this multiple inclusion by using #ifndef .... #define.....or use a 'forward declaration' in the header file by writing 'class CEditString'. Forward declarations, however, are only allowed for pointer members. That is, you can say CEditString* stPtr and not CEditString obj. What I usually do when I have a problem like this is draw a diagram showing what files have included what, and then I can figure out a way not to include a file more than once. If this doesn't help you then send me your whole project (syh@ufl.edu) and I'll be glad to look at it for you. I know how frustrating this can be. Good luck. sayed hashimi (another overworked graduate student).
-
Exception handlingI am getting set to start a new project and was wondering if some of you guys could give me some ideas on the best method to handle exceptions. Should I go with CException or something else? Any idea is appreciated. Thanks for your time. glguru
-
undo operationHi, I was wondering if anyone had an idea of how to implement a global undo feature. Something like what microsoft offers with all of their applications. I have an application that does some undoing, but I would like to convert this to handle any operation. Any suggestion is appreciated...