|
Put the breakpoint in the line 871 of the file WINMDI.CPP located in vc98\mfc\src directory. The line contains this code:
return hMenuPop;
If your programs stops there, it means one of the following:
1) your menu has some ID_WINDOW_xxx id.
2) your ID_TEST ids have the same value as ID_WINDOW_xxx ones.
If breakpoints is not hit and you can see window list in your menu, something strange is going on...
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
The debugger doesn't even stop at the start of this function... It is never executed! And my ID-values are different I think I'm going crazy here
|
|
|
|
|
Did you override CMDIFrameWnd::OnUpdateFrameMenu or CMDIChildWnd::OnUpdateFrameMenu in your program? Or maybe you're explicitly calling CMDIFrameWnd::MDISetMenu?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Nope, non of these three... If you have a few seconds time, I have send you a VERY small test-case (created within a few minutes from scratch using the MFC wizard) by mail (If you're upset for this, I'm sorry, but I'm quite desperate)...
|
|
|
|
|
OK, that was easy. Your app doesn't use doc/view architecture. To disable window menu, override OnCreateClient in your CMainFrame class, and put the following code inside:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
return CreateClient(lpcs, NULL);
}
Just pass NULL as second parameter to CreateClient - this means that you don't want the Window menu.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Wow, Thanks !!!! I couldn't find this anywhere in the MSDN help files...
|
|
|
|
|
Can you please tell me how to hide/delete the window popup menu from the main menu if I am working with Doc/ View application? Thats really urgent, I am using the code like
CMenu *menuVault = this->GetMenu();
::DeleteMenu(menuVault->GetSafeHmenu(),9,MF_BYPOSITION);//9 is the position of Wondows menu
::DrawMenuBar(::AfxGetMainWnd()->m_hWnd);,
everything seems to be ok but menu bar is not getting refreshed or redrawn..... what could be worng????
Never complain,never explain,just do your work.
|
|
|
|
|
As a CTreeCtrl is expanded and contracted, the area covered by the tree varies. Anyone know how I can find / calculate the size of this area. I don't just want to know the area of the CTreeCtrl window, but the area covered by the actual tree. Anyone got any ideas please?
I'd like to modify some of the code on this site which is a drop down ctreectrl, but the drop down window is of fixed size. I'd like to make the drop down window vary in size according to the size of the actual tree.
|
|
|
|
|
Seems that you have to do this 'manually' - there's no single function.
1) call CTreeCtrl::GetFirstVisibleItem. The name says it all
2) in the loop, call CTreeCtrl::GetNextVisibleItem until it returns NULL. For each item, determine its rectangle using CTreeCtrl::GetItemRect. UnionRect will combine items' rectangles into one.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
OK, so I made myself an MFC Extention dll (this time I used MFC as shared library and all, everything looks ok), but I've still got some problems here...
I want to export a couple of classes from my extention DLL and things go wrong in de destructors.... For example, I tried the following code:
// --- This one goes OK ---
// CMyObject has a couple of members: strings, pointers and numbers
CMyObject * pNew = new CMyObject();
delete pNew;
// --- This one stinks ----
// CMyComplexObject has a couple of protected members, which are pointers to CMyObject instances
// CMyComplexObject creates the instances of the members in the constructor with 'new' and deletes them in
// the destructor with 'delete'.
CMyComplexObject * pNew = new CMyComplexObject(); // This goes correctly
delete pNew; // Application crashes on the delete of it's own members (the ones it made with 'new' in the constructor)!
Structured programming vs. chaotic mind boggling
|
|
|
|
|
What exactly the crash looks like? Are you getting an ASSERT? This again looks like two different heaps in your program.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
And you're right... I finally got the whole smash to work by creating a clean extention dll-project and more or less copying the project settings from one to the other...
There was another problem that caused the crash, though. I used two seperate .h files for my objects, one for usage in the client and one for the dll itsself. The class I was talking about had a slight difference in both .h-files, which probably caused the whole allocation/deallocation mechanism to mess up....
Anyway, I was able to fix it, thanks to your help! Thanks a lot ('cause I've been quite a pain-in-the-thingy). I've learned a thing or two, again!
Structured programming vs. chaotic mind boggling
|
|
|
|
|
i wanted to start using the vector class in the stl.... however, VC doesnt know what vector is. I tried including "vector" "vector.h" <vector> <vector.h> but it still doesnt know what a vector is- should i include any other headers?
|
|
|
|
|
By the way this is how im declaring my vector, and i am getting "undeclared identifier" errors...
std::vector<int> myvec;
|
|
|
|
|
Should be
#include <vector>
std::vector<something> vec;
|
|
|
|
|
#include <vector>
using namespace std
vector<int> myvec;
vector<char*> myvec2;
Hope this helps,
Michael
|
|
|
|
|
okay so maybe im being stupid now.... I tried
#include
using namespace std
I get compiler errors - #include always wants a filename not a newline or a std:: type thing.
I tried using std::vector and get error C2873: 'vector' : symbol cannot be used in a using-declaration
tried various combinations - is it possible im not including another headerfile i should - should there be any stl header files??? maybe im doing something really daft.
it just seems the stl could be really useful to learn, especially as it's portable between compilers (is this the case?)!
thanks in advance
|
|
|
|
|
Zip your code (please make it less than 100K) mail it to e-mail from my profile - I'll try to help you.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
|
Get STL from Hewlett Packard. It has better documentation, it is free, and You don't have to use namespaces.
Microsoft has implemented it's STL in STD namespace. For using namespaces, please consult msdn. To exactly locate classes/methods/etc, use browse - and if not available - FindInFiles.
|
|
|
|
|
Here is my code.... Ive tried various combinations of the statements below!
sorry, its just when I get one working I presume I will be able to use all the
templates in the STL.
--------------------
using namespace std
using std::vector
/* The above two seem to compile, but i get:
'vector' : undeclared identifier
I have also tried various combinations of the below ones.
I checked all the include directories and i dont have a vector
or vector.h file anywhere, should I need one... */
/*
Tried Errors....
#include std::vector vec // #include expected a filename, found 'identifier'
#include // #include expected a filename, found 'identifier'
#include [vector] // #include expected a filename, found '['
*/
Regards
Ben
|
|
|
|
|
I always use:
#include <vector>
the word 'vector' must be enclosed within pointed brackets (SHIFT , and SHIFT . ) on my keyboard.
Jeremy
|
|
|
|
|
BTW, this post highlights a problem with Code Project's message forum. It seems everything between open and close pointed brackets (including the brackets themselves) get removed when a message gets posted
So, what should be #include [vector] (substitute square brackets for pointed ones), looks like this: #include <vector>
|
|
|
|
|
That's because < and > characters have special meaning in HTML. You must use "character entity references" to enter any special characters: < for < and > for > So, to display
#include <vector> you need to type
#include <vector>
|
|
|
|
|
Here's a quick one, how do one reset the EOF flag for an open file (i am using ifstream), I've tried doing OR's with the flags to no avail. Help!
Cheers
|
|
|
|