|
HAve you broken it up ? I'd sprinkle the code with AfxMessageBoxes and build the string in two steps, an = and a +=, and see what I got.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Yeah, I'd try to do it as
theApp.Directory ++ "\\WulframAutoUpdater.exe";
tmp = theApp.Directory;
If that didn't work then god knows, I've never noticed problems like this before. Hope you get it working.
|
|
|
|
|
Ok, I re-arranged it like so:
Tmp = theApp.Directory;<br />
Tmp += "\\WulframAutoUpdater.exe";
It still doesn't work, but stepping into the CSimpleString source tells me that for some reason, GetData() doesn't get the right data, even when the "this" pointer in the class is the right data! I replaced the first line with "Tmp = "Test";", and that works fine. I've also gone through my code for the variable "Directory", and everytime I use it I use .GetBuffer(200). (I've had weird problems before from forgettting to use that function)
|
|
|
|
|
theApp.Directory is definitely empty. You can confirm /deny this by doing ASSERT (!theApp.Directory.IsEmpty()); before the first statement.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I did this:
char *Loc = new char[200];<br />
<br />
ASSERT(!theApp.Directory.IsEmpty()); <br />
strcpy(Loc,theApp.Directory.GetBuffer(200));<br />
It does assert, BUT, when I move the mouse over Directory, the tooltip shows that it isn't empty, and the directory is properly copied into Loc!
|
|
|
|
|
IGx89 wrote:
It does assert
So theApp.Directory contains no chars OR someone (you?) really messed up the internal bookkeeping of the CString. You use CString::ReleaseBuffer()properly?
IGx89 wrote:
the tooltip shows that it isn't emptyWhich Tooltip? Where?
--
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
I know that it's my fault; I just need to figure out WHAT is my fault
ReleaseBuffer()? Ummm, didn't know about that function . Would that cause these errors?
When you pause the debugger, moving the mouse over different variables shows their contents in a tooltip. Very useful for debugging
|
|
|
|
|
IGx89 wrote:
ReleaseBuffer()? Would that cause these errors?
GetBuffer() takes the char* that CString is wrapping out of the control of the CString -class. With ReleaseBuffer() you return it into the hands of CString .
Between GetBuffer() and ReleaseBuffer() you cant use any CString -functions.
Well - you can, but they do not work.
Your error description sounds to me like a CString not having updated its bookkeeping (eg. does CString not rely on the \0 terminator to determine string length - it counts internaly).
Especially the fact that CString doesnt work and strXY() does.
--
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
Hello,
I have a dialog, with a child dialog in.
My child dialog handle mouse events.
In the OnLButtonUp() function of my child dialog, I would like notify the parent dialog that the child is ready for something.
How can I notify parent of something happen from a function in the child ??
|
|
|
|
|
there are a few ways to handle this. You can set up a custom message and post it to the parent, or you can have a public function within the parent to be called from the child. I usually do the latter (mainly because i'm lazy). Here's what I do:
in the child class:
#include "CYourMainDlg.h"
CYourMainDlg* pMain = static_cast<CYourMainDlg*>(AfxGetMainWnd());
pMain->YourPublicFunction(TheParamsYouWantToSend, MaybeAnother);
hope that helps.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Thx,
It work now.
I have create a class COpDialog: public CDialog with a public method, and all parent classes are public COpDialog. So the child could notify his parents.
|
|
|
|
|
what about defining a pointer variable of the same type of the parent dialog:
<br />
CMyParentDlg *p = NULL;<br />
Use this in order to get access to the parent window/dialog:
<br />
p = (CMyParentDlg *)this->GetParent();<br />
Use this in order to pass the data?
<br />
p->SomeFunction(...);<br />
or this:
<br />
p->SendMessage(...);<br />
Hope this helps
|
|
|
|
|
Hi.
I want to send messages to one or more view classes from either CMainFrame or the doc class. I would like to know, How do you get access to the handles of one or more view classes from inside the doc class and/or CMainFrame?
Thanks,
Kuphryn
|
|
|
|
|
AfxGetMainWnd()->GetActiveView(), from memory.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
If you mean sending to some views belonging to the same document, the way is to use
POSITION pos = GetFirstViewPosition();
while (pos != NULL) {
CView* pView = GetNextView(pos);
...
}
For some documents use
CDocTemplate::GetFirstDocPosition/GetNextDoc and then - the code above
To enumerate all views of all documents of all types you can use
CDocManager::GetFirstDocTemplatePosition/GetNextDocTemplate, then see above
How to get instance of docmanager see CWinApp documentation. If my memory doesn't fail me, CWinApp have a member m_pDocManager
|
|
|
|
|
Thanks everyone.
http://www.codeguru.com/forum/showthread.php?s=&postid=641316#post641316
Andreas Masur of CodeGuru posted a valuable chart on getting access to difference classes in MFC.
http://www.codeguru.com/forum/showthread.php?s=&postid=641316#post641316
Kuphryn
|
|
|
|
|
Q1-if a system is in loggoff state and i call
GetUserName(..).
is the function fails,and return value is zero?
and how did i know that the system is in loggoff state?
//////////////////////////////////////////////////////////
Q2-how i will trap the WlxDialogbox and where msgina asks for the userid,password
and fill in the fields by my self?
can any body help me in this regard?
//////////////////////////////////////////////////////////
Q3-how did i find the system32 path programatically?
//////////////////////////////////////////////////////////
Q4-if i call BlockInput(true)
and then i want to use postmessage or sendmessages for keyboard and mouse
will these messages works?
/////////////////////////////////////////////////////
r00d0034@yahoo.com
r00d0034@yahoo.com
|
|
|
|
|
imran_rafique wrote:
Q3-how did i find the system32 path programatically?
I have no idea how you did that actually!
But I know how I did it!
Pass CSIDL_SYSTEM in the second parameter of SHGetFolderPath()
But look up that function in MSDN Library to get know it better.
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
hmmmmm
thats nice.
thanks for reply.
r00d0034@yahoo.com
|
|
|
|
|
I've been going through this site and it's articles for the last couple of months and I starting to find that I don't know as much about C++ as I thought I did. When it comes to articles dealing with templates and the more advanced topics I get lost so I'm wondering if anyone knows any good C++ books that covers the more advanced topics.
Thanks in advance.
- monrobot13
|
|
|
|
|
C++: The Complete Reference[^]
I like this one. It's not quite as terse as the one below. I find it more accessible.
The C++ Programming Language[^]
On the other hand, you can't beat this book. This will tell you whatn you can and can't do with C++.
I recommend buying both. They're excellent.
Jon Sagara
When I want something, I just go out and buy it. That makes me a go-getter.
-- My sister
|
|
|
|
|
First thanks for the response.
Second, the thing about the books you mentioned is that they start out from the basics and then go up. I'm looking for books that geared more towards the advanced topics. Books that don't have any (or very little) to do with the basic stuff.
Thanks again.
- monrobot13
|
|
|
|
|
You don't have to read the beginning stuff. You can skip right to the advanced topics...
Jon Sagara
When I want something, I just go out and buy it. That makes me a go-getter.
-- My sister
|
|
|
|
|
Modern C++ Design
Exceptional C++
More Exceptional C++
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I really like the "Standard C++ Bible". It covers templates and all that specific C++ thing you want. And many good chapters about STL too!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|