|
|
Hi,
I used of SetWindowText in WM_ACTIVATE and WM_CREATE messages ... but don't work !!!
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
If SetWindowText doesn't work for you, you'll need to override CFrameWnd::OnUpdateFrameTitle.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi All,
I have Overridden the CwinApp::Run function in my code and I have called
some of the functions which does my desired work.There is no problem with
these functions as they execute properly. But when the control tries come
out of the CwinApp::Run function it enters the MFC code and crashes there.
The main problem is in the File "WinHand.cpp" (Within Visual Studio). In
that file the following function gives the problem.
void CHandleMap::DeleteTemp()
{
if (this == NULL)
return;
POSITION pos = m_temporaryMap.GetStartPosition();
while (pos != NULL)
{
HANDLE h; // just used for asserts
CObject* pTemp;
m_temporaryMap.GetNextAssoc(pos, (LPVOID&)h, (void*&)pTemp);
// zero out the handles
ASSERT(m_nHandles == 1 || m_nHandles == 2);
HANDLE* ph = (HANDLE*)((BYTE*)pTemp + m_nOffset); // after CObject
ASSERT(ph[0] == h || ph[0] == NULL);
ph[0] = NULL;
if (m_nHandles == 2)
{
ASSERT(ph[1] == h || ph[1] == NULL);
ph[1] = NULL;
}
delete pTemp; // virtual destructor does the right thing
}
m_temporaryMap.RemoveAll(); // free up dictionary links etc
}
In the above function there is a line which says ASSERT(ph[0] == h || ph[0]
== NULL);
It is crashing at this particular. I am not able to understand why exactly
it is giving this problem.
Does anyone have any idea about the problem. Any help is hugely appreciated.
TIA
Srinidhi.
|
|
|
|
|
|
Hi,
Thanks for your response. Here I have pasted the code. m_pMagicControl is my main UI class which puts up a complex UI.
int CMAGICOPTApp::Run()
{
// TODO: Add your specialized code here and/or call the base class
if (theApp.m_pMagicControl->Open())
{
theApp.m_pMagicControl->ShowUI(TRUE, theApp.GetMainWnd());
}
return CWinApp::Run();
}
Could you smell something??
TIA
srinidhi
|
|
|
|
|
Could you smell something??
Not exactly. I think you should ensure that it's a 'magic control' that causes the crash. What happens when you comment out the ShowUI call?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
HI,
Thanks for your interest, I traced the problem for sometime. So this is the result I got from it.
Now, I dont override CWinApp::Run(). I moved all the UI initialization to InitInstance (). Now, the application gets initialized properly, but it crashes inside CMenu::DeleteTempMap().
Do you why this happend?
TIA
Regards
Srinidhi
|
|
|
|
|
hi all,
can anyone tell any command should be used for setting sampling rate for recording?
regards,
jim
|
|
|
|
|
I would like to know if someone could answer me to simple problem: We suppose that we create a class MyClass where there are methods(method1(), method2()...) where one have to use another method of MyClass. For example, suppose that method1 need of method2 in its implementation, how could i do that?
thanks in advance
gerald
|
|
|
|
|
I don't understand ? You want to call method1() from inside method2() ? What's the problem ? Just do it.
If you mean from another instance of the class, make the method static and you'll only have one instance of the method across all classes.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Not sure what you are after, perhaps you are talking about 2 objects, & passing one object into the other & calling a method.
Please Expand.
Gerry.
|
|
|
|
|
Y'know, if you answered the guy who asked the question instead of me, he'd get an email alert that you were offering to help him. That would probably be a good thing.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Sorry about that, clicked on the wrong button.
Gerry.
|
|
|
|
|
So could i do that:
double MyClass::method1()
{....}
double MyClass::method2()
{.
.
.
double m=method1();
.
}
gerald
|
|
|
|
|
Yes, you can do that....You need to decide if the methods are public or private!
Gerry.
|
|
|
|
|
|
Absolutely.
You could also go
return method1();
at the end of method2 if you wanted to. It's completely available to you.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
|
This Visual C++ is rather strange to me and I like to know about pointers... I´ve been working with Visual C++ only a two months and now this hole thing is just banging the head in the wall... So how these pointers are used? Meaning that where you construct the pointers and when you use them?
There were before a question, where somebody disclaim a working with directories etc. And there is pointer
pListoBox-> How you generate this kind of pointer in the code? Here is code which I copy / pasted earlier discussion (This code is written Carlos Antollini):
while(haveFile)
{
havefile = finder.FindNextfile();
if(finder.GetFileName().Find(".") == -1 && !finder.IsDirectory())
pListBox->AddString(((LPCTSTR)finder.GetFileTitle());
}
|
|
|
|
|
Pointers can be used anywhere in the programs you write. These are to save memory on startup and are faster to access and easier passed between methods.
We can allocate memory, use the resources, & deallocate the memory, keeping our system in good shape.
So, if we had.
someFunction() {
CListBox myListBox //Allocate memory on stack.
myListBox.AddString(""); //Call method.
}//Object destroyed on exit (out of scope).
or we could have
someFunction() {
CListBox* pListBox = new CListBox; //Allocate memory on stack.
pListBox->AddString(""); //Call method.
delete pListBox; //Destroy memory, give the system back the memory on the heap.
}
We can easily pass our pointers to other functions, saving time, no overhead in copying objects, copy by reference or copy by value, value is slower.
Hope this helps a bit....The best way to get experience with pointers is to use.
Gerry.
|
|
|
|
|
I think you can go read "A Beginner's Guide to Pointers"
which written by Andrew Peace. You can find this article in this site, it is quite helpful.
http://www.codeproject.com/cpp/pointers.asp
Hope this can help you...
|
|
|
|
|
Thanks for advises! I go and look that article...
And thanks very much of that code before, it clears also this thing much!
|
|
|
|
|
Thanks for advises! I go and look that article...
And thanks very much of that code before, it clears also this thing much!
|
|
|
|
|
I will look that article and thanks also that code, it helped out for understanding pointers!
|
|
|
|