|
Anonymous wrote:
as evidenced by the Windows task manager
Are you absolutly sure of this? How much virtual memory is your process using? You may have run out of address space. Or have a highly fragmented address space such that there is no free block that is 1 MB to allocate a stack.
John
|
|
|
|
|
Because I want to plug-in my own specific memory/heap manager, I need to overrule the global new and delete operators, and the global malloc and free functions.
What is the best way to do this?
Simply overrule these 2 operators and 2 functions or do I need to overrule other functions as well?
Is there a good explanation or documentation in the MSDN somewhere on how to do this?
Apparently, the standard C run time library only allows some additional checking hooks, but I want to plug in my own complete memory/heap manager, not only perform some additiona checks. Also these additional checks only work in a debug version, not in a production version.
If I need to overrule more functions, how can I be guaranteed that this isn't depending on the version of the compiler (Visual Studio .Net, 7.1 in my case)?
Thanks.
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
you could try to overwrite it... i coded a c++ framework for kernel mode(i didn't have to overwrite the new/delete operator, cause there is none) and it works fine, also with different compiler versions.
Don't try it, just do it!
|
|
|
|
|
Hi all,
I had created a cab file for a MFC control so I can load on Internet Explorer. Whenever I click on the control is always output a message telling me this control is not safe. Is there a way I can turn it off and assume my control is safe??
Thanks
|
|
|
|
|
aglcic wrote:
Is there a way I can turn it off and assume my control is safe??
First thing is to implement the IObjectSafety interface in your control.
To help with implementing IObjectSafety and other helpful info read the MSDN Safe Initialization and Scripting for ActiveX Controls[^] article.
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
Hi,
I have a full server/container MFC app. I'm trying to serialize the embeded OLE objects in an independent file (e.g. I don't want my document file to save the ole objects, I want them in a separate one). This is what I'm doing:
//SAVE OLE OBJECTS
CFile fil( "test.ole", CFile::modeWrite | CFile::modeCreate );
CArchive ar( &fil, CArchive::store );
COleServerDoc::Serialize(ar);
(...)
//LOAD OLE OBJECTS
TRY
{
CFile fil( "test.ole", CFile::modeRead );
CArchive ar( &fil, CArchive::load );
COleServerDoc::Serialize(ar);
}
CATCH( CFileException, e )
{
(...)
}
END_CATCH
It seems that the file was properly saved, but when I try to load it, I get a debug assertion when COleServerDoc::Serialize(ar) is called.
What am I doing wrong?
Thanks,
|
|
|
|
|
I fix it, these two lines did the trick:
m_bCompoundFile = false;
ar.m_pDocument = (COleDocument*)this;
|
|
|
|
|
Hi all
i am using the below code to call a http post, this is what someone has given me, which i have ammended but its chucking me out an error on these two lines
pFile->AddRequestHeaders("User-Agent: GetWebFile/1.0\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
BOOL bOK = pFile->SendRequest();
can ne1 see where im going wrong
thanks
si
CString mob = argv[1];
CInternetSession is(_T(NULL));
CHttpConnection* pConn = NULL;
CHttpFile* pFile = NULL;
CString str_url = "http://62.232.41.434/Opera2003/Opera.asmx/";
CString str_path = "Receive?service=447781474224&Phone=447790775894&Message=Thank you for telling us your problem, we will look into what you’ve told us and take action if necessary. We are here to help you.&UserID=&Password=&UserData=&ContentType=0";
pConn = is.GetHttpConnection(str_url, (INTERNET_PORT)INTERNET_INVALID_PORT_NUMBER, NULL, NULL);
pFile = pConn->OpenRequest("POST", str_path);
pFile->AddRequestHeaders("User-Agent: GetWebFile/1.0\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
BOOL bOK = pFile->SendRequest();
ULONG nStatus = 0;
pFile->QueryInfoStatusCode(nStatus);
|
|
|
|
|
Hi,
I need to allocate memory for a large buffer (between 1 to 100 MB) in the RAM for a relatively short period (for recording data in an extremely high rate from USB2).
The problem is that i need to force the operating system NOT TO USE SWAPPING / PAGING on that buffer. This means that the whole buffer must be physically allocated in the RAM, and NOT in the hard disk.
does anybody know how to do that?
Programming language: C++
OS : windows 2000/xp
Tanks,
Oren.
|
|
|
|
|
Use VirtualLock, but you'll need to call SetProcessWorkingSetSize first to reserve so large buffer. A few problems though: you may not always get such large buffer, and if you get your machine will not run other programs nicely. Also you need admin or equivalent rights to call SetProcessWorkingSetSize.
|
|
|
|
|
Felix, Thanks!
I have just finished reading about these functions in the MSDN (the trick is to find them), and then I received your mail.
So, Thanks anyway!
Another small question:
the SetProcessWorkingSetSize function accepts the process's handle, and the arguments dwMaximumWorkingSetSize dwMinimumWorkingSetSize.
In what units are the last 2 arguments presented (bytes, or number of pages) ? if they represent number of pages, how do I get the size of each page in bytes?
Regards, Oren.
|
|
|
|
|
oren frenkel wrote:
In what units are the last 2 arguments presented (bytes, or number of pages) ? if they represent number of pages, how do I get the size of each page in bytes?
From memory - bytes. To get page size use GetSystemInfo.
|
|
|
|
|
|
Also do not let the application minimize. Windows will reduce the workingset to 2MB if the application is minimized.
John
|
|
|
|
|
Thank you very much! This is the exact kind of tip that i cannot get in the MSDN.
By the way - if the window is in the background (not in focus - another application is in focus) - does the same thing happen?
Does it also happen when the computer is being locked, or when in idle for a long time (for instance - the user starts recording data in a cyclic buffer, and leaves the computer idle for 30 minutes).
More important - if i set the working set to 64 MB, and allocated a 64 MB buffer and locked it, and only AFTERWARDS the user minimizes the window - does this also happen?
regards,
Oren.
|
|
|
|
|
oren frenkel wrote:
This is the exact kind of tip that i cannot get in the MSDN.
I found this out the hard way. I have an application that digitizes mamograms. A case of 4 images can be as much as 256MB. The digitizer only has a buffer to hold about 1/2 of an image so if you don't read the data in a 20 to 30 second period it will overflow. Well if the user pressed the minimize button the whole application thrashed for atleast that time and we got an overflow of the buffer and the pc had 512 MB of memory with almost atleast 150MB free. This was tested on NT4 and I believe Win2k but I have not tested it recently. Anyways this was because when the application minimizes the working set is trimmed. I did verify that was indeed what was happening on these operating systems.
oren frenkel wrote:
if the window is in the background (not in focus - another application is in focus) - does the same thing happen?
No. Only when the application is minimized. My solution was to not let the application minimize only during digitization.
oren frenkel wrote:
More important - if i set the working set to 64 MB, and allocated a 64 MB buffer and locked it, and only AFTERWARDS the user minimizes the window - does this also happen?
Yes. It would happen there too.
John
|
|
|
|
|
John - thanks for your time and effort!
Since my application has to record data in an extremely high speed from USB 2 (only graphics are the progress bar and status window) - I migh bypass the problem by running the engine on a different process (it now runs on a different thread). At the worst case - I will not enable the user to minimize the window during recording.
Thanks again,
Oren.
|
|
|
|
|
oren frenkel wrote:
I migh bypass the problem by running the engine on a different process (it now runs on a different thread).
If you run it in a service or other application that does not have a window you will not experience this problem.
John
|
|
|
|
|
Hello everybody,
I'm new to the entire world of microsoft technologies . Can anyone suggest a start up? the right book...to start my journey to Programming in windows environment VC++/COM/ATL/.NET....I know C,C++.
bye,
East
|
|
|
|
|
What do you want to use MFC or raw win32 API?
MFC:
Introduction to MFC Programming with Visual C++ by Richard M. Jones
Programming Windows With MFC by Jeff Prosise
Win32 API:
Programming Windows by Charles Petzold
COM/ATL:
Inside COM (Programming Series) by Dale Rogerson
Developer's Workshop to COM and ATL 3.0 by Andrew Troelsen
Kuphryn
|
|
|
|
|
Thanks for ur intrest...I will try to explain the problem...i happen to come across.... codes in VC++ environment with strange looking macros...concepts like dll,and others not a part of core c++....i'm not sure they are there for winAPI or vc++ concept....i'm facing all kinds of microsoft technologies as com/mfc/atl/.net all of a sudden.. ..i don't know where to start learning and how to proceed....
|
|
|
|
|
Hi,
I'm no expert on VC++ but the books I've found most usefull are 'Practical C++ 6' By Bates & Tompkins (this has some nice example to get you started and some detail too.
And 'Programming Windows with MFC' by Jeff Prosise, this is my main reference and if I could only have one book on VC++ this would be it. It gives you lots of detail and explains things really well.
(I've just thought - I am using VC++ 6 which is fairly old now, anyway they are the books I use what I use for what its worth.)
If you already know C++ then you've got a good start Good luck
Ali
|
|
|
|
|
Alison Pentland wrote:
'Programming Windows with MFC' by Jeff Prosise
I guess this has been updated since I bought my copy of Programming Windows95 with MFC.
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
Don't forget Dennis Ritchie
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Hi everyone,
In my code while debugging,
after user breakpoint is called after
this line pops up in debug output line.
I have some doubts that this may be happened
by not cleaning a _bstr_t type variable.
How do i allocate and free this type of variable?
Thank you very much.
Ugur Ozkan
|
|
|
|