예제 #1
0
파일: virgo.c 프로젝트: xiaokaixuan/virgo
static void trayicon_init(Trayicon *t)
{
	HDC hdc;
	WNDCLASS   wndclass = { 0 };
    wndclass.lpfnWndProc   = window_proc;
    wndclass.lpszClassName = TEXT("virgo_class");
	RegisterClass(&wndclass);

	t->hwnd = CreateWindow(TEXT("virgo_class"), TEXT("virgo"), 0, 0, 0, 0, 0, NULL, NULL, 0, NULL);
	t->bitmapWidth = GetSystemMetrics(SM_CXSMICON);
	t->nid.cbSize = sizeof(t->nid);
	t->nid.hWnd = t->hwnd;
	t->nid.uID = 100;
	t->nid.uFlags = NIF_ICON;
	hdc = GetDC(t->hwnd);
	t->hBitmap = CreateCompatibleBitmap(hdc, t->bitmapWidth, t->bitmapWidth);
	t->mdc = CreateCompatibleDC(hdc);
	ReleaseDC(t->hwnd, hdc);
	SetBkColor(t->mdc, RGB(0x00, 0x00, 0x00));
	SetTextColor(t->mdc, RGB(0x00, 0xFF, 0x00));
	t->hFont = CreateFont(
	               -MulDiv(11, GetDeviceCaps(t->mdc, LOGPIXELSY), 72),
	               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, TEXT("Arial")
	           );
	t->nid.hIcon = trayicon_draw(t, "1", 1);
	Shell_NotifyIcon(NIM_ADD, &t->nid);
}
예제 #2
0
파일: virgo.c 프로젝트: Ouimoi/virgo
static void trayicon_init(Trayicon *t)
{
	HDC hdc;
	t->hwnd = CreateWindowA(
		"STATIC", "virgo",
		0, 0, 0, 0, 0,
		NULL, NULL, NULL, NULL
	);
	t->bitmapWidth = GetSystemMetrics(SM_CXSMICON);
	t->nid.cbSize = sizeof(t->nid);
	t->nid.hWnd = t->hwnd;
	t->nid.uID = 100;
	t->nid.uFlags = NIF_ICON;
	hdc = GetDC(t->hwnd);
	t->hBitmap = CreateCompatibleBitmap(hdc, t->bitmapWidth, t->bitmapWidth);
	t->mdc = CreateCompatibleDC(hdc);
	ReleaseDC(t->hwnd, hdc);
	SetBkColor(t->mdc, RGB(0x00, 0x00, 0x00));
	SetTextColor(t->mdc, RGB(0x00, 0xFF, 0x00));
	t->hFont = CreateFont(
		-MulDiv(11, GetDeviceCaps(t->mdc, LOGPIXELSY), 72),
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, TEXT("Arial")
	);
	t->nid.hIcon = trayicon_draw(t, "1", 1);
	Shell_NotifyIcon(NIM_ADD, &t->nid);
}
예제 #3
0
파일: virgo.c 프로젝트: abhisheknair/virgo
static void trayicon_set(Trayicon *t, int number)
{
	char snumber[2];
	if(!(number>=0 && number<=9)) {
		return;
	}
	snumber[0] = number + '0';
	snumber[1] = '\0';
	t->nid.hIcon = trayicon_draw(t, snumber, 1);
	Shell_NotifyIcon(NIM_MODIFY, &t->nid);
}
예제 #4
0
파일: virgo.c 프로젝트: xiaokaixuan/virgo
static void trayicon_set(Trayicon *t, unsigned number)
{
	char snumber[2];
	if (number>9) {
		return;
	}
	snumber[0] = number + '0';
	snumber[1] = 0;
	DestroyIcon(t->nid.hIcon);
	t->nid.hIcon = trayicon_draw(t, snumber, 1);
	Shell_NotifyIcon(NIM_MODIFY, &t->nid);
}
예제 #5
0
파일: virgo.c 프로젝트: abhisheknair/virgo
static void trayicon_init(Trayicon *t)
{
	t->dummyHWND = CreateWindowA(
		"STATIC", "dummy",
		0, 0, 0, 0, 0,
		NULL, NULL, NULL, NULL
	);
	t->hdc = GetDC(t->dummyHWND);
	t->bitmapWidth = GetSystemMetrics(SM_CXSMICON);
	t->hBitmap = CreateCompatibleBitmap(t->hdc, t->bitmapWidth, t->bitmapWidth);
	memset(&t->nid, 0, sizeof(t->nid));
	t->nid.cbSize = sizeof(t->nid);
	t->nid.hWnd = t->dummyHWND;
	t->nid.uID = 100;
	t->nid.uFlags = NIF_ICON;
	t->nid.hIcon = trayicon_draw(t, "1", 1);
	Shell_NotifyIcon(NIM_ADD, &t->nid);
}
예제 #6
0
파일: virgo.c 프로젝트: xiaokaixuan/virgo
static LRESULT CALLBACK window_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ 
    if (uMsg == get_taskbarcreated_msg())
	{
		Virgo* v = get_set_virgo(NULL, 0);
		Trayicon* t = &v->trayicon;
		
		char snumber[2] = { 0 };
		if ((v->current+1) > 9)
		{
			return 0;
		}
		snumber[0] = (v->current+1) + '0';
		snumber[1] = 0;
		DestroyIcon(t->nid.hIcon);
		t->nid.hIcon = trayicon_draw(t, snumber, 1);
		Shell_NotifyIcon(NIM_ADD, &t->nid);
		
		return 0;
	}
	
    return DefWindowProc(hwnd, uMsg, wParam, lParam);
}