|
Hi Guys,
I use a CRichEditCtrl derived class in my project. I add text with a
CRichEditCtrl ::ReplaceSel() call and images using
IRichEditOle::InsertObject(). In order to keep the size of the content of the
CRichEditCtrl object manageable, I remove the first half of the lines from
the control from time to time. The memory used by those lines is not released
though. The application uses more and more memory. Given enough time, the
whole memory will be usede by my application. How can I fix this problem?
I checked several suspects:
There are no memory leaks.
If I disable the control, the application behaives properly.
If I disable adding images to the control but keep adding text, the problem
persists.
I disabled Undo/Redo capabilities of the CRichEditCtrl control.
Any help is very appreciated.
Thank you,
Chip
|
|
|
|
|
before adding control to main Dialog ,Did u add AfxInitRichEdit()
method to the Dialog?
I see that the Problem many problem occured due to that.this is from MSDN.
"Caution :if you are using a rich edit control in a dialog box (regardless whether your application is SDI, MDI, or dialog-based), you must call AfxInitRichEdit once before the dialog box is displayed
"
|
|
|
|
|
I'm using in fact AfxInitRichEdit2() to initialize the rich edit controls. Thank you for your input.
|
|
|
|
|
I got a trouble with creating MFC aplication on my PC. I create MFC application (any type) but when it comes to compilation I get errors in WinDef.h definitions. Saying:
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(43) : warning C4091: 'typedef ' : ignored on left of 'unsigned long' when no variable is declared
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(43) : error C2143: syntax error : missing ';' before 'constant'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(43) : fatal error C1075: end of file found before the left brace '{' at 'c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(30)' was matched
All this errors point towards the line:
typedef unsigned long ULONG;
Surpisingly averything is O'K on my laptop where I have installed the Visual Studio .NET from the same set of CD's. I brought setting in Tools/Options to the view of working version (on laptop) but it didn't help. Can anyone help with this puzzle? Thanks...
|
|
|
|
|
hi
Did u place the Include and Lib directory path of SDK at the top of Directory paths?
some times this error message is diplayed when Include/LIB path of the SDK is not in the TOP of the Directories..
|
|
|
|
|
Hi
Thanks for your comment.
I did what you suggested (and played with the order of the inlcude and lib files. Now (almost independently on the order of those files) I have a list of errors pointing towards WinReg.h file. Fisrt error points to the second line in:
RegCloseKey (
IN HKEY hKey
);
saying
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinReg.h(145) : error C2065: 'HKEY' : undeclared identifier
Must admit that I don't understand why order of include files is important and what how to get ride of new error messages. Would appreciate any comment.
Thanks, Bakhti
|
|
|
|
|
hai
I want to assign À0"8! to a byte array...ie byt[0] = À, byt[1] = 0 ..and so on..i did as
BYTE byt[5] = "À0"8!";
but its giving errors..how should i do this??
thanks..
|
|
|
|
|
When you assign a string to an array there's a hidden '\0' character, so in fact in your code above you're assigning 6 characters to an array that can hold 5.
Try BYTE byt[5] = {'a', 'b', 'c', 'd', 'e'};
|
|
|
|
|
Hello,
I have been having this compiling issue today and I don't really know what I am doing wrong.
Nothing better than an example to make myself understood thus consider the following example:
class objA
{
public:
objA(){};
~objA(){};
public:
virtual bool Setup(int){};
bool Setup(float){};
};
class objB : public objA
{
public:
objB(){};
~objB(){};
public:
virtual bool Setup(int){};
};
class C
{
public:
C(){};
~C(){};
public:
bool doTest()
{
objB b;
b.Setup(100);
b.Setup(0.0001);
};
};
Why am I getting this warning? I mean, shouldn't the compiler automatically use the float-version method, or are there any rules I am aware of?
Any insights as to why this is happening will be greatly appreciated.
Thanks,
David
|
|
|
|
|
Because your Setup function is declared to accept an integer
<br />
class objB : public objA<br />
{<br />
public: <br />
objB(){}; <br />
~objB(){};<br />
public: <br />
virtual bool Setup(int){};
};<br />
|
|
|
|
|
Since the 0.0001 is set-up as a const double type by the compiler, it is going to have to cast it since you have not provided an explicit cast. I'm not familiar with all the rules each compiler will use in order to decide what cast to use, but at least you are given a warning about the cast. Have you tried this
b.Setup((double)0.0001);
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
|
|
|
|
|
I have an application writing out a Date/Time field into an Access database. On some computers the resulting table has 11/12/2004 for November 12, 2004 and on others it is 12/11/2004. The problem is that the second format when it is being read back in or queried on is being read as December 11, 2004.
Is there some setting I am missing here?
The app creates the database table, writes it and then queries on it yet runs differently on different computers because of this day/month switching.
Any ideas?
Thanks
"The world is a dangerous place to live, not because of the people who are evil, but because of the people who don't do anything about it."
Albert Einstein
Dave
|
|
|
|
|
Verify that the International settings for Date/Time are the same on each of the computers you are running on.
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
|
|
|
|
|
Hey,
I was just fooling around with what appeared to me to be a relatively straightforward bit of code when Visual Studio gave me with the error that "the stack around the variable 'count' was corrupted". I ran it in the debugger and everything looked fine, up until the moment the error popped up, which was between return 0; and the closing brace. The problem also seems to be dependent on the value passed to srand(). I would assume it had something to do with the program being unable to deallocate its memory or something, but I really don't have a good guess. Any ideas?
<br />
int main()<br />
{ <br />
int count[10]={0};<br />
srand(3);<br />
for(int x=0;x!=50000;x++)<br />
{ <br />
count[(int)(rand()*10/RAND_MAX)]++;<br />
}<br />
<br />
for(int i=0;i!=10;i++) <br />
{<br />
cout<<"count["<
|
|
|
|
|
count[(int)(rand()*10/RAND_MAX)]++;
This will corrupt the stack if rand() == RAND_MAX because count[10] is invalid.
try this code instead:
count[rand() % 10]++;
John
|
|
|
|
|
Oh my, too early in the morning. Thanks.
|
|
|
|
|
The expression rand()*10/RAND_MAX yields values between 0 and 10; when it returns 10, you're writing out of the bounds of count , hence the problem (and the reason why it only pops up for certain values of
srand(...)<code>.) <br />
<br />
Joaquín M López Muñoz<br />
Telefónica, Investigación y Desarrollo<br />
<small>Want a Boost forum in Code Project? Vote <a href="http://www.codeproject.com/script/comments/forums.asp?msg=910893&forumid=1645&mode=all&userid=111#xx910893xx">here</a>[<a href="http://www.codeproject.com/script/comments/forums.asp?msg=910893&forumid=1645&mode=all&userid=111#xx910893xx" target="_blank" title="New Window">^</a>]!</small>
|
|
|
|
|
Hi,
I am trying to tell MSSQL Server running on a remote computer on LAN to back up a database on my computer. This is done through a application written in c++.
The Idea is to back up the database on the computer where the server is located as well as on the computer running the app.
What I did before this dual requirement was presented was create a stored procedure to backup the database which took the database name and the location to be backed up to as arguments.
It works well as SQL Server backs it on the local drive specified the path.
No if I send in the network address of my computer to do the same, SQL SERVER error log tells me that operating system denied permission ( which is what will be expected ).
I send in a string as \\computername\driverletter$\path\filename.zip
How can I modify this to include the user name and passwrod so that SQL SERVER can back it up on my computer without security problems???
I have tried net use kind of syntax but it does not help.
Please help!! this is really important.
Thanks In advance.
|
|
|
|
|
The simplest way is to backup the data on the server and then copy the file to your remote pc using SHFileOperation.
John
|
|
|
|
|
that will require me to logon to the server computer from the app before attampting the copy won't it?
|
|
|
|
|
Now when I think of it the user that is logged on has to be an admin for that to work. Sorry. I guess I have worked as an admin too long...
There are several ways around this. One way around is you can execute an application as a different user. I have done this in the past. Spawn an application that transfers the file as admin.
John
|
|
|
|
|
I tried using the SHFileOperation function.
I gives me an error copying the file which says that error reading the source disk or file.
This could be related to security issue, that windows will not let me copy the file from
the server to this machine which is running the application.
So the original problem is still there. I have the usernames and passwords of both computers(the DBServer and the host running application). How do I backup the DB to host or copy the already backedup file from Server???
|
|
|
|
|
I know. Unless you are logged in on the local pc as an admin on the server pc SHFileOperation will not work. Sorry.
John
|
|
|
|
|
but I am logged in as admin !!
The problem is how to tell windows that I have admin rights to the server when using the SHFileOperation function??
|
|
|
|
|
SHFileOperation uses the rights of the logged on user . Are you sure you passed the data correctly? Is your string double null terminated?
John
|
|
|
|