Is there a way to open the PerfMon with specified counters? - windows

I am trying to write a program in which when you can open up the PerfMon and it will already have a certain set of counters displaying. This set of counters can be specified by the user. I really thought this would not be an uncommon thing but I have not found anybody talking about this online.
My question is how can I tell the PerfMon which counters to show when it starts up? I considered creating my own .PerfmonCfg file but it is a binary file and I could not find any documentation on the layout of the file (didn't really expect to, either.)
*Alternatively, is there a way to add in the PerfMon into my program (.NET framework program)?
Thanks in advance!

Yes, there's an ActiveX control available for this. Right-click the Winforms toolbar, Choose Items, COM tab, tick the "System Monitor Control" item. Drag it onto your form and set its properties. The normal context menu is available as well.
The programming guide is here.

You can also do this by opening an MMC (start-->mmc.exe) and then adding a Perfmon instance to the MMC. Add whatever perfmon counters you want. You can then save the entire mmc to the desktop with a name based on your counters, like "processor utilization." Close the mmc, reboot the computer, etc. The next time you open the mmc, it will display the counters you originally added to the console.

Related

Trying to delete duplicate lines however getting "Not enough memory resources are available"

I'm trying to use emeditor to delete duplicates in a 13gb file. 1 column, just newlines of text.
However, both tools to do this in emeditor (under edit->advanced) give me the same error of "Not enough memory resources are available".
Is there another way to do this? Any alternatives? Thanks
If not using a language
I would use Notepad++ and a simple
Find (?m)^(?>(.*?\S.*)\R)(?=(?:.*\R)*?\1$)
Replace nothing
demo
Removes dups from top down, its the fastest regex way to do it.
This prompt message means that available virtual memory is very low on your computer. How much physical memory do you have on your computer? I would recommend you to increase the physical memory size in your computer if possible. If that is not possible, please try:
Clean up your computer, and make sure you have enough space available in your hard drive where temporary files reside. The temporary folder can be set in the Advanced page of the Customize dialog box.
Close all apps, disable Cortana if not used, disable any startup apps if not used, restart Windows, and run only EmEditor.
Go to Customize on the Tools menu, select Advanced, select 1 from the Number of Threads.
If the prompt message still persists, you might need to check your Windows virtual memory settings. To check virtual memory settings, search for performance in the Windows Settings search box, select Adjust the appearance and performance of Windows, click the Advanced tab, click the Change button in the Virtual memory box.
If the Automatically manage paging file size for all drives was not set, try setting this automatic option first, restart Windows, and try again.
If this doesn't work or if the automatic option was already set, then clear the automatic option, try settings the Custom Size of 40960 MB for both Initial size and Maximum size, restart Windows and try again. I hope this works.

Control_RunDLL - Open sequential window?

I don't know if this is even possible, but I thought I'd ask anyway.
I know that you can append ,,tabnumber to the end of a
rundll32.exe shell32.dll,Control_RunDLL
command to open a window on a specified tab, but is there a way to open a further window by programmatically selecting a button on that tab?
For example, I'm using
rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,4
to open Windows' Internet Properties window, but is there a way to programmatically to open the LAN Settings window from there, as LAN Settings doesn't seem to have its own process I can call directly.
(I plan to use this with things other than LAN Settings, if there is a solution, such as "Copy settings..." within the "Administrative" tab on the Region and Language window)
There is no general mechanism for this. You are better off doing whatever you need programmatically instead of trying to drive the UI (which changes from version to version). – Raymond Chen

List owner processes of open file handles in Windows?

I'm currently getting an "out of handles" error in my Event Viewer for a program.
What would be a good program to list what processes are using file handles?
An example would be 'lsof' in the *nix world.
Use processexplorer
http://technet.microsoft.com/en-us/sysinternals/bb896653
From the introduction:
The top window always shows a list of the currently active processes, including the names of their owning accounts, whereas the information displayed in the bottom window depends on the mode that Process Explorer is in: if it is in handle mode you'll see the handles that the process selected in the top window has opened
The handle mode is the one you're interested in.
For Chrome on my box I see for example:
You can also search for a handle by name.
You could use Handle tool from SysInternals.
https://technet.microsoft.com/en-us/sysinternals/bb896655.aspx
In this question on Unix SE How to get over “device or resource busy” OP mention that he use LockHunter on Windows. It's great tool, just right click on file or directory and find the process that locking it and you can delete or unlock it with single click.

How to disable cut, copy, paste, rename, etc from the Windows Registry?

I'm trying to create a software in VB.Net as my uni project to disable the following from a Windows 7 pc. I think they have to be disabled from the context menu of the Windows Registry, but instead of disabling the whole context menu, I'd like to disable the following individually.
Cut, copy, paste, rename, delete, open, print, share, create shortcut, open with, send to, new, properties.
I want to give users the option of disabling them selectively/individually via checkboxes so those options will be disabled in the right-click of a mouse.
My problem is I don't know which is the right key to disable as the registry is so huge & some keys are similiarly named.
Could anyone help me to say what are the exact key locations of the above-mentioned right-click functions in the Windows Registry or how to go about this ?
The deep flaw in the assumptions made in this question is that the context menu is configured by registry entries. It is not. Windows allows modifying a window's context menu by sending the WM_CONTEXTMENU message. Code, not config. If you are not happy with the default implementation of that message then you subclass the window procedure and provide your own message handler for that message so you can display your own context menu. This is core to the way Windows works.
Modifying the context menu of a program you didn't write is possible too but much more complicated. You use SetWindowsHookEx() to inject a DLL into the other process. You cannot write a DLL like that in VB.NET, it requires native code. Because that process won't have the CLR loaded to run your managed code.

Is there an API in Windows 7 for creating "split menu items"?

I don't know what their official name is, but I mean these things:
Is there an official API for creating those in my own program?
And related question: Did you ever see these "split menu items" used anywhere other than the start menu? Where? This could point at an API.
Glancing at my own start menu, I'm guessing that most are generated the same way "Recent Documents" used to be done. i.e., observing the files that programs open.
As for new APIs, this page might be a good place to start sniffing around: http://msdn.microsoft.com/en-us/library/ee461765%28VS.85%29.aspx
To create tasks like internet explorer etc, use ICustomDestinationList->AddUserTasks(), the recent items should show up for file types you are registered to handle (They are added by the open/save dialog or manually by calling SHAddToRecentDocs())

Resources