|
I run it in debug mode.I have written a function in my class CMyDoc::CDocument and I call it without any problem
but when I call SetModifiedFlagfunction , an exception raises. I think this problem relates to the way I call these functions.I defined a global pointer to CMyDoc and initialized it with the GetDocument function in the
CMyView::CView .So I use this global pointer to call CMyDoc functions.Of course I call these functions in another
class CMyTreeCtrl::CTreeCtrl.
|
|
|
|
|
Well the first thing I'd do is get rid of the global and all other globals. You are just asking for trouble using globals. Presumeably you know the view or can find it and then use it's GetDocument() function.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Even I used CFrameWnd::GetActiveDocument() to get pointer to the document , but it wasn't useful and the same error is repeated.
|
|
|
|
|
Azadeh wrote:
Even I used CFrameWnd::GetActiveDocument() to get pointer to the document , but it wasn't useful and the same error is repeated.
Are you checking that CFrameWnd::GetActiveDocument() isn't returning NULL?
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Yes , you had right , it was NULL .But what can I do ? I don't know how to access to active document.My code is
as follows:
void MyTreeCtrl::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
{
HTREEITEM hItem = GetSelectedItem ( ) ;
Symbol* item;
CRect rectSave1;
CMyDoc* doc;
CMDIFrameWnd f;
doc=(CMyDoc*)f.GetActiveDocument();
if(doc!=NULL)
{
if ((item=doc->Find(hItem))!=NULL)
{
CRectTracker rectTracker=item->tracker;
doc->ChangeTrackerStyle(rectTracker);
doc->SetModifiedFlag();
rectTracker.GetTrueRect(rectSave1);
doc->UpdateAllViews(NULL, (LPARAM)(LPCRECT)rectSave1);
doc->UpdateAllViews(NULL);
}
}
*pResult = 0;
}
I work with an MDI application.
|
|
|
|
|
Azadeh wrote:
CMDIFrameWnd f;
doc=(CMyDoc*)f.GetActiveDocument();
It would be a good idea to actually assign the MDIFrameWnd to f don't you think.
Also don't use old C Style casts. In this case you should be using dynamic_cast<cmydoc*>( ... ).
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Thank you and my problem is solved by adding the following lines to my code which I found in MSDN:
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
// Get the active MDI child window.
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
// or CMDIChildWnd *pChild = pFrame->MDIGetActive();
// Get the active view attached to the active MDI child
// window.
CMyDoc *pDoc = (CMyDoc *) pChild->GetActiveDocument();
You're right,using C style casts isn't good ,but I don't know exactly where I can use dynamic_cast and static_cast
operators.Once I wanted to type cast a pointer to a base class to a pointer to one of its derived class with these
operators but I wan't successful.
Base b; // suppose base class has a pointer to Base named link
Derived* d;
b.link=new Derived;
First of all ,can I use b.link as a pointer to Derived and use fields of Derived?
|
|
|
|
|
Hello,
I'm using a Tab Control in my dialog-based application.
I've used:
(1). CTabCtrl - For creating a tab control with 3 tabs
(2). CPropertyPage - For the 3 dialogs that I would like to be displayed on the 3 tabs respectively. My dialogs are modeless, and are created along with the main dialog. To be more clearer, each tab of the tab control is attached to one dialog which is a CPropertyPage .
(3). I am using all type of controls on the 3 PropertyPages.
My problem:
(1). Even after properly Tab-Indexing the dialogs, the TAB key does not function within the controls on the PropertyPages. So for eg., if I have 3 edit boxes on the first PropertyPage, by hitting the TAB key on the first one, the cursor does not move to the next control as per the tab-index. It stays in the same control, the first edit box.
If anybody's encountered such a problem, please send me a solution for this.
Thanks a lot in advance...
Bye,
Good Luck,
Nirav
|
|
|
|
|
look at CPropertySheet
with CPropertySheet you can add pages (CPropertyPage) this is the orthodox way to have a 'tabbed' dialog.
|
|
|
|
|
Norm, Thanks for your reply!
True, CPropertySheet will help better, but for the application is an old code - 1999-2000. Will require quite a number of changes to implement with CPropertySheet .
Current problem needs to be attended on priority.
Have you seen/faced such a TAB key navigation problem for CPropertyPage used tabbed dialog?
Thanks,
Rgds,
Nirav
|
|
|
|
|
I'm not sure about that...
but I use to include Property sheets inside my dialogs and the only way to make them react in the right way to the TAB key is to select in the More Styles tab of the properties of each dialog the CONTROL style.
After having done this you must select too the CONTROL PARENT in the extended styles of each dialog.
I'm answering this without being at work and trying to remember how I did this...
Hope to help...
Regards
|
|
|
|
|
When i try to use the RenderFile function on an IGraphBuilder i get a ton of errors. I've also tried downloading a sample file that is guaranteed to work, but i still get the errors. Here's the code from the sample:
#include <windows.h>
#include <objbase.h>
#include <dShow.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HRESULT hr;
IGraphBuilder* pGraphBuilder;
IMediaControl* pMediaControl;
WCHAR MediaFile[MAX_PATH];
CoInitialize(NULL);
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_ALL, IID_IGraphBuilder, (void**)&pGraphBuilder);
if (FAILED(hr))
return -1;
MultiByteToWideChar(CP_ACP, 0, lpCmdLine, -1, MediaFile, MAX_PATH);
hr = pGraphBuilder->RenderFile(MediaFile, NULL);
if (FAILED(hr))
return -2;
hr = pGraphBuilder->QueryInterface(IID_IMediaControl, (void**)&pMediaControl);
if (FAILED(hr))
return -3;
hr = pMediaControl->Run();
if (FAILED(hr))
return -4;
Sleep(10000);
pMediaControl->Stop();
pMediaControl->Release();
pGraphBuilder->Release();
CoUninitialize();
return 0;
}
I set up VS .NET so the commandline contains a valid media file. When it performs the RenderFile function it loads in a sec or so and comes with a bunch of erros like these:
ASSERT failed.
g_cFGObjects == 0
At line 6002 d:\xpclient\multimedia\dshow\filters\core\filgraph\filgraph\filgraph.cpp
Continue? (Cancel to debug)
ASSERT failed.
Executable: DShowTut1.exe Pid 720 Tid 2cc. Module quartz.dll, 26 objects left active!
At line 317 of d:\xpclient\multimedia\published\dxmdev\dshowdev\base\dllentry.cpp
Continue? (Cancel to debug)
sometimes it also pops up with additional erros like:
m_dwRecursionCount == 0 && m_dwOwnerThreadId == 0
At line 58 of d:\xpclient\multimedia\dshow\filters\core\filgraph\filgraph\msgmutex.cpp
Continue? (Cancel to Debug)
And then exits. Anyone know what could be wrong?
Thanks all!
-Rune Svendsen
|
|
|
|
|
hi,
how and where to connect the .rtf files ? i am desparate.can anyone help?
neither the msdn nor the help workshop help is answering me.
jack lowe
|
|
|
|
|
I am not that familiar with the old microsoft help file system, I only used it once, and that was about 8 years ago.
With that said, I would suggest that you download the HTML Help workshop [^]from microsoft and create the new HTML style help. Basically all of your help files will be HTML, Javascript, VBScript and you can even add activeX controls depending on how sophisitcated your want your help to be. Plus the HTML help scales really nicely to the web if you want to make your help files available on the web later.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
yah,
how.are they by any chance not for vcpp6?
|
|
|
|
|
.sln and .vcproj are just for vc++.net (vc7)
the equivalent vc6 files are .dsw and .dsp: if you load a .dsw/.dsp pair into the vc7 ide, it's automatically converted into a .sln/.vcproj
hope this helps
best regards
|
|
|
|
|
If you're trying to load a VC7 project into VC6, you will be unable to do so. You'll have to convert VC7 project into VC6 format, which can be easily done using This Tool[^] written by the controversial .S.Rod.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
i have made myself up between the controversial point of view and the collective blindness. the tool you refer to is a good example of what you MS supporters are actually leading to. you don't have to mind, though.
|
|
|
|
|
I wasn't trying to insult you by saying you were "controversial". I respect your work as an author, and your tool is quite nice.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
hi,
i am developing a sw on win2000 using vcpp6.for it to be ,
portable across win 95/98/me and nt(not so keen) what should i do?
i mean,generally,if i compile it on 95 ,it wont run on 2000 at all.so should i build it on 2000?
specifically,the CEdit::GetLine() doesnot seem to put the null char at the end of the array in 95/98.this results in something like this which makes it impossible to parse the line.
if the lines are
comments
[tag]
123
234
345
[tag]
the array is read as follows
comments
[tag]ents
123g]ents
.
.
.
why?how to solve this?
any help is appeciated.
Ian
|
|
|
|
|
It's not a cross-OS issue. From the remarks to CEdit::GetLine[^]: "Call this function to retrieve a line of text from an edit control and places it in lpszBuffer. The copied line does not contain a null-termination character. For more information, see EM_GETLINE in the Win32 documentation."
So, I'd use a combination of CEdit::GetLine() and CEdit::LineLength()[^] to parse your input.
|
|
|
|
|
Other remarks: WinNT / 2k / XP support ANSI versions of the runtime libraries that support MFC, but you're better off doing native Unicode if you target WinNT or higher, so using the TCHAR macros (LPTSTR, LPCTSTR, TCHAR, and _T) are a good idea. See Unicode Programming Tasks[^] for doing unicode.
|
|
|
|
|
one theoretical question:
how does IIS works, in regards to processes and threads?
when a HTTP request comes in, IIS process inetinfo.exe will launch a thread to parse an ASP file (ie. the newly spawn thread will feed an ASP page to the script engine)
say there're 100 concurrent requests, InetInfo.exe will spin up 100 threads, each will load and feed a page to the script engine.
Is this correct?
And since it's "threads" as opposed to "processes", if these threads crash, it will bring down the entire server? prolly not? i read something about process and fault isolation.
tell me what i'm missing here. since i need to understand how an "ASP application" loads and instantiate my COM server...(i interpret an ASP application as a thread that parse an ASP script).
btw, it's a MTA(both) + inprocess dll server
norm
|
|
|
|
|
To quote an MSDN article:
"IIS uses an I/O thread pool to process all incoming requests. Requests for static files (.htm, .jpg, etc.) are satisfied immediately, while requests for dynamic content are dispatched to the appropriate ISAPI extension DLL. The Active Server Pages extension uses a worker thread pool to execute ASP pages. Because ASP is COM-based, all sorts of components end up executing in our process. This is a mixed blessing. It's wonderful for developers, because it allows easy reuse of components, makes ASP marvelously flexible, and has made ASP and IIS a big success. However, this flexibility has caused us performance problems. Many of these components were written for the desktop, and many of the components created specifically for ASP were written by people who don't fully understand what it takes to write a high-performance server component.
The same is often true for ISAPI extensions and filters; the components interact badly with other components and they interact badly with different instances of themselves.
All of the following apply to IIS; most of them apply to other kinds of server applications too."
See Server Performance and Scalability Killers[^]
With IIS, you can set up your ASP application to run in various "modes" of safety. Usually, I opt to run applications isolated, which means IIS launches the ASP app in it's own process so you won't kill the server if things go amok.
The article link above should give you a good start, as well as this one: Agility in Server Components[^]
|
|
|
|
|
hi
i want to change the looks of frame window i.e having a frame window tht looks diff fom the normal stuff ,say color diff frm the gray ifault color, sort of a new skin.
any one knws how can i do it in VC++,whch mssg to handle etc
THnx for any help:;)
bye
|
|
|
|