|
Hi in my application I call GlobalMemoryStatus() to get the status of the virtual memory of my system. It returns the fact I have loads of virtual memory, Great!!. However when I call new() to try to allocate memory that is less then the virtual memory (allocating quite a large amount but still less then the virtual memory)it is returning NULL due to there not being enough memory available.
Does anyone have an explanation for why this is happening?
Thanks
The Blade Runner
|
|
|
|
|
Memory allocation will fail if you don't have the required amount of contiguous memory available. Try running my product MemWatcher (free download) and see if that helps. Sorry for the shameless plug, but I think it may help you.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
This program only shows whats in Physical memory not virtual memory aswell. I know to memory I am trying to allocate is greater the just the physical memory but the virtual memory according to this GlobalMemoryStatus function shows it is big enough too allocate the memory.
Thanks anyway.
The Blade Runner
|
|
|
|
|
MemWatcher can free up memory that Windows mistakenly continues to flag as "in use", thereby possibly allowing more memory to be used by your program. However, if you try to allocate "x" bytes and there aren't "x" contiguous bytes available, the allocation will fail.
Unfortunately, simply increasing your virtual memory won't guarantee that it's actually usable, since none of the data currently in physical memory may be swappable.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi,
I have developed an ActiveX control using ATL, when I insert it and work with it in Ms Word 2000 it works perfect, but when I print it, depending on the screen resolution, the Word text is printed inside the control or in the right place or shifted
I have tried the same in Word 2002 and it works fine. How can I fix this ? Is there any well know bug from ATL/Ms Word about this issue ?.
Thanks in advance
Braulio
|
|
|
|
|
For some reason I get a compiler error when I try to use chevrons in WTL. I define _WIN32_IE as 0x0500 (instead of 0x0400), but then I get the following error.
c:\...\wtl70\include\atlframe.h(274) : error C2146: syntax error : missing ';' before identifier 'lpnm'
I have IE version 6, I got VC 6 with service pack 4, and I got WTL 7.
What more do I need to get it working? As it looks like I'm missing a header file.
Any ideas? Thanks in advance
- Griffith
Everything you say will be misquoted, ripped out of context and used against you.
|
|
|
|
|
I just tried this today and got the same error. Unfortunately, I do not know why either. I think (but am not sure) that maybe WTL7 is for .Net and that is why it may not work. I believe that there is an ATL 2.0, ATL 3.0 and 7.0 and a WTL 3.0 and WTL 7.0. The only thing I can figure, since there seems to be a major jump in version numbers, is that 7.0 is for .Net.
Can someone clarify or verify this?
|
|
|
|
|
Hi,
I am in the process of converting all my MFC projects from VS6 to VS.Net and I'm getting a peculiar problem. My programs seemed to convert fine (with a few minor code changes). However, when I run my app it turns out I am having problems deserializing an object of a type of class defined in an extension DLL. I get the following TRACE output "Warning: Cannot load CMyClass from archive. Class not defined".
On the MSDN, it says that this will be a problem when using an extension DLL from a regular DLL. However, I am using the extension DLL from a regular MFC application - which the MSDN says should work fine.
MSDN link here (New window)
Does anyone have any idea why I am getting this error? I would be very grateful if anyone could shed some light on this issue.
Many thanks,
Mike.
|
|
|
|
|
I was going through some C++ code and found this syntax:
Complex **_W;
I do not understand the ** notation. Is it a pointer to a pointer? How am I supposed to initialize such an object and access its member functions?
Thanks. Looking forward to some replies
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Complex W;
Complex* pW = &W;
Complex** ppW = &pW;
Complex*pX = *ppW;
Complex X=**ppW;
double i=(*ppW)->i;
double j=(**ppW).j;
Easy really!
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
pankajdaga wrote:
Is it a pointer to a pointer?
Yes.
pankajdaga wrote:
How am I supposed to initialize such an object and access its member functions?
_W x;
*x = new Complex();
*x->ComplexMethod1();
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Hi,
I might not be the best at explaining this, but I'll try...
If you want to change a variable that is passed in to a function, you would pass it by pointer or by reference. In the same way, if you want to change a pointer that is passed in to a function, you could pass a pointer to a pointer.
Here is how you might do it:
// We hope that calling FindComplex will change the value of pFoo
Complex* pFoo = NULL;
// Pass a pointer to a pointer
FindComplex(&pFoo);
// Now pFoo may have changed
BOOL bChanged = (pFoo != NULL);
...
void FindComplex(Complex** pFoo)
{
Complex* pFound = NULL;
// Do some code here to find a Complex object and set pFound
*pFoo = pFound;
}
Hope this helps and I hope it's right!!
|
|
|
|
|
Hi,
How can I draw strings with GDI+ that are are vertical bottom to top aligned!
I try things as SetFormat(StringFormatFlagsDirectionVertical | StringFormatFlagsDirectionRightToLeft) but the text is always top to bottom oriented.
|
|
|
|
|
Yep, that's a serious limitation of GDI+ but it can be easily overpassed by rotating yourself the text:
Graphics* m_pGraphics;
What you have to do is :
1. translate text to origin,
2. rotate,
3. translate back to position,
Let's go:
We create a graphic container to apply transformations
graphicsContainer = m_pGraphics->BeginContainer();
Doing steps 1,2,3 the order of matrix multiplication is important !
m_pGraphics->TranslateTransform(pointF.X,pointF.Y);
m_pGraphics->RotateTransform(-angle);
m_pGraphics->TranslateTransform(-pointF.X,-pointF.Y);
Draw the string
m_pGraphics->DrawString(str, -1, &font, pointF, &sf,&solidBrush);
Fold back transformations by getting out of the container
m_pGraphics->EndContainer(graphicsContainer);
Jonathan de Halleux, Belgium.
|
|
|
|
|
Very thanks friend.
It´s really what I was thinking to do. Thanks for your help!
|
|
|
|
|
i am using winmain in my application and i want to restrict that only one instance of the application should run at one time. is there way to restrict it.
|
|
|
|
|
Look at this^ article.
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Perhaps this article can help you ...
Clic here
A single instance is a "Singleton"
Hello World!!!
from Raphaël
|
|
|
|
|
Sorry, but a Singleton is to do with having a single instance of a particular class in an application (and is a very useful thing ), but the question was asking about only ever having a single instance of an application running at a time.
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Of course... Sorry...
Hello World!!!
from Raphaël
|
|
|
|
|
Hi all, I know this is cheeky in the C++ section but pleeease help me!! I need to shave some time off of the compiler generated interrupt code. In the code below (#int_gobal with compiler generated interrupt code within it) this shoul compile then work the same as it previously did but the compiler stops on '03.5', this is the status register bit 5 so i tryed 'BTFSC STATUS,5' but that didnt work either. Im very confused, please help me.
#int_global
isr() { // Will be programmed at location 4
#asm
BTFSC 03.5
GOTO 00A
MOVWF 25
SWAPF 03,W
MOVWF 26
GOTO 00F
........ etc ....
#endasm
}
An Expert is somone who has previously made ALL the Mistakes, I dream of this day. - Lucky
|
|
|
|
|
i duuno much about PICs, but other controlers ... so ... first, why not doing all the stuff in asm ? ... secondly, giving 03 will always work whereas STATUS must be an alias and should be used only if it is defined somewhere as being equal to 03 (like an #include STATUS 03)(check the include files and/or your compiler settings)
Could you post the BTFSC description function ??
~RaGE();
|
|
|
|
|
Hi !
Just like to know how difficult this is to skin a dialog app such winamp does (must be the 100000th to ask it, but ... ) ? Someone knows about a _good_ article on that ?
Thanks ...
~RaGE();
|
|
|
|
|
Yes, my article and it is VERY good.
http://www.codeproject.com/dialog/winampwnd.asp
I thank you
James
|
|
|
|
|
James Spibey wrote:
Yes, my article and it is VERY good.
Lol ... Ok, I´ll take it
James Spibey wrote:
http://www.codeproject.com/dialog/winampwnd.asp
well, i must really have searched like a '*Ä+ä#, because i did not find it on CP ...
Thanks a lot, that´s exactly what i was looking for.
~RaGE();
|
|
|
|