Dette var hvad jeg kunne finde:
#define WINVER 0x0500
#define _WIN32_IE 0x0500
#include <windows.h>
#include <commctrl.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define TRAY_MESSAGE (WM_APP + 123)
#define IDC_BUTTON1 1001
#define IDM_TIMER 1002
HINSTANCE InstanceHandle;
void Minimize(HWND hwndDlg);
void UnMinimize(HWND hwndDlg);
void SetBaloonTip(HWND hwndDlg);
HICON HIcon;
LRESULT CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CREATE:
CreateWindow("BUTTON",
"Push Me", // Button Text
WS_CHILD | WS_VISIBLE, // Style
5, 30, 100, 30, // position
hwndDlg, // Owner
(HMENU)(IDC_BUTTON1), // ID
InstanceHandle, // The application
0);
break;
case TRAY_MESSAGE:
if(lParam == WM_LBUTTONDOWN)
{
UnMinimize(hwndDlg);
}
break;
case WM_TIMER:
KillTimer(hwndDlg, IDM_TIMER);
SetBaloonTip(hwndDlg);
break;
case WM_COMMAND:
if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BUTTON1)
{
Minimize(hwndDlg);
}
break;
}
return DefWindowProc(hwndDlg, msg, wParam, lParam);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
InitCommonControls();
InstanceHandle = hInstance;
HIcon = LoadIcon(0, IDI_WINLOGO);
WNDCLASS wc;
memset(&wc, 0, sizeof(WNDCLASS));
wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wc.lpfnWndProc = DialogProc;
wc.hInstance = InstanceHandle;
wc.hbrBackground = (HBRUSH )(COLOR_BTNFACE + 1);
wc.lpszClassName = "WhateverClass";
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
if(!RegisterClass(&wc))
return FALSE;
HWND WindowHandle = CreateWindow("WhateverClass",
"Whatever", // Caption text
WS_MINIMIZEBOX | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | WS_MAXIMIZEBOX | WS_CAPTION | WS_BORDER | WS_SYSMENU,
100, 100, 150, 100, // Position
NULL,
NULL,
InstanceHandle,
0);
MSG Msg;
while(GetMessage(&Msg, WindowHandle, 0, 0xFFFF) > 0)
{
if(!IsDialogMessage(WindowHandle, &Msg))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
return 0;
}
void SetBaloonTip(HWND hwndDlg)
{
NOTIFYICONDATA NotifyIconData;
memset(&NotifyIconData, 0, sizeof(NOTIFYICONDATA));
NotifyIconData.cbSize = sizeof(NOTIFYICONDATA);
NotifyIconData.uID = 123;
NotifyIconData.hWnd = hwndDlg;
NotifyIconData.hIcon = HIcon;
NotifyIconData.uFlags = 0x10;
NotifyIconData.uTimeout = 15000;
NotifyIconData.uCallbackMessage = TRAY_MESSAGE;
strcpy(NotifyIconData.szInfoTitle, "BaloonTitle");
strcpy(NotifyIconData.szInfo, "BalloonInfo");
strcpy(NotifyIconData.szTip, "TrayTip");
Shell_NotifyIcon(NIM_MODIFY, (NOTIFYICONDATA *)&NotifyIconData);
}
void Minimize(HWND hwndDlg)
{
NOTIFYICONDATA NotifyIconData;
ShowWindow(hwndDlg, SW_HIDE);
memset(&NotifyIconData, 0, sizeof(NotifyIconData));
NotifyIconData.cbSize = sizeof(NotifyIconData);
NotifyIconData.uID = 123;
NotifyIconData.hWnd = hwndDlg;
NotifyIconData.hIcon = HIcon;
NotifyIconData.uFlags = NIF_ICON | NIF_MESSAGE;
NotifyIconData.uCallbackMessage = WM_APP + 123;
strcpy(NotifyIconData.szTip, "TrayTip");
Shell_NotifyIcon(NIM_ADD, &NotifyIconData);
SetTimer(hwndDlg, IDM_TIMER, 2000, 0);
}
void UnMinimize(HWND hwndDlg)
{
NOTIFYICONDATA NotifyIconData;
ShowWindow(hwndDlg, SW_SHOW);
memset(&NotifyIconData, 0, sizeof(NotifyIconData));
NotifyIconData.cbSize = sizeof(NotifyIconData);
NotifyIconData.uID = 123;
NotifyIconData.hWnd = hwndDlg;
NotifyIconData.hIcon = HIcon;
NotifyIconData.uFlags = NIF_ICON | NIF_MESSAGE;
NotifyIconData.uCallbackMessage = TRAY_MESSAGE;
strcpy(NotifyIconData.szTip, "TrayTip");
Shell_NotifyIcon(NIM_DELETE, &NotifyIconData);
}