|
Why email? Why not just do an HTTP post to a script running on your server? You could capture a lot more data in an organized manner that way. (Your script can even send a notification message to a tech support address).
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
How to find system information using MFC?
May the Lord bless thee abundantly
|
|
|
|
|
i assume, that u don't know what MFC is when ur posting such a question!
Don't try it, just do it!
|
|
|
|
|
It is a fine question, nothing wrong with it at all. There is however something wrong with the young man who wrote you such an elitist answer as above.
GetSystemMetrics is a handy group of details about your system.
It returns an integer.
The integer can be one of many, here is a couple of examples.
if(GetSystemMetrics(SM_SLOWMACHINE) == TRUE)
m_proslowfast = "this computer has a low-end (slow) processor";
or
int b = GetSystemMetrics(SM_CLEANBOOT);
if(b == 0)// Normal boot
m_strHowBooted = "Normal boot";
else if(b == 1) //Fail-safe boot
m_strHowBooted = "Fail-safe boot";
else if(b == 2)// Fail-safe with network boot
m_strHowBooted = "Fail-safe with network boot";
else
m_strHowBooted.Format("Error: int b = GetSystemMetrics(SM_CLEANBOOT) returned %d",b);
/////////////////////
SystemParametersInfo is also good, it returns a Boolean value.
BOOL SystemParametersInfo(
UINT uiAction, // system parameter to query or set
UINT uiParam, // depends on action to be taken
PVOID pvParam, // depends on action to be taken
UINT fWinIni // user profile update flag
);
You may search for both of these on this website.
Any time you do not understand, email me and we will figure it out. We all need help from time to time!
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Ez
I commend this reply. I for one am tired of the bitchy attitudes that some of these programmers have in here. Not everyone that comes to this site is a master programmer that has a hotline phone to Bill Gates. It's like they have a prickly pear stuck up their arse.
Great answer. I raise my beer and say HERE HERE!!
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Thanks Tom, I hope all is well,
Best Wishes,
Marty
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Hi,
MFC is just a wrapper for api's. Since you are calling those api's directly, your are not using MFC...
But on the other hand, your answer does what 'Chechi' desires (I think) and therefore there's absolutely nothing wrong with it
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi Bob, Well,.. yes, MFC is a wrapper and more, so if you want to use (or cover up) some C and C++ calls you may certainly do so with the Foundation Class, but why not give him the ability to go either way? The rock solid underpinning of MFC is good straight C, C++,and assembler, so I am not really sure why my answer is wrong, but if I error please correct me. I just wanted to help a fellow that seemed to ask a good question. When I need help I turn to Dennis Richie's and Paul Yao's book, and I need not worry if their answer will work, it will.
As you know every MFC app created uses C call's, they are just hidden under a ton of junk that makes them "easier to use". If I have my choice of teaching someone Doc View Arch. or stright C and and going to choose the latter. Is is easier to learn, and much faster and reliable.
Back in the day's of Lattice C we had contest's to see who could write the smallest application that did something useful like printing "Hello World" on the Screen.
In MFC I believe you can do this in less than 30kb, in C I can do it in 22 bytes.
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Hello,
BaldwinMartin wrote:
so I am not really sure why my answer is wrong
There is nothing wrong with your answer!
But I disagree with that straight C is easier to learn. It is indeed faster and more reliable (if you know how to handle C) than MFC, but Doc/View Arch is ersier to learn. Since in C you'll have to do all the error handling yourself, in MFC this is done by the 'junk'.
Besides that, I rather maintain an application of 20 classes than an application of 500 api calls. But that's up to each individual to decide.
So if size and speed don't matter, I prefer the object oriented approch.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
MFC is not an own language.. it's an extension(additional classes etc)... u get the sys info via C API, NOT MFC!!!
better check if there's nothing wrong with u!
Don't try it, just do it!
|
|
|
|
|
Hello
There seem to be a barrier, perhaps it is language, it this is the case I bow to you as your multi-language skills are much better than mine. However one thing that transends all language is when a person being is being rude just for the thrill of hurting someone. I am afraid you fall into the latter.
Your response is so far off base I don't know where to start, but allow me to speculate.
1. Your home life is unsatisfactory.
2. You are abit of a recluse.
3. Friends seem to slip away.
I say these things not to hurt, rather to help. Seek some counciling, before you are to old or too far gone to be helped. Either way leave the newbies alone, they need help not your attempt at witt.
Please when you see my responses do not reply, I have several childern I am already responsible for.
|
|
|
|
|
I have the following line of the code where I am deleting the spaces after the last char. How do I delete the spaces before the char?
string.erase (string.find_last_not_of (" ") + 1 ) ;
|
|
|
|
|
i don't know how to do so using STL, but generally, u increase the pointer to the string by one for every space at the beginning of the string(but don't forget, if the string is allocated memory, you'll have to use the original pointer to free it)!
Don't try it, just do it!
|
|
|
|
|
Use the string "replace()" function.
string.replace(sp, n, rc);
where "sp" = starting position
"n" = number of characters to replace
"rc" = the replacing character
For example, if you have:
string str = "xxxABC";
str.replace(0, 3, "");
string str = " ABC";
str.replace(0, 5, "");
William
Fortes in fide et opere!
|
|
|
|
|
How to display VC++ .NET style MessageBox using Visual C++ 6? I am using VC6. I need to display the Windows XP style MessageBox in my project. I don't know how to do it. It is easy to modify dialog box to XP style. But I couldn't figure out how to modify the MessageBox.
Please help me.
Thanks a lot
Bin
|
|
|
|
|
I am writing a scientific program that uses multiples threads to separate the GUI from the scientific simulation. I am using the CRT library so I am using the _beginthreadex() routine to start the "worker" thread. The problem is this: every once in a while (it is not reproducible, I have worked weeks on coming up with a reproducible situation but have never been successful) the _beginthreadex() routine will return NULL. When I check the error using GetLastError(), it states that there is not enough memory to run the thread. Once this error occurs, the thread cannot be started and the program must be restarted before it will successfully start the thread. When this error occurs the system is not out of memory and the program is not using much memory itself (as evidenced by the Windows task manager. This is an extremely frustrating problem for me and the other people that use this program. Has anyone had any similar experiences and can point me in the right direction for handling this problem.
Thanks,
Jay
|
|
|
|
|
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.
|
|
|
|