Viktor1703
AutoIT Гуру
- Сообщения
- 1,535
- Репутация
- 413
Помогите найти структуру ToolTip'a, хочу сделать для него оформление, но пока что безрезультатно
Пример на AutoIt:
Пример на PureBasic:
Тот что на PureBasic, работает нормально, а на AutoIt перенести не могу, для примера даю exe на PureBasic'e
Пример на AutoIt:
Код:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$hForm = GUICreate("ControlProgress", 240, 50)
$hButton = GUICtrlCreateButton("Example", 20, 20, 120, 20)
GUIControlToolTip_Create($hForm, $hButton, "ToolTip")
GUISetState()
While 1
If GUIGetMsg() = -3 Then Exit
WEnd
Func GUIControlToolTip_Create($hWnd, $Handel, $Text)
Local $hModule = DllCall("kernel32.dll", "handle", "GetModuleHandleW", "ptr", 0)
If @error Then Return SetError(@error, @extended, 0)
Local $tTOOLINFO = "uint cbSize;uint uFlags;ptr hWnd;uint_ptr uId;ptr hinst;str lpszText"
Local $ToolStruct = DllStructCreate($tTOOLINFO)
DllStructSetData($ToolStruct, "Size", DllStructGetSize($ToolStruct))
DllStructSetData($ToolStruct, "uFlags", BitOR(0x00000010, 0x00000001))
DllStructSetData($ToolStruct, "hWnd", $Handel)
DllStructSetData($ToolStruct, "uId", $Handel)
DllStructSetData($ToolStruct, "hinst", $hModule[0])
DllStructSetData($ToolStruct, "lpszText", $Text)
Local $hControl = DllCall("user32.dll", "hwnd", "CreateWindowExW", "dword", $WS_EX_TOPMOST, "wstr", "Tooltips_Class32", _
"wstr", 0, "dword", BitOR(0x00000001, 0x00000002, $WS_POPUP, 0x40), "int", Default, "int", Default, _
"int", Default, "int", Default, "hwnd", $hWnd, _
"handle", 0, "handle", $hModule[0], "ptr", 0)
If @error Then Return SetError(@error, @extended, 0)
DllCall("user32.dll", "lresult", "SendMessageA", "hwnd", $hControl[0], "uint", 0x403, "wParam", 3, "lParam", 100)
DllCall("user32.dll", "lresult", "SendMessageA", "hwnd", $hControl[0], "uint", 0x413, "wParam", 0xF6C455, "lParam", 0)
DllCall("user32.dll", "lresult", "SendMessageA", "hwnd", $hControl[0], "uint", 0x414, "wParam", 0x000000, "lParam", 0)
;DllCall("user32.dll", "lresult", "SendMessageA", "hwnd", $hControl[0], "uint", $WM_SETFONT, "wParam", 0, "lParam", 1)
DllCall("user32.dll", "lresult", "SendMessageA", "hwnd", $hControl[0], "uint", 0x404, "wParam", 0, "lParam", DllStructGetPtr($ToolStruct))
EndFunc
Пример на PureBasic:
Код:
Procedure ToolTip(WindowID.l,Handle,Text.s)
ObjektBeschreibung=CreateWindowEx_(#WS_EX_TOPMOST,"Tooltips_Class32",0,#TTS_ALWAYSTIP|#TTS_NOPREFIX|#WS_POPUP|$40,#CW_USEDEFAULT,#CW_USEDEFAULT,#CW_USEDEFAULT,#CW_USEDEFAULT,WindowID,0,GetModuleHandle_(0),0)
SendMessage_(ObjektBeschreibung,#TTM_SETDELAYTIME,#TTDT_INITIAL,100)
SendMessage_(ObjektBeschreibung,$413,RGB(200,55,55),0)
SendMessage_(ObjektBeschreibung,$414,RGB(255,250,100),0)
SendMessage_(ObjektBeschreibung,#WM_SETFONT,LoadFont(0,"Arial",40),#True)
Tool.TOOLINFO
Tool\cbSize=SizeOf(TOOLINFO)
Tool\uFlags=#TTF_SUBCLASS|#TTF_IDISHWND
Tool\hwnd=Handle
Tool\uID=Handle
Tool\hInst=GetModuleHandle_(0)
Tool\lpszText=@Text
SendMessage_(ObjektBeschreibung,#TTM_ADDTOOL,0,@Tool)
EndProcedure
If OpenWindow(0,0,0,222,200,"Create ToolTip",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
ButtonGadget(0, 10, 10, 200, 20, "Standard Button")
ToolTip(WindowID(0),GadgetID(0),"ToolTip Example")
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
Тот что на PureBasic, работает нормально, а на AutoIt перенести не могу, для примера даю exe на PureBasic'e