本文介绍了创建工具提示win32 api(Just API不是MFC)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 嘿每一个人! 我有丰富的编辑(只显示段落文字) 当我通过移动鼠标选择文本时,我想显示此选定的文本通过使用消息框屁股代码: Hey every one! I have a rich edit (only show paragraph text) When i select a text by move mouse, i want to show this selected text by using message box ass following code:case WM_KEYDOWN: if (wParam == VK_RETURN) { wchar_t *wcWordSelect = new wchar_t[200];SendMessage(hWnd, EM_GETSELTEXT, SCF_SELECTION, (LPARAM)wcWordSelect);MessageBox(NULL, wcWordSelect, L"MSG", NULL); } break ; 但是我的任务是通过使用工具提示选择显示 请帮我用工具提示显示这个文字 我知道如何为按钮,气球工具栏制作工具提示但我不知道如何做我的任务 感谢您的帮助!! But my task is show selected by using tooltipPlease help me show this text using tooltipI known how to make tooltips for button, ballon toolbar but i dont known how to do my taskThank for your help!!推荐答案 case WM_NOTIFY:{ switch (((LPNMHDR) lParam)->code) { case TTN_NEEDTEXT: { LPTOOLTIPTEXT lptttext; lptttext = (LPTOOLTIPTEXT) lParam; lptttext->hinst = g_hInst; switch(lptttext->hdr.idFrom) { case ID_BUTTON1: { lptttext->lpszText = L"Tooltip button 1"; }break; } } }}break; 这里的代码使用消息框显示所选文本(我创建了一个丰富的编辑控件的程序) And the code below here show the selected text using message box (I create a procedure for rich edit controll)LRESULT FAR PASCAL RichEditProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam){ wchar_t *wcWordSelect = new wchar_t[MAX_LENG_WORD]; switch(Message) { case WM_CHAR: //Process this message to avoid message beeps. if ((wParam == VK_RETURN) || (wParam == VK_TAB)) { //Do Something return 0; } break; case WM_RBUTTONDOWN: { SendMessage(hWnd, EM_GETSELTEXT, SCF_SELECTION, (LPARAM)wcWordSelect); MessageBox(NULL, wcWordSelect, L"MSG", NULL); CreateToolTipForRect(hWnd); } break; case WM_KEYDOWN: if (wParam == VK_RETURN) { SendMessage(hWnd, EM_GETSELTEXT, SCF_SELECTION, (LPARAM)wcWordSelect); MessageBox(NULL, wcWordSelect, L"MSG", NULL); return 0; } break ; default: break; } return CallWindowProc((WNDPROC)lpfnOldWndProc, hWnd, Message, wParam, lParam);} 我的问题是:如何使用工具提示,使用消息框显示'' wcWordSelect ''变量? 感谢您的帮助!! My QUESTION is: how can i use tooltip insted of using message box to show ''wcWordSelect'' variable?Thank for your help!! 这篇关于创建工具提示win32 api(Just API不是MFC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-11 23:32