|
You should set the caption text of the frame instead of setting the documents title.
GetParent()->SetWindowText("First View");
It's not rocket surgery!
Within you lies the power for good, use it!!!
|
|
|
|
|
er..
How do I use that code?
I've tried replacing it with the old one but the title bar stays the same as the original.
|
|
|
|
|
Aint wrote: How do I use that code?
Why you cant use of it?
|
|
|
|
|
Ive tried but it didnt work.
Do I need to put something extra other than that line?
|
|
|
|
|
Hi,
this is because you have maybe used my answer about the child window (if not, more or less the same that I had). The fact is that you are opening more views from the same document, and the MFC puts automatically the ":1", ":2"... to differenciate them. You can avoid it by overriding CChildFrame::OnPreCreateWindow (CREATESTRUCT& cs) If you re-read (or read for first time :P) the answers I wrote you in your message about the Child Window... You will find a line in the code with pDoc->m_szNewFrame there is where I save the string of the new title to the new window, and the new frame takes the title from that string.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
hi.
Ive tried but I have an error for this part: CMDIChildWnd* pMDIActive = MDIGetActive();
'MDIGetActive' : undeclared identifier.
Is there any header that I need to include?
|
|
|
|
|
It is supposed to work without problems. Are you including the "stdafx.h"?
Did you use the assistant to create the project? or did u implement all by yourself?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hi,
I tried to reproduce your issue. I used MDI, two CFormView Derived class and added to doc template and in its OnInitialUpdate I set GetDocument()->SetTitle("First View") and second view. But I can't reproduce issue ,even i didn't get suffix index 1,2....
In MDI each view has its own document instance right. Would I like to know your setup, did you add multiple views to same doc, and where did you used pDoc->SetTitle();
Best Regards
|
|
|
|
|
yes. multiple views to the same doc.
used pDoc->SetTitle() at OnInitialUpdate() of both views.
thanks.
|
|
|
|
|
Hi,
I reproduced your issue, you are setting the text for the same document instance by pDoc->SetTitle(), this will affect the same string object.
Hence the last string you updated "SECONDVIEW" is the only document title, this is updated to all the views hence the FIRSTVIEW is changed to SECONDVIEW:1;
The frame title of the views are updated by CFrameWnd/CMDIChildWnd::OnUpdateFrameTitle()
we have advanced override for it.
override your frame windows OnUpdateFrameTitle() and do the following
this will set the frame title and overrides the default behaviour.
<br />
CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)<br />
{<br />
CString szTitle = m_strTitle;
<br />
if (m_nWindow > 0)
{<br />
szTitle.AppendFormat(_T("%d"), m_nWindow);<br />
}<br />
<br />
SetWindowText(szTitle);
}<br />
then on your view's OnInitialUpdate() do the following
<br />
GetParentFrame()->SetTitle(_T("SECONDVIEW"));
this will set the views frame title which we use at the OnUpdateFrameTitle override
rather than
<br />
pDoc->SetTitle(_T("SECONDVIEW"));
this works verified
Best Regards
May be the same thing will be done by another way.
-- modified at 5:50 Friday 1st June, 2007
|
|
|
|
|
Hey Rajkumar_R,
Thanks for reproducing my issue. Your method works.
To Nelek,
Thanks to you too.
|
|
|
|
|
Hi another time... I'm not going to copy the whole code another time, so open (in a new window) this link:
http://www.codeproject.com/script/comments/forums.asp?msg=2029429&forumid=1647&ForumID=1647&XtraIDs=1647&author=Nelek&sd=21%20Feb%202007&ed=22%20May%202007&stype=1&Page=3#xx2029429xx[^]
Now the explanations about every socket of code.
First: Declare the pDocTemplate.
I used it to have a different Menu to the new Views added, and to have the possibility to use the implementation of MFC about the views of the Document (GetFirstViewPosition and so on). I think this is clear, isn't it?
Second: CreateOrActivateNewFrame
These function has to be implemented in CMainFrm.cpp (and declared in the CMainFrm.h of course). What it makes is to look for kinds of the pDocTemplate that I give as first parameter and check out the second parameter (the name of the element of my project that owns the view) to know if a new frame has to be created or is already created and only need to set it active on the front.
Third: PreCreateWindow
This function is a MFC message already implemented in CChildFrm if you used the assistant... If not... no problem, make it by yourself is a standard MFC message. In this function what I make is to check if it is the MAIN (CScrollView) view or one secondary view (If the document doesn't exist and the m_szNewFrame has nothing in it... is the main one, otherwise a secondary). If it is the main, I leave the default configuration. If it is a secondary (CFormView) I check which of the three different types is, modify the size of the frame and FOR ALL secondary... I set the title of the new frame with cs.lpszName = pDoc->m_szNewFrameName; AND NOT using pDoc->SetTitle () (this only works for the main frame and all the descendents at the same time, not for a independant secondary frame).
Fourth: Using it
In my project I have 3 type of objects visibles in the view. When I make a double click I check if the click was in one of the already placed elements. If there is a match... then I take the name of the element, set the pDoc->m_szNewFrameName string with the element's name and some other things I want to have in the caption of the new window and use the function of the CMainFrame to CREATEorACTIVATE the new view passing the DocTemplate that I want for this specific element and the name of the element (who is going to have the intern ownership).
Fifth: Extras...
This was not written in the other message, but when I open the new CFormView I override the OnInitialUpdate to INMEDIATELY erase the content of pDoc->m_szNewFrameName string. This is to avoid conflicts and to be sure that the main window will have no problems if I choose to open a new document (that is a new CScrollView and all the necessary CFormViews). If you dont do it... then the new MainFrame will be limited to the values of the last CREATESTRUCT that you used...
I hope this time you have understood my explanation... and it works for you as well as for me.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hi all,
I have a difficulty in finding difference between two 12 digit number.
my problem is this
9999 9999 9999 - 1111 1111 1111 = 8888 8888 8888.
I wish to do this operation. But i couldnt able to store these two 12 digit numbers as a integer. can anyone please suggest me some ideas?
Thanks in advance.
Regards,
Ram
|
|
|
|
|
use __int64.
__int64 nNum1 = 999999999999;
__int64 nNum2 = 111111111111;
__int64 nResult = nNum1 - nNum2;
nave
|
|
|
|
|
How can i convert sring to _int64? because my "9999 9999 9999" and "1111 1111 1111" is a string. I need to convert these string values to _int64 and do the subtraction. after do the operation, i need to convert the result from _int64 to string. is there any way to do it?
Thanks a lot.
Regards,
Ram
|
|
|
|
|
Ram Murali wrote: How can i convert sring to _int64?
use _atoi64() to convert string to _int64 type.
and after convertion use _i64toa() to convert it back to string.
nave
|
|
|
|
|
Thanks for your information. I found the function to convert the string value to the _int64.
CString str = "999999999999";
_int64 val = _atoi64(str);
Thanks again.
Regards,
Ram
|
|
|
|
|
Hi,
GetMediaType and DecideBufferSize require to know the image width and height from the get go. Is it possible to set the buffer size and stuff after we have started the directshow graph or does all the buffer values need to be known before we begin running the filters.
Thanks
|
|
|
|
|
godspeed123 wrote: Is it possible to set the buffer size and stuff after we have started the directshow graph
See Dynamic Format Changes in DirectShow[^]
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have got a list view control with the LVS_ICON style. The icons that I use are 64px by 64px. They work fine and are displayed correctly, however, if one of the items is selected, then a blue semi-transparent selection rectangle covers the image. How would I get rid of this, or make it so that the blue selection rectangle only covers the white area of the icon image?
I'm writing in plain C/C++, so no MFC
Thanks for your help!
--PerspX
|
|
|
|
|
if you set the LVS_EX_BORDERSELECT extended style, you can make only the border of the items highlighted instead of the whole item during seelction.
nave
|
|
|
|
|
I create a SDI appication and split the main frame to rows and columns using CreatStatic()and CreateView() for each of the splitter frame. It works fine. In One of the pane frame, I display the graphic rectangle and text using FillSolidRect(), and DrawText(), and these rectangles and text need to redraw every time to update system status. To do that, I call InvalidateRect(NULL,FALSE) in OnDraw() to redraw this window frame. It is working fine also. But some how by calling InvalidateRect(NULL,FALSE) all of my modal dialogs in my application doesn't work any longer causing my application to hang ( no response from any buttons in toolsbar). If I commented InvalidateRect(NULL,FALSE) all of my modal dialogs work but then the graphic rectangles and text no longer redraw and update. Help!!!!
|
|
|
|
|
As before i have problem when i try to exam a string that i had took it from a file
The problem (via debug) i detected it was that it doesnt get the last letter of this string
the LineRead (buffer) is correct contains all the letters but when i do LineRead.GetAt(LineRead.GetLength() - 1) it return me nothing
As a result when i create .exe and run it throw me windows error (and when i try to detect the problem ) it throw me an exception
my workspace[^]
input text file[^](you select it via Select bottun)
|
|
|
|
|
Immunity18 wrote: the LineRead (buffer) is correct contains all the letters...
How are you verifying this?
For future reference, you do not need to include PCH, NCB, TXT, OPT, APS, CLW, or PLG files when archiving a project. Those files, as well as the Debug and Release folders, get rebuilt.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
By the way you teach me DEbug and see the values on each variable
|
|
|
|