|
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++!
|
|
|
|
|
I highly recommend Modern C++ Design by Andrei Alexandrescu.
http://www.amazon.com/exec/obidos/ASIN/0201704315/qid%3D1039303732/sr%3D11-1/ref%3Dsr%5F11%5F1/103-5795742-0356630
Kuphryn
|
|
|
|
|
|
Thanks everyone for the replies.
- monrobot13
|
|
|
|
|
Check out Scott Meyers' "Effective C++" books.
|
|
|
|
|
Hi.
In general, is it more extensible to implement core C++ datatypes in 32bits and 64bits operating system, or should you implement the OS specific datatypes? For example, under Windows you can implement a DWORD (32bits unsigned integer). A DWORD is equal to C++ unsigned long.
I would like to know what is most extensible in terms of C++ design and implementation?
Lastly, what is the point of an int datatype in 32bits and 64bits OS? In 32bits OS, an int is equal to a long.
Thanks,
Kuphryn
|
|
|
|
|
Here's what I've learned when dealing with the int and long data types in C++:
1. int was designed to be as large as what the CPU can handle most efficiently. In Win16 or Win32, int is 16 or 32 bits. in 32-bit UNIX systems int is 32 bits.
2. On 64-bit systems (Win64 or UNIX) int is also 32 bits, I guess to make it easier to port 32-bit apps.
3. long is 32 bits in Win16 and Win32, as well as 32-bit UNIX.
4. On Win64, long is also 32 bits, whereas on UNIX, it's 64 bits (which is what you'd expect, and how it's represented in .NET and Java).
So my suggestion, for the sake of simplicity and portability, stick with int -- don't use long .
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
long is ( or was ?! ) a size qualifier for the int at the time of 16bits apps. ( samething for short ).
long and short are not really types!
Alvaro Mendez wrote:
4. On Win64, long is also 32 bits, whereas on UNIX, it's 64 bits (which is what you'd expect, and how it's represented in .NET and Java).
Are you sure ? I thought the int would be "scaled" according to the CPU ?
Max.
|
|
|
|