|
Is Easy.
CStdioFile fileEditText;
if(fileEditText.Open((LPCTSTR)("c:\\text.txt", CFile::modeCreate | CFile::modeWrite))
{
strFirstline += '\n';
fileEditText.WriteString(strFirstline);
strSecondline += '\n';
fileEditText.WriteString(strSecondline);
strThird += '\n';
fileEditText.WriteString(strThird);
fileEditText.Flush();
fileEditText.Close();
}
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
Thanks!!!
|
|
|
|
|
Can anyone tell me how to remove the standard MDI window list in a CMDIFrameWnd ???
|
|
|
|
|
Ensure that your menu has none of the following items:
ID_WINDOW_NEW
ID_WINDOW_ARRANGE
ID_WINDOW_CASCADE
ID_WINDOW_TILE_HORZ
ID_WINDOW_TILE_VERT
ID_WINDOW_SPLIT
MFC searches through your menu (in CMDIChildWnd::OnUpdateFrameMenu) and uses the rightmost popup containing one of these items as Window menu - the one that gets the window list.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I don't even have a Window menu... MFC places it on the bottom of my second-last menu... Even if this menu's name is "Test" for example... and my menu items names "Test1", "Test2", ... The Window list is put always on the bottom of them...
|
|
|
|
|
Do you understand the difference between menu item name and menu item ID? Changing the names will not help. If you have menu containing items with identifiers like ID_WINDOW_xxx, the window list will be appended. You have to change menu item identifiers.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I do! I don't have a menu which has an ID that starts with ID_WINDOW_ ... As a matter of fact, MFC puts the window list on the "Test" menu's bottom... Which has the ID's: ID_TEST_TEST1 and ID_TEST_TEST2. My Child windows are created through the CMDIChildWnd class' Create method...
CSettingsDlg m_settDlg; // Derived from CMDIChildWnd
m_settDlg.Create(AfxRegisterWndClass(0, 0, (HBRUSH)COLOR_WINDOW), title, WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU, r);
m_settDlg.ShowWindow(SW_SHOW);
|
|
|
|
|
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
|
|
|
|