|
The length of pbBuffer and m_strResultText is 225 .. the plain text string is 2539, also it encrypts: "<password>something" fine but then when it gets called to encrypt the 2539 length string it messes up and encodes/returns only 225.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
Hello guys,
I`m currently writing software for a Pocket PC. The problem with that is memory-leak detection is not so straight-forward as in Visual C++ 6.0 debugger.
Can anybody help me with a way how I can detect memory leaks and where they are located.
Not just memory leaks caused by new and delete( found a way for that allready here on Codeproject ), but also by GUI components. (CreateObjectIndirect vs DeleteObject etc...).
Is there a way to see if maybe memory is leaked in third party libraries or dll`s ?
I mean, I looked my code from front to back, left to right, back to front, right to left and it looks all good to me, but still it looks like I leak memory and I don^t have a clue where that could be happening..
If anybode can provide any help, please do. Or if you know any links where a solution might be found, please let me know.
Greetz,
Davy
|
|
|
|
|
The most best way to check for memory leaks is the most apparent as well: in your dev. environment, start some type of memory monitor, like the Task Manager in Windows. Then just run & stop your test application for 10-15 times in a row. If you see a radical memory increase, then you have a leak.
Small memory leaks (under 10 kb) are usually not even detectable, and in most cases, harmless. Of course, if you don't boot the Pocket PC at all, then they may cause an issue in a long run.
In the end, if you don't have access to MSVC++'s debugger, you should invest on some Memory Validator programs available commercially. They are _made_ for detecting memory/handle/GUI leaks, and are very efficient at it.
I'm not sure what you use to create the GUI. But C/C++ does not care. Everything always comes down to using new/delete pair. The MFC framework does it, deep down under. You just can't see it. Even the RUNTIME_CLASS macro's and the related functions use new/delete, or the C-version, malloc.
For the Windows GUI and MFC, the rule of thumb for resource leaks is that if you load a resource from a disk file and don't unload it, then you leak memory. If you load the resource from your application instance (it is saved in the resource script), then you don't need to release it, as it is released automatically when the instance exits.
All in all, get a memory validation software. It'll help you a long way without headaches.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi!
Need some help with converting integer to char. Because it can't find this function. Is there only atoi that is build in the library? And if so, do I have to make my own itoa?
Do someone know?
|
|
|
|
|
you could use the following
int i=56;
char sNumber[10]; //what the hell let`s make it big enough..
sprintf(sNumber, "%d", i);
so sprintf can function as your itoa.
Greetz,
Davy
|
|
|
|
|
|
Any one know a Form Designer for Visual C++.NET (UnManaged, MFC) ???
If not, who's the better choice to design a form without Resource Editor ???
"We are de power, there is no power without knowledgement"
|
|
|
|
|
Windows Forms are a feature of the .NET architecture. The only way to use Forms is to write either .NET-compatible code (VB.NET, C# or C++.NET) or use Managed Extensions for C++.
You can create a managed C++ project, and then write it completely with unmanaged code in order to get Forms support for unmanaged application. However, this isn't what the .NET was made for, so if in any way you can get away without using Forms (dialogs, windows, prop pages, formviews, anything), then consider those options first before writing competely unmanaged code with Managed Extensions enabled.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
The problem of create a managed C++ project only to get Forms support is that the client would have .NET Framework installed.
I want a application without .NET Framework dependency. The only choice is the Resource Editor ?
ps. Sorry my bad english. I speak portuguese.
"We are de power, there is no power without knowledgement"
|
|
|
|
|
In that code Wait cursor not stops appearing,
even EndWaitCursor() callled,
(until I move mouse)
<br />
CFromview::Method()<br />
{<br />
BeginWaitCursor();<br />
<br />
WORK();<br />
<br />
<br />
EndWaitCursor();<br />
<br />
<br />
this->Invalidate();<br />
this->UpdateWindow();<br />
<br />
}<br />
Why ?
how to correct
|
|
|
|
|
Is CFromview::Method() called frequently?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Only once.
Problem probable happen when it finished until,
butoon is relalized.
::SetCursor(AfxGetApp()->LoadStandardCursor (IDC_ARROW ));
can help.
Cursor probably not refreshed due to unknown reason,
when standard Wait/End sequence is proceed.
|
|
|
|
|
If you use MFC, you could use a CWaitCursor object:
<code>CFromview::Method()
{
{
CWaitCursor waitCursor;
WORK();
}
RedrawWindow();
}
HTH,
K.
Silence Means Death
Stand On Your Feet
Inner Fear
Your Worst Enemy
|
|
|
|
|
Works same.
In usual method- yes,
in this - no any difference in problem.
|
|
|
|
|
It sounds like something else is setting the cursor, then.
You could also try to catch WM_SETCURSOR, and use a boolean set to true when your application is working:
BOOL CMyView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if(m_bMyAppIsWorking){
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
return TRUE;
}
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
return CView::OnSetCursor(pWnd, nHitTest, message);
}
Silence Means Death
Stand On Your Feet
Inner Fear
Your Worst Enemy
|
|
|
|
|
Please explain what nature of error that was happen?
First is need to understand fully,
than to solve by try and error.
|
|
|
|
|
In the example I gave, the processing of WM_SETCURSOR by the view leads to set the cursor either at IDC_WAIT or at IDC_CROSS, whatever another part of your code set the waitCursor.
vgrigor wrote:
First is need to understand fully,
than to solve by try and error
IMHO, not always, sometimes it doesn't worth the time to learn it.
Silence Means Death
Stand On Your Feet
Inner Fear
Your Worst Enemy
|
|
|
|
|
Of course,
Worth - when it is possible.
It is usually (or often ) possible - to understand something, than only try and error.
that is often proposed.
|
|
|
|
|
Ensure that in your WORK() method nothing is trying to steal the capture of the mouse. Check for SetCapture() API calls.
|
|
|
|
|
how to replace char array[15] with string field?
|
|
|
|
|
Simply move the array into the string.
char array[15];
string str = array;
William
Fortes in fide et opere!
|
|
|
|
|
But I do I deal with indexes in array after I move everything into string?
|
|
|
|
|
Use the [] operator.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Like this?
char array[15];
string str[] = array;
|
|
|
|
|
No, like this:
char array[15];
string str = array;
if (str[3] == array[3])
...
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|