示例#1
0
  void get_text(TCHAR *text, size_t max_length) {
#ifndef USE_GDI
    value.copy(text, std::min(max_length - 1, value.length()));
#else
    ::GetWindowText(hWnd, text, max_length);
#endif
  }
示例#2
0
void Notification::addMessage(const tstring& title, const tstring& message, const Callback& callback, const IconPtr& balloonIcon) {
	if(!visible) {
		setVisible(true);
		onlyBalloons = true;
	}

	balloons.emplace_back(callback, balloonIcon);

	NOTIFYICONDATA nid = makeNID();
	nid.uFlags |= NIF_INFO;

	message.copy(nid.szInfo, sizeof(nid.szInfo) / sizeof(nid.szInfo[0]) - 1);

	title.copy(nid.szInfoTitle, sizeof(nid.szInfoTitle) / sizeof(nid.szInfoTitle[0]) - 1);

	if(balloonIcon && util::win32::ensureVersion(util::win32::VISTA)) {
		nid.dwInfoFlags = NIIF_USER;
		nid.hBalloonIcon = balloonIcon->handle();
	} else {
		nid.dwInfoFlags = NIIF_INFO;
	}

	::Shell_NotifyIcon(NIM_MODIFY, &nid);
}