1-26-06 - 2


So, I couldn't find a decent window sizer app that was free, so I wrote one. Use a hot key program (like Hot Key Plus ), and have it run "winmove" to control your windows. I've set it up to do left/right/center on my monitor, as well as minimize, maximize, and restore.

I also couldn't find handy code to get an argc/argv in a windows app, so I wrote a super crappy version :

char ** GetWinArgs(int * pargc)
	LPWSTR cli = GetCommandLineW();
	int argc;
	LPWSTR * argvw = CommandLineToArgvW(cli,&argc);
	*pargc = argc;

	char ** argv = (char **) malloc( sizeof(char *) * argc );

	for(int i=0;i LESS argc;i++)
		int len = wcslen(argvw[i]);
		argv[i] = (char *)malloc( sizeof(char)*(len+1) );
		for(int c=0;c LESS len;c++)
			argv[i][c] = (char) argvw[i][c];
		argv[i][len] = 0;

	return argv;

Yes, I know it leaks, and I don't give a damn. Addendum : apparently MSVC provides these things __argc and __argv in stdlib.h which are valid even for windows apps, so that's even easier.

No comments:

old rants