#include<windows.h>
#include<Commctrl.h>
#include"resource.h" #pragma comment(lib,"comctl32.lib") HWND CreateToolTips(HWND hWnd1,HINSTANCE hInst,HWND DlgItem,WCHAR *szName,int n=);
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HWND hWnd=CreateDialog(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),NULL,(DLGPROC)WndProc);
ShowWindow(hWnd,nCmdShow);
MSG msg;
while (GetMessage(&msg,NULL,NULL,NULL))
{
if (msg.message==WM_KEYDOWN)
{
SendMessage(hWnd,msg.message,msg.wParam,msg.lParam);
}else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} return ;
} LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ switch (message)
{
case WM_INITDIALOG:
{
CreateToolTips(hWnd,GetModuleHandle(NULL),GetDlgItem(hWnd,IDC_BUTTON1),L"yo yo, check it out.");
}
break;
case WM_CLOSE:
PostQuitMessage();
break;
case WM_DESTROY:
PostQuitMessage();
break;
default:
return false;
}
return true;
}
/*窗口句柄 模块句柄 控件句柄 说明文字*/
HWND CreateToolTips(HWND hWnd1,HINSTANCE hInst,HWND DlgItem,WCHAR *szName,int n)
{
INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_TAB_CLASSES;// tab, tooltips
//InitCommonControlsEx可以指定初始化什么控件
InitCommonControlsEx(&icex);
//Tooltips是当鼠标停止在某一个工具元件时,界面对用户的提示
HWND hwndTip =CreateWindowEx(WS_EX_TOPMOST,TOOLTIPS_CLASS,,WS_POPUP|TTS_NOPREFIX|TTS_BALLOON,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,hWnd1,,hInst,);
//HWND hwndTip =CreateWindowEx(WS_EX_TOPMOST,TOOLTIPS_CLASS,0,TTS_ALWAYSTIP|TTS_NOPREFIX,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,hWnd1,0,hInst,0);
TOOLINFO ti={};
ti.cbSize = sizeof(TOOLINFO)-;
//TTF_IDISHWND说明不填充ti.rect
// ti.uFlags = TTF_SUBCLASS|TTF_IDISHWND;
ti.uFlags=TTF_SUBCLASS|TTF_IDISHWND|TTF_TRANSPARENT|TTF_CENTERTIP;
//ti.uFlags = TTF_SUBCLAS
//ti.rect.bottom=200;
//ti.rect.left=100;
//ti.rect.right=400;
//ti.rect.top=100;
ti.hwnd = hWnd1;
ti.hinst=hInst;
ti.uId =(UINT_PTR)DlgItem;
ti.lpszText =szName;
SendMessage(hwndTip,TTM_SETMAXTIPWIDTH,,n);
SendMessage(hwndTip,TTM_ADDTOOL,,(LPARAM)&ti);
//设置背景颜色
SendMessage(hwndTip,TTM_SETTIPBKCOLOR,RGB(,,),);
//设置字体颜色
SendMessage(hwndTip,TTM_SETTIPTEXTCOLOR,RGB(,,),);
return hwndTip;
}

Tooltips2的更多相关文章

随机推荐

  1. springMVC上传文件和文件下载

    springMVC.xml文件 <bean id="multipartResolver" class="org.springframework.web.multip ...

  2. input防抖动

    input及时搜索,输入一个字符就去处理请求数据.但是还没有输入完就开始频繁请求,进行处理 <body> <input id="put"/> </bo ...

  3. jQuery文档加载事件

    $(document).ready(handler) $().ready(handler) (this is not recommended) $(handler) 相当于: $(document). ...

  4. Python开源库的bug

    scipy 在misc的pilutil.py中def fromimage(im, flatten=0)函数中, # workaround for crash in PIL, see #1613.im. ...

  5. cf 760B.Frodo and pillows

    二分,判断条件就是最小情况(设当前k位取x)比剩余值(m-x)要小.(貌似又做麻烦了2333) #include<bits/stdc++.h> #define LL long long # ...

  6. BZOJ 4029 [HEOI2015]定价

    题解: !!!!!! 分类讨论,情况挺多 #include<iostream> #include<cstdio> #include<cstring> using n ...

  7. Swift字符串截取与Range使用

    1.String.Index String.Index表示一个位置,使用String与String.Index可以获取该位置的Character let str = "123456789&q ...

  8. [CQOI2016]K远点对(KD-Tree)

    暴力的做法应该是这样的,维护大小为k的堆,每次插入两点间距离并弹出堆顶. 然后这个做法显然是可以KD-Tree优化的,建立KD-Tree,然后如果该平面内最远点小于堆顶,则直接退出.就当做是复习很久没 ...

  9. Python 时间 time

    import time print time.strftime("%Y-%m-%d") import datetime print datetime.datetime.now() ...

  10. Cracking Digital VLSI Verification Interview 第三章

    目录 Programming Basics Basic Programming Concepts Object Oriented Programming Concepts UNIX/Linux Pro ...