haav | Дата: Четверг, 21.05.2015, 20:19 | Сообщение # 1 |
Генералиссимус
Группа: Администраторы
Сообщений: 1363
Статус: Offline
| За основу был взят вот этот код. Я воспользовался новыми возможностями FB (абстрактными методами) и реализовал более упрощенный код. Теперь в коде исчез лишний первый параметр в методах (ранее для каждого метода первым параметром всегда стоял указатель на текущий интерфейс). Более того, теперь не надо извращений с промежуточным указателем на виртуальную таблицу lpVtbl. Все таки довольно удобные возможности реализованы в FB , теперь бы еще заголовки переписали для COM с учетом абстрактных и виртуальных методов
Код #INCLUDE "window9.bi"
Enum TBPFLAG TBPF_NOPROGRESS = 0 TBPF_INDETERMINATE = 1 TBPF_NORMAL = 2 TBPF_ERROR = 4 TBPF_PAUSED = 8 End Enum
Enum THUMBBUTTONMASK THB_BITMAP = 1 THB_ICON = 2 THB_TOOLTIP = 4 THB_FLAGS = 8 End Enum
Enum THUMBBUTTONFLAGS THBF_ENABLED = 0 THBF_DISABLED = 1 THBF_DISMISSONCLICK = 2 THBF_NOBACKGROUND = 4 THBF_HIDDEN = 8 THBF_NONINTERACTIVE = 10 End Enum
Type THUMBBUTTON As THUMBBUTTONMASK dwMask As UINT iId As UINT iBitmap As HICON hIcon As WString*260 szTip As THUMBBUTTONFLAGS dwFlags End Type
Type ITaskbarList3 extends object Declare abstract Function QueryInterface (ByVal iid As REFIID, ByVal ppvObject As Any Ptr Ptr) As HRESULT Declare abstract Function AddRef () As ULong Declare abstract Function Release () As ULong Declare abstract Function HrInit () As HRESULT Declare abstract Function AddTab (a As HWND) As HRESULT Declare abstract Function DeleteTab (a As HWND) As HRESULT Declare abstract Function ActivateTab (a As HWND) As HRESULT Declare abstract Function SetActiveAlt (a As HWND) As HRESULT Declare abstract Function MarkFullscreenWindow (a As HWND,fFullscreen As BOOL) As HRESULT Declare abstract Function SetProgressValue (hwnd As HWND ,ullCompleted As Ulongint,ullTotal As Ulongint) As HRESULT Declare abstract Function SetProgressState (hwnd As HWND,tbpFlags As TBPFLAG) As HRESULT Declare abstract Function RegisterTab (hwndTab As HWND ,hwndMDI As HWND) As HRESULT Declare abstract Function UnregisterTab (hWndTab As HWND) As HRESULT Declare abstract Function SetTabOrder (hWndTab As HWND,hWndInsertBefore As HWND) As HRESULT Declare abstract Function SetTabActive (hWndTab As HWND,hWndMDI As HWND,tbatFlags As DWORD)As HRESULT Declare abstract Function ThumbBarAddButtons (hWnd As HWND,cButtons As UINT,pButton As THUMBBUTTON Ptr)As HRESULT Declare abstract Function ThumbBarUpdateButtons (hWnd As HWND,cButtons As UINT,pButton As THUMBBUTTON Ptr)As HRESULT Declare abstract Function ThumbBarSetImageList (hWnd As HWND,himl As HIMAGELIST)As HRESULT Declare abstract Function SetOverlayIcon (hWnd As HWND,hIcon As HICON,pszDescription As LPCWSTR)As HRESULT Declare abstract Function SetThumbnailTooltip (hWnd As HWND,pszTip As LPCWSTR)As HRESULT Declare abstract Function SetThumbnailClip (hWnd As HWND,prcClip As LPRECT)As HRESULT End Type
Dim Shared CLSID_TaskbarList As IID = Type(&h56FDF344, &hFD6D, &h11D0, {&h95, &h8a, &h00, &h60, &h97, &hc9, &ha0, &h90}) Dim Shared IID_ITaskbarList3 As IID = Type(&hEA1AFB91, &h9E28, &h4B86, {&h90, &hE9, &h9E, &h9F, &h8A, &h5E, &hEF, &hAF})
Dim As Integer ev, pct Dim As HWND hwnd Dim As RECT rec Dim As ITaskbarList3 Ptr tl3
hwnd = OpenWindow("", 0, 0, 300, 80)
ProgressBarGadget(1, 10,10, 260, 20, 0, 100)
CoInitialize(Null) CoCreateInstance(@CLSID_TaskBarList,Null,CLSCTX_INPROC_SERVER,@IID_ITaskBarList3,@tl3) tl3->HrInit() tl3->SetProgressValue(hwnd,0,100) tl3->SetProgressState(hwnd,TBPF_NORMAL)
GetClientRect(hwnd, @rec) rec.right /= 2 rec.bottom /= 2 tl3->SetThumbnailClip(hwnd, @rec)
Do ev = WindowEvent() If ev = 0 Then If pct = 101 Then FreeGadget(1) SetWindowText(hwnd, "Ошибка") tl3->SetProgressState(hwnd,TBPF_ERROR) Else SetWindowText(hwnd, Str(pct)) SetGadgetState(1, pct) tl3->SetProgressValue(hwnd,pct,100) pct += 1 Endif Sleep 20 Endif Sleep(1) Loop Until ev = EventClose
If tl3 Then tl3->Release() CoUninitialize() EndIf
Вы сохраняете власть над людьми покуда оставляете им что-то…Отберите у человека все, и этот человек уже будет неподвластен вам…
|
|
| |