|
Personally, I wouldn't be happy if MFC 8 suddenly supported SOAP or had its own XML parser.
Well, I'd at least like MFC 8 to allow me to access the MSXML parser if it was installed (via IE5 and above), and to do it easily and quickly. A 'CXMLAchive' object, for example.
We don't live in the world in which there's only one all-encompassing library
I agree , a single all-encompassing library is impractical and undesireable. My point is simply that MFC is not changing, and the operating system, desktop, and 'outside world' are.
Example 1 :
I want to use MFC as the framework for an app. By default, MFC wants me to put my data in the CDocument, and I can get persistence of my document via the Serialize interface. But I want to store my data in an STL map, and write it to/from an XML file. MFC gives me no support at all for this. I have to write it all myself (or get it from CodeProject!), and I also have to 'decouple' various MFC structures (default message map handlers for 'File Open', etc) in order to insert my alternatives. Lots of extra work, plenty of scope for extra bugs. Suddenly MFC starts to look like not so much an App framework, but just a few common controls and GUI wrappers - most of which offer only basic features, and need to be extended to handle 'advanced' operations (which users now consider to be 'basic' functions). IMHO, MFC's serialization framework, the foundation of the whole CDocument persistence mechanism, is dated and inflexible, and requires far too much work to customize. It needs to keep up with changes in the way data lives in the real world, and it isn't doing that!
Example 2 :
I want to use GDI+ for my drawing code. But I can't pass any GDI+ objects to any MFC drawing functions directly, and vice versa. I have to keep track of which font handle is which, and which DC object I am using, and convert between the "wrapper" objects continously. Why can't I pass a GDI+ 'Font' object to the MFC CWnd function "SetFont" ?? MFC's drawing model is dated, and needs to be updated.
I agree that MY wish list for MFC is extensive, and if everything I've mentioned was done then MFC would be not-MFC. But that doesn't mean the MFC should not be changing at all. Any product that wants to be "an application framework" must offer features that are needed by applications!! MFC is starting to fail this on a regular basis, unless the programmer spends the time and effort to 'patch in' the missing pieces.
I use the Accusoft Image Library. It is a mature product - up to version 9 now (well, that's the latest I use, anyway). Each new version adds support for new image formats, and increases performance and flexibility. The product is mature, and growing. It remains 'current'. It added PDF support when PDF became popular, for example. That's what MFC should be doing, and it's not.
Reg : "Well, what Jesus blatantly fails to appreciate is that it's the meek who are the problem."
|
|
|
|
|
Example 1: well, I have to admit that I'm using MFC as framework, but mostly for UI. My data structures (in CDocument-derived class) are STL-based, file formats are plain text or XML. I don't have much problems with this. However, I understand that it could be made easier.
Example 2: can't comment on GDI+, have zero experience with this.
Example with Accusoft - new image formats are the equivalent of new common controls supported by MFC, right?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I have to admit I haven't seen MFC 7 yet, but from what I gather there aren't major leaps forward (please correct me if I'm wrong, I would like to know more).
What I'd like to see is greater functionality out of the whole thing, especially from a GUI point of view. Just think of all the spare time we'd have if we didn't spend it extending the MFC library
Derek Lakin.
Salamander Software Ltd.
|
|
|
|
|
Just think of all the spare time we'd have if we didn't spend it extending the MFC library
That is an excellent point. It proves that the term "maturity" often used in regards to MFC is rather relative.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
It proves that the term "maturity" often used in regards to MFC is rather relative.
[edited message]
I strongly disagree. I don't want fancy bitmapped buttons, grids, sliding windows, etc. in MFC. This is a general-purpose library and should not contain any widget that's fashionable this fall.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I don't want fancy bitmapped buttons, grids, sliding windows, etc. in MFC.
Hey, that's why I used the word *relative*. MFC's own history tells us that it has extended and improved its GUI components from version to version. Sure most of them are more of a *wrapper* around their Win32 counterparts, but consider other GUI controls that are *extended* beyond this wrapping business (such as CBitmapButton, CCheckListBox etc.). Adding more controls into the library only makes it rich and thus leaving us, the end users to spend more time to make it even richer.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
Adding more controls into the library only makes it rich and thus leaving us, the end users to spend more time to make it even richer.
The problem is that rich library becomes bloated library. Take ISAPI helper classes for example. Sure, there are users who benefit from them, but I think they are not majority.
Generally speaking, the life of library writers is not an easy one - they have to hit the bullseye and provide enough functionality within reasonably-sized package.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
The problem is that rich library becomes bloated library.
Yep, that can be an issue while redistributing the runtimes. I guess the new approach MS has taken in MFC7 by integrating it more into ATL has the potential to take a lot of load outside the runtime and make it even lighter someday.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
I have two apps that share CString information using WM_COPYDATA.. One of my apps when minimized is hidden and can only be found on the system tray.. The problem is when I try to send WM_COPYDATA to the hidden app it fails (I'm assuming its because when its hidden it doesn't have a "Window Name").. any ideas on how I can keep my app hidden yet still send the data?
Thanks,
Mike
|
|
|
|
|
The fact that the window is hidden doesn't make a difference. As long as the window exists, you can send messages to it. Are you getting an error back from WM_COPYDATA? Post some code.
--Mike--
http://home.inreach.com/mdunn/
"The Earth is doomed." -- Rupert Giles
your with and
|
|
|
|
|
You are right.. The problem isn't with the window being hidden.. I threw in some code to pop up a msg box if the console app couldn't find the app and it didn't pop the msg.. I guess the problem is.. I spawn multiple dialogs with the same name, and when I send a msg from the console to the open app's I was assuming that they would all see the msg.. I set up the apps to look for a specific variable being sent in the msg and if it matched a CString that was stored in the dialog it would take the command and do what ever.. Guess I'll have to figure out a differen approach.
Any ideas?
Mike
|
|
|
|
|
Hi.
Is there a Function like the Sleep() Fuction which do not stop the whole Application. I want only to Delay and not to Sleep..
so any ideas?
|
|
|
|
|
What do you want exactly ? If you want to delay part of the app, try putting it in a thread.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Have you tried SetTimer?
That would allow your application to continue while you waited for the timer to go off. The only requirement is that you have to have a message pump. Even if you don't have a window, you still have to pump the message queue to get SetTimer to work.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
the timer is a good idea! thanks!
|
|
|
|
|
Couldn't you just use a callback function and let the default message handling take care of everything?
SetTimer(NULL,NULL,nMyMillis,TIMERPROC);
Erik G. Poel
|
|
|
|
|
Yes, but the important point is that you still have to have some form of a message loop. Which for 99% of all applications is already there.
Sometimes people try to use SetTimer with console applications where they don't have a message loop. If you aren't aware you have to do this, it is very frustrating trying to figure out why the timer doesn't go off.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
LOL
Sometimes people try to use SetTimer with console applications where they don't have a message loop.
I know the feeling
Regardz
Colin J Davies
|
|
|
|
|
A while back I remember seeing an article or message about registry entries you can set to enable XP UI look in a 'normal' application.
Anybody remember where that was?
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
|
Ok, will look into that. Thanks.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Forum Index | FAQ | Edit Profile | Send Private | Check Private | Search | Logout
Preview your post
The following is a preview of your post. If everything looks ok then you can click 'Continue' and your post will be entered. If not then use your back button to go back and edit some more.
Subject: WBEM Query too slow
Category:
I have an application that must find out the current load on the system on a regular basis. I'm using WMI/WBEM to do this. The problem is that one of the WMI calls takes about 1/2 second to return...
This is a BIG problem.
The call that takes so long is the ExecQuery call that only happens once per calculation. The loop gets the LoadPercentage for each proecssor on the system. (I think). I need the enumerator in anycase.
Here's my code:
long CSysLoad::GetLoadPercentage()
{
// Perform the query
IEnumWbemClassObject *pEnum = 0;
try
{
// ***********************The next line takes 1/2 second
hres = pSvc->ExecQuery( language,query,/*BEM_FLAG_FORWARD_ONLY*/ 0x20,NULL,&pEnum);
}
catch (CException *e)
{
}
if(FAILED(hres))
{
CErrorInfo err;
GET_ERROR_MSG(lpMsg, hres);
err.SetError(hres,CString((LPCSTR) lpMsg ));
throw err;
return 0;
}
long lReturnValue = 0;
// Define the object interface (AND initialize it to NULL)
IWbemClassObject *pObj = 0;
ULONG uReturned = 0; // Used to check the number of objects returned
long lTotalLoad = 0;
int iProcessorCount = 0;
while(true)
{
// Check each processor, average result
hres = pEnum->Next( 0,1,&pObj,&uReturned);
if(uReturned == 0) // If no more to process, uReturned is set to 0 so we're done
break;
// Since we're not done, extract the LoadPercentage from the query result
BSTR strClassProp = SysAllocString(L"LoadPercentage");
VARIANT v;
hres = pObj->Get(strClassProp, 0, &v, 0, 0);
SysFreeString(strClassProp);
// If the property is found, convert our variant to a number.
if(!FAILED(hres))
{
/* bstr_t temp(v);
TCHAR buf[128];
_tcscpy(buf, (LPTSTR)temp);
long lResult = atoi(buf);
*/ if (v.vt = VT_I4)
{
lTotalLoad += v.iVal;
iProcessorCount++;
}
} else {
CErrorInfo err;
GET_ERROR_MSG(lpMsg, hres);
err.SetError(hres,CString((LPCSTR) lpMsg ));
throw err;
return 0;
}
VariantClear(&v);
pObj->Release();
}
// Calculate the answer
return (iProcessorCount > 0) ? lTotalLoad / iProcessorCount : 0;
// If this doesn't work, we will be running WIDE OPEN!!!
}
Thanks for the help,
Bill
|
|
|
|
|
Hi,
Here's my situation...
I have an MDI app that has one CFormView class registered.
I'd like to add a simple new CView class to my app. I've registered
default CMyView/CMyDocument classes using:
m_pMyDisplayTemplate = new CMultiDocTemplate(
IDR_DEFECTSDISPLAY,
RUNTIME_CLASS(CMyDisplayDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMyDisplayView));
AddDocTemplate(m_pMyDisplayTemplate);
This follows the original CMultiDocTemplate. So on
CWinApp::OnFileNew(), it creates a new document of the original
type. How do I bring up a prompt to ask what type of document
I want to create?
Much Thx,
t²
|
|
|
|
|
Does anyone knows how to draw polygon filled with red color and this change only pixels that are different from white ?
I know it should be some magic ROP2 Code, but which one ?
|
|
|
|
|
Ok I know this might sound stupid but I have to find out. I have recently come across code that does this:
unsigned int len:4;
What does the semicolon signify? I have not seen this type of "shortcut" using C++. I have been scouring through all the literature I have on C++ and can't find it so in taking the chance of sounding stupid I must ask this question.
What is this signifying a value? Or is it a bit designation saying use 4 bits instead of 4 bytes to represent this value? Please help I am going crazy trying to figure this out...
btw, please refrain from answer that this is a semicolon I know many of you are urged to do so <g>.
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|