'풍선도움말'에 해당되는 글 1건

  1. 2011.06.08 ToolTip (풍선도움말) 간단하게 구현하기 ( by Win32)

win32를 사용하여 함수 하나로 Tool Tip을 구현하는 방법


void CreateToolTipForRect(HWND hwndParent)
{

 HINSTANCE hInst = (HINSTANCE) ::GetWindowLong(hwndParent,GWL_HINSTANCE);

 INITCOMMONCONTROLSEX ic;
 ic.dwSize = sizeof(INITCOMMONCONTROLSEX);
 ic.dwICC = ICC_TAB_CLASSES;
 InitCommonControlsEx(&ic);
 // Create a ToolTip.
 HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST,
  TOOLTIPS_CLASS, NULL,
  WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,  
  CW_USEDEFAULT, CW_USEDEFAULT,
  CW_USEDEFAULT, CW_USEDEFAULT,
  hwndParent, NULL, hInst,NULL);

 SetWindowPos(hwndTT, HWND_TOPMOST,
  0, 0, 0, 0,
  SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);

 // Set up "tool" information.
 // In this case, the "tool" is the entire parent window.
 TOOLINFO ti = { 0 };
 ti.cbSize = sizeof(TOOLINFO);
 ti.uFlags = TTF_SUBCLASS;
 ti.hwnd = hwndParent;
 ti.hinst = hInst;
 ti.lpszText = TEXT("This is your ToolTip string.");;
 GetClientRect (hwndParent, &ti.rect);
 // Associate the ToolTip with the "tool" window.
 SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); 
// SendMessage(hwndTT, TTM_ACTIVATE, true, NULL);

}

Posted by 꿈을펼쳐라
,