Skip to content

Instantly share code, notes, and snippets.

@dantmnf

dantmnf/stm.c

Last active Dec 17, 2015
Embed
What would you like to do?
a small program to show the time spent from Windows startup
#define UNICODE
#include <windows.h>
#ifdef __GNUC__
#define wWinMain WinMain //MinGW does not support wWinMain
#define WINMAIN_CMDLINE_TYPE LPSTR
#else
#define WINMAIN_CMDLINE_TYPE LPWSTR
#endif
int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, WINMAIN_CMDLINE_TYPE lpCmdLine, int nCmdShow)
{
DWORD time = GetTickCount() / 1000;
WCHAR *buf = malloc(128);
wsprintf(buf, L"本次开机共用了%d秒。", time);
MessageBox(NULL, buf, L"Startup Time Monitor", MB_ICONINFORMATION);
free(buf);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment