|
Can anyone help me? I'm having a bugger of a timetrying to figure out how to get rid of my memory leaks. This following functionality is in my Doc class. The SrcDirImages is a CStringList declared in the header file so it will be global to the class, and I can use it elsewhere in other methods.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int CPortfolioOrgDoc::buildImageList( CString SrcDir )
{
CFileFind filefinder;
SrcDirImages.RemoveAll();
if( !SetCurrentDirectory( SrcDir ) )
return 0;
// loop through current directory and get names of image files to list.
if( filefinder.FindFile( "*.jpg" ) )
{ // stupid filefinder returns 0 when it's on the last one.
while( filefinder.FindNextFile() )
{
SrcDirImages.AddTail( filefinder.GetFileName() );
}
// eg. must do action again after exiting loop...
SrcDirImages.AddTail( filefinder.GetFileName() );
filefinder.Close(); //clean up.
}
return SrcDirImages.GetCount();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Each time I execute this method, it leaves all the CString data pointers from the CFileFind hanging around in memory. I can't figure out how to get rid of them...
|
|
|
|
|
They should be in memory, till you call RemoveAll, shouldn't they?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
They stay there after I call RemoveAll(), (which I do again in the destructor). If I call this method numerous times, I get piles and piles of loose strings in memory...
|
|
|
|
|
The buildImageList() function looks unnecessarily complicated. How about:
int CPortfolioOrgDoc::buildImageList( CString SrcDir )
{
CFileFind filefinder;
SrcDirImages.RemoveAll();
BOOL bFound = filefinder.FindFile(SrcDir + "\\*.jpg");
while (bFound)
{
bFound = filefinder.FindNextFile();
SrcDirImages.AddTail(filefinder.GetFileName();
}
return SrcDirImages.GetCount();
}
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi,
Iam writing some piece of texts into a moncochrome bitmap & then then copying it to the destination Dc by using a "BitBlt" function.
Now when I perform some zooming,in the text,write to the bitmap & then read it back to the destination Dc,the Pixels are not scaled with good quality.
Is there any Win32 ApI functions available,so that I can do some resampling of the image(text) stored in the bitmap , before writing it back.(Don't want to resize the bitmap size,know that there is a "StretchBlt function for that",but want to scale Pixels).
Will it work if I increase the bitmap resolution,there by increasing the pixels & there by quality.
If so how can I change a bitmap resolution
Thanks...
|
|
|
|
|
Look for the CxImage article here on CodeProject. It does decent scaling.
--
An eye for an eye will only make the world blind.
|
|
|
|
|
How can I show text in arabic and hebrow languages, in my window, whitout Unicode. in ANSI mode and notifying Windows to use associated character set for each language?
also, what is the benefit of SetThreadLocale and similar functions? which one of them can solve my problem?
|
|
|
|
|
I am not prettey sure about the arabic language whether it is single byte or MBCS. To show your arabic and hebrow languages in your window, you have to use proper font and char set.
Install or findout a suitable font which support the arabic or hebrow languages and use the arabic or hebrow charset when creating a font. This will resolve your display problem.. But more over operating system also considerable...
SetThreadLocale () gives you support at API level.. Suppose your system deals with date, time, currency etc, you MUST set your locale so that windows API will do proper handling. Otherwise they do default implementation...
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
I Create a CRebarCtrl in a Dialog by Create method,and call ShowWindow()method to show it,Bu when I Run it,I Can't See the CRebarCtrl,So I Call ::GetWindowRect(),found the top = bottom ,Who Can tell me What's the matter?Thanks
|
|
|
|
|
Hi
When the user select some files and copies them in using rightclick->Copy, or Ctrl+C how could an application get those files?
To make myself more clear, I want to retreive the files that user have selected and copied.
(I have tried the GetClipboardData() API but I couldn't get these information out of it.)
|
|
|
|
|
Hi,
I hope your coding in managed c++, if so you can have a look at the method System.Windows.Forms.Clipboard.GetDataObject. You can use the data object it returns to get the files.
|
|
|
|
|
in visual C++......by default 5 tabs are there in control....if have to increase no of tabs....wat shld do?
|
|
|
|
|
when i add #define UNICODE to my stdafx.h . it says:
>>cannot open file "mfc42ud.lib
here is my stdafx.h :
#define _UNICODE
#define UNICODE
#if !defined(AFX_STDAFX_H__C1E8B1B1_B28C_4E3B_B6B5_49C7878BCAC5__INCLUDED_)
#define AFX_STDAFX_H__C1E8B1B1_B28C_4E3B_B6B5_49C7878BCAC5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include // MFC core and standard components
#include // MFC extensions
#include // MFC Automation classes
#include // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
what should i do??
|
|
|
|
|
BECAUSE !!!
you don't include the lib in your project suss:
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
When you install Visual C++ 6, there's an option to include Unicode support (ie the Unicode libraries etc). This isn't selected by default, so if you didn't pick it, the Unicode versions of the MFC libraries won't be on your system, hence the link error. The solution would be to reinstall VC++, making sure you select the Unicode option. (and don't forget to re-apply whatever Visual Studio service packs you installed before, or else the Unicode and non-Unicode libraries will be out of step).
|
|
|
|
|
Hi,
Do not reinstall your VC++, instead Go to Control panel and Add remove software. There you can select Visual Stuio then select the option equal to modify. IT will display installed components. Select VC++, click details, there you have to select MFC, then unicode library.
Otherwise Simple solution is , Click Select all which will enable all the features..
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
Unfortunately, your approach doesn't work with VC6, which predates the Windows Installer options you are describing.
Software Zen: delete this;
|
|
|
|
|
While using htmlview for the report file my MultiDoc application's save
menu is not working while scrolling through the activeview document.....
scroll event is also not invoked.....how to refresh the mainframe window...
ditty grail
|
|
|
|
|
Can you give me some general information on CFixedALlocNosync::Alloc() function or the whole class.
Its really urgent. don't know wat to do anymore.
I have an MDI application, Doc/View Style.. and then i have 2 additional Frame/Views attached on a ControlBar and those Views are views for the Document... So I have 1 Doc-3 Views..
When originall when the application is Opened by default, opening a New Document, the program works fine..
Now, when i launch the application with no New Document created, and then I open a document, an Access Violation occurs.. and debugger breaks on the code of CFixedAllocNoSync::Alloc() function.. On the callstack, I noticed that this Alloc() function was called by one of the control bars CControlBar::PreTranslateMessage().. I don't know what to adjust or what to change because this is internal to MFC already..
|
|
|
|
|
Hi guys!
I am really interested in experimenting with writing a scripting language and an interpreter to execute it. I've never done anything like this before and was hoping you might have some know of some articles/tutorials for beginners. I am hoping that it'll be object-oriented (similar to ECMAScript/Javascript), support debugging, support garbage collection, and be able to bind to native code (DLLs on Windows).
If you could please point me into the right direction or know of any articles/tutorials for beginners, I would really appreciate it.
Thanks
|
|
|
|
|
go up to the search box on CP, type in 'script', make sure the drop-box says 'Articles', hit 'Go' - there is a lot of info on this site - maybe not explicitly about ECMAScript, but it'll start you off
'G'
|
|
|
|
|
i have to perform a continuous operation(displaying an image) when a button is clicked.....what i want to know is that which of teh two threading types is tehbetter one ......
is it thE AfxBeginThreadFunction or teh CWinThread?
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
even if create thread using AfxBeginThread(),the return value of this function is a CWinThread objectNow choice is urs
|
|
|
|
|
Hi all,
I need to build a server with threading pool to handling client request.
Is it better to have ayschronous server connection rather than synchronous
connection, so that the server can have better response or performance ?
Is asynchronous server connection hard to program ?
Thank you
|
|
|
|
|
Doh, synchronous perfoms better, but asynchronous offers much better scalability.
Then, it depends on what you want - if you have only one client, then synchronous will be the choice, if the number of clients is unknowns or more than 2-3, async is the choice.
Async is much harder to code, because humans usually don't think async.
|
|
|
|