|
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
|
|
|
|
|
it's a colon.
actually, it's a 'bitfield' specification, used to set a specific bit position for data within a struct or union.
from the MSDN:
This example defines a two-dimensional array of structures named screen.
struct
{
unsigned short icon : 8;
unsigned short color : 4;
unsigned short underline : 1;
unsigned short blink : 1;
} screen[25][80];
The array contains 2,000 elements. Each element is an individual structure containing four bit-field members: icon, color, underline, and blink. The size of each structure is two bytes.
Bit fields have the same semantics as the integer type. This means a bit field is used in expressions in exactly the same way as a variable of the same base type would be used, regardless of how many bits are in the bit field.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Thanks, Chris, and you're right it is a colon
Is there and MSDN article or knowledgbase number you can refer me too? Doing a search for bitfield specification brings up nothing we'll things I can't make sense of. Basically, I just want to see if they have an example, like:
struct Length
{
unsigned short begin:4;
unsigned short end:4;
};
Does this designate the structure to be a size of 1 byte (4 bits * 2) or is it still a 4 byte structure, in which you do a read in it will only ready the first 1 byte of data? For example, we have a binary data that looks like this:
00001111000000000000000000000000 <= 4 bytes long
we read it into our LENGTH struct is it now read as:
begin = 00001111
end = 00000000
extra bits are ignored.
or is read like this:
begin = 0000111100000000
end = 0000000000000000
Thanks for the quick answer, and I hope I'm not annoying anyone
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
an MSDN search on "bitfield struct" gives a ton of articles. but the first one that comes up for me is titled "INFO: Initializing Bitfields as Integers in C" is has some sample code.
not annoying me... i'd forgotten all about the mysterious bitfield stuff. now, thanks to your question, i have another bit (pun intended) of C trivia to impress people with.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Thanks, Chris! That sort of explained it, I'm just going to brute force the rest and add a strucutre with that information an dthen add it to watch and see what values are assigned to each member variable
Btw, did you get my email, I am definetly looking forward to a reply. I am very interested in your IMGDLL file on our website and had a couple of questions basically, what is the size of the DLL if you do a static link how much does that add to my final EXE.
Maybe you may want to post that information here so others can view it, but for someone who created non-DB applications that are not part of work you can't beat the value on that piece of software
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
ImgDLL was discontinued a while ago. It was replaced by the even-more-capable ImgSource (http://www.smalleranimals.com/isource.htm). ImgSource does much much more than ImgDLL, and is faster, more stable, easier to use, etc..
static linking to the ImgSource .LIBs adds anywhere from 30K to 700K, depending on which of the functions you pull in; simple image processing stuff gets you just a few K, TIFF support brings in over 300K, JPG is 100K or so, etc..
(sorry, didn't get your mail until late night, CP email notifications were delayed again today, i guess)
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Sorry it is ImgSource, however what is the ImgX product? I see no mention of that on your website, just on the boards, is this the one going for version 5? Sorry, but I am really interested in this product for my own personal library, and is their any licensing issues associated with this control? Is there a license fee associated with any distributed work using this control?
But basically what is the difference between ImgX and ImgSource? I don't see a reference to ImgX on your site under Products.
Thanks, and sorry about all the questions, but you're product seems very interesting
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
ImgX is a VB wrapper for ImgSource. It is a product from a company called Designer Controls. We share boards because a lot of the ImgX issues are ImgSource issues. There are links to ImgX sites from the boards and from the ImgSource home page.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Oh a VB control, I'll take a look at ImgSource then It took me a long time to totally ween myself away from VB development. Chris, let me say that if your responses here are any indication of the type of support your provide, and your pricing is that good, you may find yourself having a new customer before the end of the day But first I'm going to try it out and see if I can remeber how to make all the extern calls to DLL functions or is that LoadLib and GetProcessEntryPoint to return function pointers?? Oh, well I'll figure it out and I see that you do offer samples with the download
Thanks again Chris for all your help, now I'm going to download and evaluate the library.
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
Hello,
I am trying to implement a bar like the outlook bar and want to insert drag and drop functionality in that bar. For example if you check the outlook bar you can move the 'contacts' to the end of the list of items in the bar i.e. drag contacts at the end of the list and drop it there. Any hints on how I would go about getting this functionality. I am confused as to whether I should use the method OnBeginDrag to start the operation or OnLButtonDown(). All the items on the bar I believe would be components so how would I start a drag operation.
Please let me know.
Thank you
vg
|
|
|
|
|
I have been trying to provide some changes to a CListViewCtrl via superclassing in a WTL/ATL SDI application. The error returned during the creation of the window is "class does not exist" error (error code 1411). Below is the code sample. Any suggestions on what is missing or needed?
//////////////////////////////////////////////////////////////////////
class DCPListCtrl : public CWindowImpl<DCPListCtrl, CListViewCtrl>
{
public:
DCPListCtrl();
virtual ~DCPListCtrl();
public:
BEGIN_MSG_MAP(DCPListCtrl)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
END_MSG_MAP()
public:
LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
// DECLARE_WND_SUPERCLASS(_T("NewDCPListCtrl"), GetWndClassName())
static CWndClassInfo& GetWndClassInfo()
{
static CWndClassInfo wc = {
{
sizeof(WNDCLASSEX),
0,
StartWindowProc,
0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW+1), NULL,
_T("NewDCPListCtrl"), NULL
},
GetWndClassName() , NULL, IDC_CROSS, TRUE, 0, _T("")
};
return wc;
};
static LPCTSTR GetWndClassName() { return _T("NewDCPListCrtl"); };
};
//////////////////////////////////////////////////////////////////////
HRESULT DCPStatus::open(const HWND hWnd)
{
HRESULT hr = S_FALSE;
if (list_view) {
RECT rect;
::GetClientRect(hWnd, &rect);
HWND h = list_view->Create(hWnd, rect, DCPListCtrl::GetWndClassName(),
WS_CHILD |
WS_VISIBLE |
WS_CLIPSIBLINGS |
WS_CLIPCHILDREN |
LVS_REPORT,
WS_EX_CLIENTEDGE);
if (!h) {
UINT err = ::GetLastError();
hr = E_FAIL;
}
}
return hr;
}
|
|
|
|
|