|
Hey everybody!
How can I get the thread count of a process - like in task manager?
I have a handle to that process, but I can't find a way to get the count of the running threads.
Does anyone know how to do that?
Thanks!!!!
|
|
|
|
|
First get the process id from your handle by calling GetProcessId() . Then Iterate the process in system[^] and locate your process by matching the process id. Then you'll get the total count of threads from PROCESSENTRY32.cntThreads .
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thanks!
|
|
|
|
|
need a code returning the current path of my exe
thx
|
|
|
|
|
|
You can use _pgmptr .
Regards,
Krishnakumar
|
|
|
|
|
I have created a tree control and added few items in it.
And i have used TVN_SELCHANGED notify message as below.
But i am not able to get item names using LPNMTREEVIEW structure instead its showing junk chars.
void CMyDlg1::OnTvnSelchangingTreectrl(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<lpnmtreeview>(pNMHDR);
CString str = pNMTreeView->itemNew.pszText;
CString str1 = m_TreeCtrl.GetItemText(m_TreeCtrl.GetSelectedItem());
.....
}</lpnmtreeview>
|
|
|
|
|
According to MSDN, that is to be expected.
"The itemOld and itemNew members of the NMTREEVIEW structure are TVITEM structures that contain information about the previously selected item and the newly selected item. Only the mask, hItem, state, and lParam members of these structures are valid. The stateMask members of the TVITEM structures specified by itemOld and itemNew are undefined on input."
TVN_SELCHANGED Notification[^]
|
|
|
|
|
using
int DialogWidth = GetSystemMetrics(SM_CXSCREEN);
int DialogHeight = GetSystemMetrics(SM_CYSCREEN);
system Resolution is get but how to set System Resolution(by giving width and height) using code is there some methods?
|
|
|
|
|
To set screen resolution, you've to use ChangeDisplaySettings(). For that this[^] will help you. May need to have a look at this[^] too. And I think you can dig out better how to use them.
|
|
|
|
|
Please try with
SystemParametersInfo() with SPI_SETWORKAREA
Regards
Radhakrishnan G.
|
|
|
|
|
Hi All !
I'm running an application that spwans several processes and threads, it runs on Windows 2003 Server OS and using 8 cpu's machine(Xeon).
We are considering the use of SetProcessAffinityMask to allocate heavy processing jobs to a spcific cpu. My question therfore is this:
Using SetProcessAffinityMask, is it possible to tell the OS that I want my process to be the only one using that cpu (i.e. no other process, mine or the OS's, is allowed to run on it) ? is it possible ?
We wish to get deteministic results when system is working for long periods of time.
thanks,
Amit
|
|
|
|
|
AmitCohen222 wrote: no other process, mine or the OS's, is allowed to run on it) ? is it possible ?
I don't believe so.
You may want to use SetThreadAffinityMask to distribute threads among processors,
but there's no guarantee the system will actually use your suggestions.
Try it and test it thoroughly to see if you're actually getting any benefit -
from my experience, on XP and above, the OS thread scheduler does a pretty good
job without intervention.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
HI,
I want to pass argument for my application.My application is dialog based.so Please help me i have no idea how to do it.
Thanks
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
|
If you wish to pass command line arguments in IDE go to "Project | Properties | Debugging | Command Arguments". Here you can specify your command line arguments.
Hope this will help you.
Thanks,
Paresh.
|
|
|
|
|
But how to check the passed arguments value at the initilization of application.
Best Regard
Anubhava Dimri
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
In CWinApp::InitInstance .
Please have a look at CWinApp::m_lpCmdLine .
Hope this will serve your purpose.
Regards,
Paresh.
|
|
|
|
|
It's very helpful for me.
Very -2 Thanks
Best Regard
Anubhava Dimri
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
|
i have 1 dialog application.my dialog
application is sending some messages to other appication.i want to save these
messages into xml file and so that later it can be executed.means i neeed to implement
to create,read n write to xml file.
thanks in advance
|
|
|
|
|
|
|
Download the Microsoft XML Parser SDK and dig through the documentation. You'll probably find that using smart pointers and the DOM approach to be adequate for most scenarios.
|
|
|
|
|
Hi all,
i m draw a rectangle with this.
CRect rectrect;
CDC* pDC;
pDC->Rectangle(rectrect.left,rectrect.top,rectrect.right,rectrect.bottom);
here the sides of rectangle appears very light ,i want to make it dark.
please tell me how can i do this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|