Using SetProcessWorkingSetSize or EmptyWorkingSet

Everseen memory usage of a program go down as soon as it’s minimized. Well how to achieve this programmatically? Call SetProcessWorkingSetSize or EmptyWorkingSet. Usage [sourcecode language=’cpp’]SetProcessWorkingSetSize( GetCurrentProcess(), -1, -1 ); //or EmptyWorkingSet( GetCurrentProcess() );[/sourcecode] MSDN: If both dwMinimumWorkingSetSize and dwMaximumWorkingSetSize have the value -1, the function temporarily trims the working set of the specified process […]
Continue reading…

 

Opening and closing CD-Rom drive!

😀 Press the eject button buddy… Everybody knows that! Well what I meant was to do it programmatically, using windows api’s. 😉 Here is a simple function that does this… [sourcecode language=’cpp’]#pragma comment( lib, “winmm.lib” ) // Link to winmm.lib #include “mmsystem.h” // Include this file // Displays any error that has taken place void ShowMCIError( […]
Continue reading…