|
Cool thanks.. I just implemented it and it works great.
|
|
|
|
|
I want to write a program similar to Windows Task Manager of Win2000. I've looked over the topic Process Status Helper[Win32] in MSDN but there's no function to retrieve the status of a process. How to know a process is running, blocked or ready?
|
|
|
|
|
|
The demo app is really cool. Would you like to give me a portion of source code which access to the information of consuming CPU of each process? I'm so thankful to you if you send it to me by email. I need it for my school study. By anyway, thanks for your support.
|
|
|
|
|
Sorry, I overlooked that there is no source code
Quoc Tran wrote:
Would you like to give me a portion of source code
It's not my article, try ask the author.
Pavel
Sonork 100.15206
|
|
|
|
|
newbie here, beware
in a properties page enviroment
i am trying to send a message from the main apps window to the view to update
a function
// the views messagemap
ON_COMMAND(ID_SAVEIT, OnSaveIT)
//
afx_msg void OnSaveIT();
//
void CBuilderView::OnSaveIT()
{
AfxMessageBox("Got a OnSaveIT in View");
}
// i set the m_Wnd int he main app
// on the views construct
// this is the call i am trying from the main app
void CBuilderApp::SaveIT()
{
::SendMessage(m_Wnd, ID_SAVEIT, 0, 0);
}
i don't get the MessageBox
any helps really appreciated
thanks
shotgun
|
|
|
|
|
shotgun wrote:
::SendMessage(m_Wnd, ID_SAVEIT, 0, 0);
::SendMessage(m_Wnd, WM_COMMAND,ID_SAVEIT, 0);
Pavel
Sonork 100.15206
|
|
|
|
|
you are a good person Pavel, thankyou
ps. i had to use HWND_BROADCAST, which means i better look into my pass of the hwnd, but thank you very much
shotgun
|
|
|
|
|
If you, like me think WM_COMMAND should be left to ui, then
ON_MESSAGE(UWM_SAVEIT,OnSaveIT)
is better.
make sure to use
#define UWM_SAVEIT (WM_USER + 1) // 1 -> any number
to avoid conflicts with the standard messages.
|
|
|
|
|
Hi,
I haven't got very much experience in writing multithreaded apps and would be glad if anyone could point out a good example. What I need to do is to create a worker thread (only one) that must be able to interact with the main GUI thread - i.e. it must send notifications to it when certain conditions are met in the worker thread. When the main thread receives these notifications it will update the UI. The main thread must then be able to cancel the execution of the worker thread and query it for its state at any time.
So has anyone got any experience in writing anything similar to this?
With best regards,
Daniel
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Check out MFC sample MTRECALC.
|
|
|
|
|
Just beware thread programming is ALLWAYS harder than it seems. You must plan carefully what methods and members are to be shared by the threads.
Tip: to avoid having a gui-thread, use an event to signal thread termination.
in main thread loop, use
res = ::WaitForMultipleObjects(2,{hEventExitThread,otherEvent});
if(res == 0)
exitthread;
then use [main thread]
::SetEvent(hEventExitThread);
::WaitForSingleObject(hThread);
to make sure that the worker thread exits gracefully.
|
|
|
|
|
Dear Buddies,
I always wondering that:
1) If I want to hide the "help" button in "Customize Toolbar" dialogbox, I should response the TBN_INITCUSTOMIZE notification and return TBNRF_HIDEHELP.
However, TBNRF_HIDEHELP is never defined when compiled.
2) If I want to display a "Chevron" in a Rebar control, I should create the Rebar control with RBBS_USECHEVRON style.
Howerve, RBBS_USECHEVRON is never defined either.
Anything wrong? Is that because the version of SDK? Has the newest version SDK defined these two constans?
Thanks!
|
|
|
|
|
Hi,
a MFC DLL include ADO classes, and were loaded by MFC EXE. the debug result is following, how to fix this.
By the way, the MFC DLL has passed the compiling.
e:\hydro system\task history\night\hydrosrv\decode.h(14) : error C2504: 'CRecordset' : base class undefined
Thank u.
Extreme programming. Do the No.1
|
|
|
|
|
I call ::PeekMessage(...) to check if there's a message waiting. If there's message I call AfxGetApp()->PumpMessage() to process the message. I read that if PumpMessage() returns FALSE if a WM_QUIT message was processed and I check this return value to clean up my application. But if I close my application PumpMessage() seems not to return. Any advice?
|
|
|
|
|
why not just wait on WM_QUIT(or DESTROY) of ur mainframe? i can't think about ur case which let u use it.
if have to, create a thread while exit for cleanup.
includeh10
|
|
|
|
|
Has anyone got a code snippet for Terminating a process through using the C++ API into the WMI libraries.
I've been fumbling around, and cannot get it to ExecMethod. I've successfully created a process, and been able to query processes for a specific processid, but now I want to terminate it.
I can't find any examples in VC++.
This is kinda where I'm at.
If someone could please tell me what I'm doing wrong that'd be great.
m_pServer is connected, m_ProcessID is a valid ProcessID.
There are not a lot of examples of using WMI in VC++.
IWbemClassObject * pClass = NULL;
IWbemClassObject * pInArg = NULL;
IWbemClassObject * pInClass = NULL;
IWbemClassObject * pInMethod = NULL;
IWbemClassObject * pOutMethod = NULL;
BSTR ClassName = SysAllocString(L"Win32_Process");
BSTR MethodName = SysAllocString(L"Terminate");
BSTR ParameterName = SysAllocString(L"ProcessId");
LPCWSTR method = OLE2CW(MethodName);
VARIANT pcVal;
VariantInit(&pcVal);
V_I4(&pcVal) = m_ProcessID;
V_VT(&pcVal) = VT_I4;
hr = m_pServer->GetObject(ClassName,0, NULL, &pClass, NULL);
hr = pClass->GetMethod(method, 0, &pInMethod, &pOutMethod);
hr = pInMethod->SpawnInstance(0, &pInArg);
hr = pInArg->Put(OLE2CW(ParameterName) , 0, &pcVal, 0);
hr = m_pServer->ExecMethod(ClassName, MethodName, 0, NULL, pInArg, NULL, NULL);
|
|
|
|
|
Sorry, these two messages have been merged because of unknow reason. I don't know why...
My Programming Page
|
|
|
|
|
I am about to embark on a larger project and need to know , is there any pratical limits as to the amount of resources, memory limit or quantity, within an MFC project ?.
|
|
|
|
|
Is there any Limit for the Resources Actually..???
Mad Coding.
|
|
|
|
|
Don't know about any MFC specific limit.
You can make your project as big as you and Windows are able to manage.
Pavel
Sonork 100.15206
|
|
|
|
|
In Win32 the only limit is your physical RAM + available virtual memory. However, on Win 9x the GDI is still 16-bit internally, and if you are sloppy with GDI object usage (too many bitmaps, not deleting objects (especially DCs) when you're done with them) you can easily hit an internal 64K limit.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Yes, MFC doesn't impose any limits. The only limits are those imposed by Windows.
Dave.
|
|
|
|
|
Dear All,
Good Day... I built a program using MFC AppWizard(EXE), when i try to use the Global Object theApp in the Document Class it gives me an error Undeclared identifier.
how can i solve this.
NOTE: when i include the .CPP file that containing the decleraion it works but this is wrong i should not include a CPP file
Thank you all,
Best Regards
Mohammad Zakarni
|
|
|
|
|
theApp is defined locally in cpp file of your CWinApp derived class.
Use AfxGetApp() instead.
Pavel
Sonork 100.15206
|
|
|
|