|
Have you tried the GetTotalSize() method of the FormView (scrollview implemented)?
|
|
|
|
|
I have a structure like
struct Id {
LPCSTR sId; /* note that this is the first member */
unsigned nId;
};
I'd LOVE to have vc-debugger to display the sId value (in place of {...}) in the watch/this/locals/auto window, like CString does.
I've looked through the sources for CString and haven't quite figured it out.
Deriving from string isn't an option.
Any suggestions?
|
|
|
|
|
Locate the file autoexp.dat - mine (Visual Studio 6) is in the MSDev98\bin directory.
This file contains details of the expansions used when debugging. Open this up, and there is a huge bit at the top telling you how to do your own stuff. Further down you can see the entry for CString.
Hope this helps!
|
|
|
|
|
Are you saying that when you view Id.sId in the watch window, it shows ellipses instead of the actual data? If you do not know about the autoexp.dat file, and thus have never altered it, then I'm unclear on your question. By default, the contents of the address pointed to by Id.sId are displayed. If you had just Id in the watch window, it would indeed show up as {...}.
|
|
|
|
|
thanks a lot. I didn't know of autoexp.dat, but have always suspected something like it. Thank you very much for telling me of it.
(Thought it was built into vstudio. -darn M$)
|
|
|
|
|
How do I put an icon on a Single Document screen and then be able to click on the icon to call my dialog??
Thanks,
grahamoj.
|
|
|
|
|
Where do you want the icon? Are you sure you're not talking about a toolbar button?
|
|
|
|
|
Hello,
I have a structure that looks like:
struct STRUCT_EXAMPLE<br />
{<br />
int Data1;<br />
int Data2;<br />
float Data3;<br />
...<br />
<br />
void Clear() { memset(this,0,sizeof(STRUCT_EXAMPLE)); }<br />
};
Now, I allocate an "array" of this structure:
STRUCT_EXAMPLE* pPtr = new STRUCT_EXAMPLE[NewValue];<br />
for (int i=0;i<NewValue;i++)<br />
pPtr[i].Clear();
Everything works fine but when I delete the array:
if (pPtr)<br />
delete[] pPtr;
I have a memory check error:
memory check error at 0x0145C630 = 0x00, should be 0xFD.
memory check error at 0x0145C631 = 0x00, should be 0xFD.
memory check error at 0x0145C632 = 0x00, should be 0xFD.
memory check error at 0x0145C633 = 0x00, should be 0xFD.
and the first adress byte is the adress of the first element of my array (so it's normal that it is 0 because I want the first Data1 in the the first element of the array to be 0)!!
Can someone help me ??
Thanks
|
|
|
|
|
cedric moonen wrote:
STRUCT_EXAMPLE* pPtr = new STRUCT_EXAMPLE[NewValue];
Shouldn't this be: STRUCT_EXAMPLE** pPtr =
I'd change your code to use vector<struct_example*> ...
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
No, I want to use an array of structures, not use the pointers (so they are automatically destroyed) !
But, I found the error: I made a mistake elsewhere in my code and I write "outside" an array. In fact I write on the memory allocated by the bebugger (debug mode) just before the array (STRUCT_EXAMPLE* pPtr). So, that made the compiler go crazy !!
|
|
|
|
|
hi
is there any any anyway to set the (SourcecodeWindow) keywords on bold?
i have used years the Borland C++ Builder, and the style is very good. black bold C++ keywords.
so is there any way?
|
|
|
|
|
Hi, everyone!
I think memcpy is faster than strcpy and they really
do the same thing. So I think we should not use memcpy
instead of strcpy.
Am I correct?
Thanks in advance,
George
|
|
|
|
|
You can use memcpy when you want to copy a 'raw' piece of memory. There is no such thing as a concept of a C-string ( null-termination) or even objects in it.
When you want to work with strings it is best to use std::string (or CString if you like) and not to work with strcpy or the like at all.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Thanks, jhwurmbach buddy!
I am always using strncpy in C++ program. How to use
std::string to do string copy? Do you mean this way,
Source code:
--------
string src = "abc";
string des = src.substr (0, 2);
--------
regards,
George
|
|
|
|
|
Yes, if the first two letters are what you want.
You can make a std::string from a LPCTSTR returned by the API simply by saying e.g.
LPCTSTR s = GetWindowText();
std::string t (s); the other way round is:
SetWindowText( s.c_str() );
YOu can read more about std::string (and CString) in the Codeproject C++ FAQ.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Thanks, jhwurmbach buddy!
George
|
|
|
|
|
strcpy copies a given block of memory up to the point it finds a "0" or NULL in the memory block. strncpy will do the same thing up to a given number of charaters. memcpy will copy the given number of characters.
Assume you wanted to copy the following data:
ABCDE\0MNOPQ
Notice, that there is a NULL character in the 6th position.
strcpy (dst, src) would result in: ABCDE\0
strncpy (dst, src, 8) would result in: ABCDE\0
strncpy (dst, src, 3) would result in: ABC
memcpy (dst, src, 3) would result in: ABC
memcpy (dst, src, 8) would result in: ABCDE\0MN
If you want to copy raw data, use memcpy. If you want to copy C-strings (instead of std::strings) use strcpy or the safer strncpy.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thanks, Tim buddy!
George
|
|
|
|
|
Problem:
while downloading a huge file from a ftp server, if my service lost the connection in between, how can i resume the download?
The problems are
1: Since it is a huge file, it is not a good idea to restart the download.
2: If we are download by parts in different threads, then each thread should have different connection. This will not work when the server restricts the number of users.
Anybody please suggest a better algorithm for this.
|
|
|
|
|
that depends on whether the ftp server runs a version of ftp which allows resumes AND you have an ftp client which also supports Resume
cheers
bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
To resume a download you need to use the REST command:
REST <byte offset="">
The REST command will make the server start at a give byte offsett and not at the start of the file.
When you send that command the server will reply with either a negative response, or the code 350, which means it will start at the byte offsett you've specified.
NOTE: The REST command must be followed by a service command (RETR or STOR).
-Rune SVendsen
|
|
|
|
|
When writing some text to a DC, it appears that the font creates it's own background for it's character spacing. I was wondering if there was a way to change this. Thanks.
bob
|
|
|
|
|
CDC::SetBkColor()<br />
CDC::SetBkMode()
~RaGE();
|
|
|
|
|
CDC::SetBkMode
int SetBkMode( int nBkMode );
Return Value
The previous background mode.
Parameters
nBkMode
Specifies the mode to be set. This parameter can be either of the following values:
OPAQUE Background is filled with the current background color before the text, hatched brush, or pen is drawn. This is the default background mode.
TRANSPARENT Background is not changed before drawing.
Remarks
Sets the background mode. The background mode defines whether the system removes existing background colors on the drawing surface before drawing text, hatched brushes, or any pen style that is not a solid line.
|
|
|
|
|
Iam doing a project in MFC using ODBC classes which can connect to any ODBC compilant database ..
1.I created a ODBC DSN for a access database mdb .WHile creating the DSN i did not specify any SYSTEM DATABASE .
2.When i executed the program ,it gave me an error "could not find "c:\cb\debug\dbo.db" .FIrst of all the access database i have given in DSN creation is different from that pointed out in the error message . Secondly the path shown in the ERROR message is the path of the executable .
How do i solve the problem .....
Every LIFE is unique and so there is no use in comparing ....
|
|
|
|