|
I've created a structure that looks like this:
CMainForm
--CMainView : CView
----CTabCtrl
------CViewportFull : CViewport
------CViewportMulti : CFrameWnd
--------CSplitterWnd
----------CViewport : CView
----------CViewport : CView
----------CViewport : CView
----------CViewport : CView
When the program exits I get this error in my output:
Warning: Creating a pane with no CDocument.
Warning: Creating a pane with no CDocument.
Warning: Creating a pane with no CDocument.
Warning: Creating a pane with no CDocument.
Warning: Creating a pane with no CDocument.
Warning: Creating a pane with no CDocument.
Warning: Creating a pane with no CDocument.
Warning: Creating a pane with no CDocument.
Warning: Creating a pane with no CDocument.
Warning: Creating a pane with no CDocument.
HEAP[SDIDOCVIEW-nd.exe]: Invalid Address specified to RtlValidateHeap( 003B0000, 013EEFD8 )
Windows has triggered a breakpoint in SDIDOCVIEW-nd.exe.
This may be due to a corruption of the heap, and indicates a bug in SDIDOCVIEW-nd.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information
Why is this? I can post code if you tell me to :P
When i comment away the multi viewport control it doesn't crash...
-- modified at 12:56 Saturday 5th August, 2006
|
|
|
|
|
Maybe this code is important:
BOOL CMultiViewportWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CFrameWnd::OnCreateClient(lpcs, pContext);
VERIFY(m_splitterWnd.CreateStatic(this, 2, 2));
VERIFY(m_splitterWnd.CreateView(0, 0, RUNTIME_CLASS(CViewport), CSize(100, 100), pContext));
VERIFY(m_splitterWnd.CreateView(1, 0, RUNTIME_CLASS(CViewport), CSize(100, 100), pContext));
VERIFY(m_splitterWnd.CreateView(0, 1, RUNTIME_CLASS(CViewport), CSize(100, 100), pContext));
VERIFY(m_splitterWnd.CreateView(1, 1, RUNTIME_CLASS(CViewport), CSize(100, 100), pContext));
m_splitterCreated = true;
return TRUE;
}
|
|
|
|
|
You are trying in your code to create CView Windows! The way of creating a New View is use:
CDocTemplate::CreateNewFrame
virtual CFrameWnd* CreateNewFrame( CDocument* pDoc, CFrameWnd* pOther );
Goto Scribble to see how
The Document and the View are parts of a complicated suite of software which you got free with the compiler, it is called the MFC Framework, and you cannot in general change something in the middle, without affecting the whole.
Work with MFC, and follow its rules. This means in this case that you get things done in a view by making changes in the underlying document, and notify the view that things have changed. Just follow the scribble tutorial ( And DO SO, even if you have 10 years experience) to see how that's done!
Writing for MFC is not easy,things often must be done "the long way around", but there are benefits to be gained. If you follow the rules, an upgrade to the next window release, generally involves only recompilation. Also any advances in MFC will add functionality to your prrogram by no other means than your customers installing the Next service pack for their operating system.
The alternative is to roll your own! Derrive a Main Frame Class window from CMainFrame, and a Child Window from class CChildFrame, and paint your info by hand as required. Somethimes this is the right way to go! But, if you are trying to paint your own data in a View window, See Scribble
LateNightsInNewry
LateNightsInNewry
|
|
|
|
|
Hmm but that function won't let me specify what kind of view I want to create! I need to specify what view class I wan't to create since it's not the same as in the doctemplate.
|
|
|
|
|
Whilst strFileToRead holds a value of "c:/testfile.txt", the fstream object fileToRead is 'persisting' to read from another file which was previously passed as value to strFileToRead.
Is a way to explicitly clear memory of the previous value? Is this the problem?
void CSentenceAr::readFile(char strFileToRead[MAX_FILENAME_LENGTH])
{
char strLine[MAX_SENTENCE_LENGTH + 1];
fstream fileToRead(strFileToRead,ios::in);
while (!fileToRead.eof() && Size < MAX_LINES)
// Read line of text from file and update Sentences.strSentence.
{ fileToRead.getline(strLine, MAX_SENTENCE_LENGTH);
strcpy(Sentences.strSentence[Size], strLine);
Size++;
}
fileToRead.close();
}
Jon
|
|
|
|
|
I would set a breakpoint at the fileToRead definition, and check the value of strFileToRead on entry to your routine.
Software Zen: delete this;
|
|
|
|
|
It doesn't show any unexpected results.
Jon
|
|
|
|
|
Can I in some way add, let's say an CWnd derived class to a CPropertySheet as a page? What I want to do is to create a CSplitterWnd inside one of the pages.
|
|
|
|
|
I "solved" it with using a CTabCtrl and handle the messages myself. Not very practical though
|
|
|
|
|
Dear friends,
I've a simple MFC application that only consists of a main window. What my application does is that, it launches MS-Word and makes MS-Word window as a child window of my main window.
When the focus is in MS-Word Window, 'operating system' makes its parent window (i.e my main window) as inactive and turns is titlebar as grey. It is so because, though MS-Word window is a child window of my main window, it runs in a separate process.
My main window only becomes active when i click on it. Now the problem is that i want to programatically activate my main window when user is typing in MS-Word window and presses Ctrl+P. My application uses Key board hooking to detect Ctrl+P.
The question is that how do i activate my main window????
I first tried SetActiveWindow API, but it didn't work MSDN doc says abt this API that :
The SetActiveWindow function activates a window, but not if the application is in the background
Obviously my application is in background when focus is in MS word window, so may be thats why this API is not working.
I also tried SetWindowPos and SetForegroundWindow but no result.
Can you suggest me that how do i activate my main window and bring it in the foreground with input focus.
Imtiaz
|
|
|
|
|
I think we have to send some post/send message but i don't know what it is
regards
.GAN.
|
|
|
|
|
Do you need to m_ListCtrl.SetItemState(with LVIS_SELECTED);
|
|
|
|
|
Look at here[^]. I think you'll find what you need.
Marc.
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Hi to all,
In my program, I am only running a thread, that will open media file in read mode, read data from that file every sec & perform the operation on that every sec.
But when I run multiple instances (let 100 instances) of that thread to read same media file (i.e every sec I read same data in each instance of thread), it creates a problem. ( I think due to limitation of reading speed for Harddisk)
So, How I can read media file only once & get data available to thread instances for performing the operation on that data?
Plz , help me.
Thanks & Best Regards,
Aniket Salunkhe
|
|
|
|
|
i have a spellchecker and i want the following operation
when i choose some text my mouse (active selection od mouse )
what text have to check up with spellchecker text for that i feel
the selected text is copy and paste to text box of spellchecker and compare it
so plz suggest me the code
janan
|
|
|
|
|
The general solution to this is non-trivial (do a google on "screen readers" for more info). The reason is that the 3 major browsers all have different object models, so getting text from a browser window, or form, is quite difficult. Getting text from a "standard" windows app is not that difficult, but then you also have to consider .Net apps, whose on-screen elements are not based on standard HWNDs.
So for standard apps:
1. find the window, using something like WindowFromPoint()
2. determine type of window, using GetClassName()
3. use (2) and GetWindowText() to try to get the selected text
|
|
|
|
|
Hello.
I am creating an aplicaion in which I want some of the controls from TOOL BAR to be disabled by default. And I want them to be enabled when user takes some specific action.
How can I make the tool bar controls GRAYED or disabled by default?
Thanks and Regards
Rakesh
|
|
|
|
|
If u want to enable or disable the button from toolbar then use EnableButton().
e.g
CToolBar m_wndToolBar;
...
..
..
CToolBarCtrl& tbctrl = m_wndToolBar.GetToolBarCtrl ();
if(..)
tbctrl.EnableButton (ID_FILE_NEW,TRUE); // to enable
else
tbctrl.EnableButton (ID_FILE_NEW,FALSE); // to disable
Regards
Amar
|
|
|
|
|
See here if its good for you
<br />
m_wndToolBar.GetToolBarCtrl().SetState(ID_FILE_NEW,TBSTATE_ENABLED);<br />
m_wndToolBar.GetToolBarCtrl().EnableButton(ID_FILE_NEW,FALSE);<br />
|
|
|
|
|
Hi all,
In an SDI APP i am using a modeless dlg. I am creating the dlg in view class.
In view class im using a LinkList .
Now the Problem is i need to access the LinkList from the dlg . while Accessing the LinkList fn(append, del,...) I got an run time access violation
and then the application terminates.
How to resolve this problem.
any body knows...
by
GAN.
|
|
|
|
|
Try passing a pointer of your application to the dialog.
In the dialog you can create a pointer of your parent class and access the variables/member functions of the parent class with the help of that pointer.
You can do this:
in the dialog declare a pointer of view in the header file
CMyParentView *pView;
Now when you are creating the dialog
CMydialog* pMyDlg=new CMyDialog();
pMyDlg->pView=this;
pMyDlg->DoModal(); // Or in whatever manner you are creating the dialog.
In the dialog you can then access the member variables of the view like
pView->myLinkedList.///////Somecode or function here
Try this.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thank you for suggession
when including view.h in dlg.h it got some error
so i shifted mylinklist to doc class
now it workes well
thank u once again for ur reply
|
|
|
|
|
|
Assume that each line of file have data as
aaaaa,bbbbb,ccccc,ddddd,eeeee,............
if want to keep the data of each part to variable such as
str1=aaaaa;
str2=bbbbb;
.......
What is the function or class that support this issue.
If not,Please give me a concept for write it.
Thanks
|
|
|
|
|
Read the data into a CString variable and then tokenize the string using
CString::Tokenize() using "," that seperates the values from each other.
Store each string in different one
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|