Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    292
  • comments
    557
  • views
    154542

Calculator Launcher

Sign in to follow this  
TANSTAAFL

185 views

I made this today for a coworker. It is meant to have a properly calculator-y icon, placed into the quick launch bar, and then used to bring up the calculator.

features include:
* only brings up one instance of the calculator.
* if calculator is not running, it runs it.
* if calculator is running, and is not topmost, it'll make it topmost
* if calculator is running, and it is topmost, it'll make it non-topmost


#include 

int __stdcall WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShow)
{
HWND hWndCalc=FindWindow(NULL,TEXT("Calculator"));
if(hWndCalc)
{
if(GetWindowLong(hWndCalc,GWL_EXSTYLE)&WS_EX_TOPMOST)
{
SetWindowPos(hWndCalc,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
ShowWindow(hWndCalc,SW_RESTORE);
}
else
{
SetWindowPos(hWndCalc,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
ShowWindow(hWndCalc,SW_RESTORE);
}
}
else
{
ShellExecute(NULL,TEXT("open"),TEXT("calc.exe"),NULL,NULL,SW_SHOW);
}
return(0);
}
Sign in to follow this  


1 Comment


Recommended Comments

I got one of them Microsoft Natural Keyboard 4000's with the calculator button. I have the button set to launch XCalc, and it works about the same.

I think XCalc only runs single-instance and moves to the front when it's re-launched, so it's a bit from the keyboard driver and a bit from the calculator that's giving me that functionality.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!