Procedure MainWindow_PanelInfo_StaticPage_MiscInfo_CB(hWnd, Msg, wParam, lParam) ; Подложка для вкладки "Общая информация". Protected *OldFunc, Result, Width.w, Height.w Protected Panel_MiscInfo.OutData_Panel_Info_MiscInfo Protected DrawThemeParentBackground.DrawThemeParentBackground = G_ProgramMiscInfo\Draw\DrawThemeParentBackground Static Old_Width.w, Old_Height.w If Msg = #WM_ERASEBKGND And G_ProgramMiscInfo\OS_Version>#PB_OS_Windows_2000 If DrawThemeParentBackground DrawThemeParentBackground(hWnd, wParam, 0) ProcedureReturn 1 EndIf EndIf If Msg = #WM_CTLCOLORSTATIC And G_ProgramMiscInfo\OS_Version>#PB_OS_Windows_2000 If lParam <> GadgetID(#MainWin_Panel_Info_MiscInfo_Accessibly) And lParam <> GadgetID(#MainWin_Panel_Info_MiscInfo_Load) ; Пропускаем ImageGadget'ы. SetBkMode_(wParam, #TRANSPARENT) ProcedureReturn G_ProgramMiscInfo\Draw\HOLLOW_BRUSH EndIf EndIf *OldFunc = GetWindowLongPtr_(hWnd,#GWL_USERDATA) Result = CallWindowProc_(*OldFunc, hWnd, Msg, wParam, lParam) If Msg = #WM_SIZE Width = lParam & $FFFF Height = (lParam >> 16) & $FFFF If Width>0 And Width<8000 And Height>0 And Height<8000 If Old_Width<>Width G_ProgramMiscInfo\Panel_Info_MiscInfo_ImageWidth = Width Old_Width=Width EndIf If Old_Height<>Height G_ProgramMiscInfo\Panel_Info_MiscInfo_ImageHeight = Height Old_Height=Height EndIf EndIf SetWindowPos_(G_ProgramMiscInfo\PanelInfo\hMiscInfo_Scroll,#HWND_TOP,0,0,Width-4, Height-58 , #SWP_NOMOVE) SetWindowPos_(GadgetID(#MainWin_Panel_Info_MiscInfo_Text_Accessibly),#HWND_TOP, Width-44, 12,0,0 , #SWP_NOSIZE) SetWindowPos_(GadgetID(#MainWin_Panel_Info_MiscInfo_Text_Load),#HWND_TOP, Width-44, 38,0,0 , #SWP_NOSIZE) RedrawWindow_(hWnd, 0, 0, #RDW_NOCHILDREN|#RDW_UPDATENOW) EndIf ProcedureReturn Result EndProcedure Procedure MainWindow_PanelInfo_StaticPage_Speed_CB(hWnd, Msg, wParam, lParam) ; Подложка для вкладки "Скорость". Protected *OldFunc Protected DrawThemeParentBackground.DrawThemeParentBackground = G_ProgramMiscInfo\Draw\DrawThemeParentBackground If G_ProgramMiscInfo\OS_Version>#PB_OS_Windows_2000 If Msg = #WM_ERASEBKGND And G_ProgramMiscInfo\OS_Version>#PB_OS_Windows_2000 If DrawThemeParentBackground DrawThemeParentBackground(hWnd, wParam, 0) ProcedureReturn 1 EndIf EndIf If Msg = #WM_CTLCOLORSTATIC SetBkMode_(wParam, #TRANSPARENT) ProcedureReturn G_ProgramMiscInfo\Draw\HOLLOW_BRUSH EndIf EndIf If Msg = #WM_SIZE Width = lParam & $FFFF Height = (lParam >> 16) & $FFFF If Width>0 And Width<8000 And Height>0 And Height<8000 G_ProgramMiscInfo\Panel_Info_MiscInfo_ImageWidth = Width G_ProgramMiscInfo\Panel_Info_MiscInfo_ImageHeight = Height EndIf RedrawWindow_(hWnd, 0, 0, #RDW_ALLCHILDREN|#RDW_UPDATENOW) ElseIf Msg = #WM_COMMAND If wParam&$FFFF = #MainWin_Panel_Info_Speed_CoboBox_SelectTime If (wParam>>16)&$FFFF = 1 G_ProgramMiscInfo\Setting\Speed_CoboBoxState = GetGadgetState(#MainWin_Panel_Info_Speed_CoboBox_SelectTime) SignalSemaphore(G_ProgramMiscInfo\Panel_Info_Semaphore) EndIf EndIf PostMessage_(WindowID(#MainWin), #WM_COMMAND, wParam, lParam) EndIf *OldFunc = GetWindowLongPtr_(hWnd,#GWL_USERDATA) ProcedureReturn CallWindowProc_(*OldFunc, hWnd, Msg, wParam, lParam) EndProcedure Procedure Set_ForegroundWindow(hWnd) ; Установка форуса для окна If GetWindowLong_(hWnd, #GWL_STYLE) & #WS_MINIMIZE ShowWindow_(hWnd, #SW_RESTORE) UpdateWindow_(hWnd) EndIf foregroundThreadID = GetWindowThreadProcessId_(GetForegroundWindow_(), 0) ourThreadID = GetCurrentThreadId_() If (foregroundThreadID <> ourThreadID) AttachThreadInput_(foregroundThreadID, ourThreadID, #True); EndIf SetForegroundWindow_(hWnd) If (foregroundThreadID <> ourThreadID) AttachThreadInput_(foregroundThreadID, ourThreadID, #False) EndIf InvalidateRect_(hWnd, #Null, #True) EndProcedure Procedure DrawProgressBar_ListIconGadget(*LVCDHeader.NMLVCUSTOMDRAW) Protected rc.RECT, Text.RECT, x.f, Right;, z, i Protected hMemoryDC, hMemoryDC_1, hBitmap, hBitmap_1 Protected Gadget, Progress.w, String.s, brush, WHITE_BRUSH Protected TableUpdate.a Static UpdState.a TableUpdate=#False rc\left=#LVIR_BOUNDS : rc\top=*LVCDHeader\iSubItem SendMessage_(*LVCDHeader\nmcd\hdr\hwndfrom,#LVM_GETSUBITEMRECT,*LVCDHeader\nmcd\dwItemSpec,@rc) If TryLockMutex(G_TorrentList\Mutex_Table) If *LVCDHeader\nmcd\dwItemSpec < ListSize(G_TorrentList\Table()) SelectElement(G_TorrentList\Table(), *LVCDHeader\nmcd\dwItemSpec) Progress = G_TorrentList\Table()\Percent If Progress<>G_TorrentList\Table()\Old_Percent G_TorrentList\Table()\Old_Percent=Progress TableUpdate=#True EndIf Else Progress = 0 EndIf UnlockMutex(G_TorrentList\Mutex_Table) UpdState=#False Else Progress = 0 If UpdState=#False PostMessage_(*LVCDHeader\nmcd\hdr\hwndfrom, #LVM_UPDATE, *LVCDHeader\nmcd\dwItemSpec, 0) ; Обновить строку при неудачной попытке захвата мьютекса. UpdState=#True EndIf ProcedureReturn 0 EndIf rc\left+1 rc\top + 1 : rc\bottom-2 If rc\left < rc\right Right = rc\right brush = G_ProgramMiscInfo\Draw\Brush_ProgressBar_TableTorrent ;CreateSolidBrush_($48864D) If brush x=Progress/(1000/(rc\right-rc\left)) If rc\right>rc\left+x rc\right=rc\left+x Else x=rc\right-rc\left EndIf FillRect_(*LVCDHeader\nmcd\hdc,@rc,brush) rc\right = Right hMemoryDC = CreateCompatibleDC_(*LVCDHeader\nmcd\hdc) If hMemoryDC hMemoryDC_1 = CreateCompatibleDC_(*LVCDHeader\nmcd\hdc) If hMemoryDC_1 hBitmap_1 = CreateCompatibleBitmap_(*LVCDHeader\nmcd\hdc, rc\right-rc\left, rc\bottom-rc\top) If hBitmap_1 Text\left = 0 : Text\top = 0 Text\right = rc\right-rc\left : Text\bottom = rc\bottom-rc\top SelectObject_(hMemoryDC_1, hBitmap_1) WHITE_BRUSH = CreateSolidBrush_($FFFFFF) If WHITE_BRUSH FillRect_(hMemoryDC_1,@Text,WHITE_BRUSH) DeleteObject_(WHITE_BRUSH) EndIf BitBlt_(hMemoryDC_1, Text\left, Text\top, Text\right-Text\left, Text\bottom-Text\top, *LVCDHeader\nmcd\hdc, rc\left,rc\top, #SRCINVERT) Text\right = Text\left+x FillRect_(hMemoryDC_1,@Text,brush) hBitmap = CreateBitmap_(rc\right-rc\left,rc\bottom-rc\top,1,1,0) If hBitmap SelectObject_(hMemoryDC, hBitmap) SelectObject_(hMemoryDC, G_ProgramMiscInfo\FontDefault) SetTextColor_(hMemoryDC, $FFFFFF) SetBkColor_(hMemoryDC, $0) String.s = StrF(Progress/10, 1)+" %" Text\right = rc\right-rc\left DrawText_(hMemoryDC, String, Len(String), @Text, #DT_SINGLELINE|#DT_CENTER|#DT_VCENTER) MaskBlt_(hMemoryDC_1, Text\left, Text\top, Text\right-Text\left, Text\bottom-Text\top, hMemoryDC,0, 0, hBitmap, 0, 0 ,#SRCINVERT) BitBlt_(*LVCDHeader\nmcd\hdc, rc\left, rc\top, rc\right-rc\left, rc\bottom-rc\top, hMemoryDC_1, 0,0, #SRCERASE| #SRCINVERT) ; #SRCINVERT DeleteObject_(hBitmap) If TableUpdate=#True rc\left=#LVIR_BOUNDS rc\top=*LVCDHeader\iSubItem SendMessage_(*LVCDHeader\nmcd\hdr\hwndfrom,#LVM_GETSUBITEMRECT,*LVCDHeader\nmcd\dwItemSpec,@rc) InvalidateRect_(*LVCDHeader\nmcd\hdr\hwndfrom, @rc, #True) EndIf EndIf DeleteObject_(hBitmap_1) EndIf DeleteDC_(hMemoryDC_1) EndIf DeleteDC_(hMemoryDC) EndIf EndIf EndIf EndProcedure Procedure.a DrawListIcon_Files_MapPiece(*mem, NumberPiece) Protected Result.a, Temp.a, Index Result = 0 Index = Int(NumberPiece/8) If Index>=0 Temp = PeekA(*mem+Index) Index = NumberPiece % 8 If Index>0 And Index<8 Temp >> Index EndIf Result = Temp & 1 EndIf ProcedureReturn Result EndProcedure Procedure DrawListIcon_Files(*LVCDHeader.NMLVCUSTOMDRAW) Protected rc.RECT, Result, Gadget, MemSize Protected *Point, *TempP, CountPiece, Brush Protected Pen, OldPen, OldROP2, PointPen.POINT Protected ImW, x, TempL.l, CountF.f Protected TempF.f, Pos.f, UpdateR.RECT, Draw.RECT Static UpdState.a Result = 0 : *Point=0 : MemSize=0 rc\left=#LVIR_BOUNDS : rc\top=*LVCDHeader\iSubItem SendMessage_(*LVCDHeader\nmcd\hdr\hwndfrom,#LVM_GETSUBITEMRECT,*LVCDHeader\nmcd\dwItemSpec,@rc) CopyStructure(rc, UpdateR, RECT) Draw\top = rc\top+1 Draw\bottom = rc\bottom-2 If rc\left < rc\right If TryLockMutex(G_ProgramMiscInfo\ListIcon_Files_Mutex) *TempP = GetGadgetItemData(#MainWin_Panel_Info_ListIcon_Files, *LVCDHeader\nmcd\dwItemSpec) If *TempP CountPiece = PeekL(*TempP) MemSize = CountPiece/8+1 If MemSize>=0 And MemSize<1000000 *Point = AllocateMemory(MemSize+4) If *Point CopyMemory(*TempP+4, *Point, MemSize) EndIf Else MemSize=0 EndIf EndIf UnlockMutex(G_ProgramMiscInfo\ListIcon_Files_Mutex) If *Point If MemSize>0 Pen = G_ProgramMiscInfo\Draw\Pen_MapPiece ; CreatePen_(#PS_SOLID,1,$48864D) Brush=G_ProgramMiscInfo\Draw\Brush_MapPiece If Pen And Brush OldPen=SelectObject_(*LVCDHeader\nmcd\hdc, Pen) OldROP2 = SetROP2_(*LVCDHeader\nmcd\hdc,#R2_COPYPEN) rc\left+1 rc\top + 1 : rc\bottom-2 ImW = rc\right-rc\left ; -2 If CountPiece>= ImW; Число частей равно или больше размера рисунка. TempL = 0 TempF = ImW/CountPiece CountF = 0 For i=1 To ImW x = 0 Repeat If TempL>CountPiece Break 2 EndIf CountF+TempF If TempL<=CountPiece If DrawListIcon_Files_MapPiece(*Point, TempL)=0 x = 1 EndIf Else x=1 EndIf TempL + 1 Until CountF>=i If x=0 MoveToEx_(*LVCDHeader\nmcd\hdc, i+rc\left, rc\top, @PointPen) LineTo_(*LVCDHeader\nmcd\hdc, i+rc\left, rc\bottom) EndIf Next i Else ; Число частей меньше размера рисунка. If CountPiece>0 TempF = (ImW)/CountPiece Pos = 0 : TempL=0 h=Round(TempF, #PB_Round_Down);#PB_Round_Up While TempL<=CountPiece ;And Pos+TempF<=ImW If Pos+TempF>ImW TempF=ImW-Pos h=Round(TempF, #PB_Round_Down) If TempF<=0 Break EndIf EndIf If DrawListIcon_Files_MapPiece(*Point, TempL)<>0 x=rc\left+Round(Pos, #PB_Round_Down) ;#PB_Round_Up Draw\right = x+h+1 Draw\left = x FillRect_(*LVCDHeader\nmcd\hdc, @Draw, Brush) EndIf Pos+TempF TempL + 1 Wend EndIf EndIf SetROP2_(*LVCDHeader\nmcd\hdc,OldROP2) SelectObject_(*LVCDHeader\nmcd\hdc, OldPen) ;DeleteObject_(Pen) Result = #CDRF_SKIPDEFAULT EndIf EndIf FreeMemory(*Point) EndIf UpdState=#False Else If UpdState=#False InvalidateRect_(*LVCDHeader\nmcd\hdr\hwndfrom, UpdateR, #False) UpdState=#True EndIf EndIf EndIf ProcedureReturn Result EndProcedure Procedure DrawListIcon_Piece(*LVCDHeader.NMLVCUSTOMDRAW) Protected rc.RECT, Result, Gadget, MemSize Protected *Point, *TempP Protected ImW, x, TempL.l, CountF.f Protected TempF.f, Pos.f, UpdateR.RECT, Draw.RECT Protected Byte.a, i, h Protected Brush_Full_Piece.i, Brush_Piece.i, Brush.i Static UpdState.a Result = 0 : *Point=0 : MemSize=0 rc\left=#LVIR_BOUNDS : rc\top=*LVCDHeader\iSubItem SendMessage_(*LVCDHeader\nmcd\hdr\hwndfrom,#LVM_GETSUBITEMRECT,*LVCDHeader\nmcd\dwItemSpec,@rc) CopyStructure(rc, UpdateR, RECT) Draw\top = rc\top+1 Draw\bottom = rc\bottom-2 If rc\left < rc\right If TryLockMutex(G_ProgramMiscInfo\ListIcon_Piece_Mutex) *TempP = GetGadgetItemData(#MainWin_Panel_Info_ListIcon_Piece, *LVCDHeader\nmcd\dwItemSpec) If *TempP MemSize = PeekL(*TempP) If MemSize>=0 And MemSize<1000000 *Point = AllocateMemory(MemSize+4) If *Point CopyMemory(*TempP+4, *Point, MemSize) EndIf Else MemSize=0 EndIf EndIf UnlockMutex(G_ProgramMiscInfo\ListIcon_Piece_Mutex) If *Point If MemSize>0 Brush_Piece = G_ProgramMiscInfo\Draw\Brush_Piece Brush_Full_Piece = G_ProgramMiscInfo\Draw\Brush_Full_Piece If Brush_Full_Piece And Brush_Piece rc\left+1 rc\top + 1 : rc\bottom-2 ImW = rc\right-rc\left ; -2 If MemSize>= ImW; Число частей равно или больше размера рисунка. TempL = 0 TempF = ImW/MemSize CountF = 0 For i=1 To ImW x = 3 Repeat If TempL>MemSize Break 2 EndIf CountF+TempF If TempL<=MemSize Byte=PeekA(*Point+TempL) If Byte>=0 And Byte=<2 If Byte=i If x=1 Or x=2 h=i+rc\left Draw\right = h+1 Draw\left = h If x=1 Brush=Brush_Piece Else Brush=Brush_Full_Piece EndIf FillRect_(*LVCDHeader\nmcd\hdc, @Draw, Brush) EndIf Next i Else ; Число частей меньше размера рисунка. If MemSize>0 TempF = ImW/MemSize Pos = 0 : TempL=0 h=Round(TempF, #PB_Round_Down) While TempL<=MemSize If Pos+TempF>ImW TempF=ImW-Pos h=Round(TempF, #PB_Round_Down) If TempF<=0 Break EndIf EndIf Byte=PeekA(*Point+TempL) If Byte=1 Or Byte=2 x=rc\left+Round(Pos, #PB_Round_Down) Draw\right = x+h+1 Draw\left = x If Byte=1 Brush=Brush_Piece Else Brush=Brush_Full_Piece EndIf FillRect_(*LVCDHeader\nmcd\hdc, @Draw, Brush) EndIf Pos+TempF TempL + 1 Wend EndIf EndIf Result = #CDRF_SKIPDEFAULT EndIf EndIf FreeMemory(*Point) EndIf UpdState=#False Else If UpdState=#False InvalidateRect_(*LVCDHeader\nmcd\hdr\hwndfrom, UpdateR, #False) ; Обновить строку при неудачной попытке захвата мьютекса. UpdState=#True EndIf EndIf EndIf ProcedureReturn Result EndProcedure Procedure MainWin_All_ListIcon_CB(hWnd, Msg, wParam, lParam) Protected Result, *Func Protected Cursor.POINT, Handle *Func = GetWindowLongPtr_(hWnd,#GWL_USERDATA) If *Func = 0 ProcedureReturn 0 EndIf If Msg=#WM_MOUSEWHEEL GetCursorPos_(Cursor) Handle = WindowFromPoint_(Cursor\X|(Cursor\Y<<32)) If Handle<>hWnd Result = 0 Else Result = CallWindowProc_(*Func, hWnd, Msg, wParam, lParam) EndIf Else Result = CallWindowProc_(*Func, hWnd, Msg, wParam, lParam) EndIf ProcedureReturn Result EndProcedure Procedure Copy_Label(List Label.s()) ; Создание списка уникальных меток торрентов. Protected String.s, x.a ClearList(Label()) If Test_LockMutex(G_TorrentList\Mutex, 800)=#True ; Получение меток торрентов. If ListSize(G_TorrentList\TorrentList())>0 ForEach G_TorrentList\TorrentList() String = G_TorrentList\TorrentList()\Label If String<>"" x=0 ForEach Label() If Label() = String x=1 Break EndIf Next If x = 0 If AddElement(Label()) Label() = String EndIf EndIf EndIf Next EndIf UnlockMutex(G_TorrentList\Mutex) EndIf EndProcedure Procedure MainWin_CreateTable_PopupMenu(Full.a, Pos) Protected bold.MENUITEMINFO, NewList Label.s() Protected Temp, i, CurrentLabel.s If Pos>=0 If IsMenu(#TorrentPopupMemu) FreeMenu(#TorrentPopupMemu) EndIf If CreatePopupMenu(#TorrentPopupMemu) If Full = #True MenuItem(#TorrentPopupMemu_OpenDirTorrent,"Открыть папку торрента") MenuBar() MenuItem(#MainMenu_Torrent_Start,"Запустить") MenuItem(#MainMenu_Torrent_Pause,"Пауза") MenuItem(#MainMenu_Torrent_Stop,"Стоп") MenuBar() OpenSubMenu("Метка") EndIf MenuItem(#TorrentPopupMemu_Label_New, "Новая метка") bold\cbSize=SizeOf(bold) bold\fMask=#MIIM_STATE bold\fState=#MFS_DEFAULT SetMenuItemInfo_(MenuID(#TorrentPopupMemu), #TorrentPopupMemu_Label_New, #False, @bold) MenuItem(#TorrentPopupMemu_Label_Del, "Удалить метку") Copy_Label(Label()) ; Создание списка уникальных меток торрентов. If ListSize(Label())>0 MenuBar() If Test_LockMutex(G_TorrentList\Mutex, 400)=#True SelectElement(G_TorrentList\TorrentList(), Pos) CurrentLabel = G_TorrentList\TorrentList()\Label UnlockMutex(G_TorrentList\Mutex) EndIf If CurrentLabel="" Temp = 1 Else Temp = 0 EndIf i=0 ForEach Label() MenuItem(#TorrentPopupMemu_Label_xx+i, Label()) If Temp = 0 If CurrentLabel = Label() Temp = 1 SetMenuItemState(#TorrentPopupMemu, #TorrentPopupMemu_Label_xx+i, 1) EndIf EndIf i + 1 If i>=50-1 Break EndIf Next EndIf If Full = #True CloseSubMenu() MenuBar() MenuItem(#MainMenu_DeleteTorrent,"Удалить торрент из списка") MenuItem(#TorrentPopupMemu_DeleteTorrent_And_Files,"Удалить торрент и файлы") MenuBar() MenuItem(#TorrentPopupMemu_Refresh_Torrent,"Обновить трекер") EndIf EndIf EndIf EndProcedure Declare Open_LoadTorrent_Win(*x) : Declare TabControl_CHANGE(lParam, *PanelInfo.TabControl_Info) Procedure MainWin_Callbackproc(hWnd, uMsg, wParam, lParam) Protected Result, String.s Protected *pnmh.NMHDR, *LVCDHeader.NMLVCUSTOMDRAW Protected Count, i, *File.String Protected *lvd.LV_DISPINFO, *lpnmitem.NMITEMACTIVATE Static ListEditItem_Text.s result = #PB_ProcessPureBasicEvents Select uMsg Case #WM_NOTIFY *pnmh.NMHDR = lParam If *pnmh\code = #TCN_SELCHANGE Or *pnmh\code = #TCN_SELCHANGING If *pnmh\hwndFrom = G_ProgramMiscInfo\PanelInfo\hPanel TabControl_CHANGE(lParam, @G_ProgramMiscInfo\PanelInfo) EndIf EndIf If *pnmh\hwndFrom = G_ProgramMiscInfo\hHeader_TorrentListIcon ; Событие в заголовке ListIconGadget - списка всех торрентов. If *pnmh\code = #HDN_BEGINDRAG ; Перетаскивание колонки (HeaderDragDrop). If GetWindowLongPtr_(G_ProgramMiscInfo\hTorrentListIcon,#GWL_STYLE)&#LVS_EDITLABELS ; В списке разрешено редактирование. SetWindowLongPtr_(G_ProgramMiscInfo\hTorrentListIcon,#GWL_STYLE, GetWindowLongPtr_(G_ProgramMiscInfo\hTorrentListIcon,#GWL_STYLE)&~#LVS_EDITLABELS) ; Запрещаем редактирование. EndIf EndIf ElseIf *pnmh\hwndFrom = G_ProgramMiscInfo\hTorrentListIcon Or *pnmh\hwndFrom = G_ProgramMiscInfo\PanelInfo\Page_hWnd[3] Or *pnmh\hwndFrom = G_ProgramMiscInfo\PanelInfo\Page_hWnd[4] ; Событие ListIconGadget - списке всех торрентов. Select *pnmh\code Case #NM_CUSTOMDRAW *LVCDHeader.NMLVCUSTOMDRAW = lParam Select *LVCDHeader\nmcd\dwDrawStage Case #CDDS_PREPAINT Result = #CDRF_NOTIFYITEMDRAW Case #CDDS_ITEMPREPAINT Result = #CDRF_NOTIFYSUBITEMDRAW Case #CDDS_SUBITEMPREPAINT If *pnmh\hwndFrom = G_ProgramMiscInfo\hTorrentListIcon If *LVCDHeader\nmcd\dwItemSpec>=0 And *LVCDHeader\iSubItem = #MainWin_ListIcon_Torrent_Progress DrawProgressBar_ListIconGadget(lParam) Result = #CDRF_SKIPDEFAULT Else Result = #CDRF_DODEFAULT EndIf ElseIf *pnmh\hwndFrom = G_ProgramMiscInfo\PanelInfo\Page_hWnd[3] If *LVCDHeader\nmcd\dwItemSpec>=0 And *LVCDHeader\iSubItem = #MainWin_Panel_Info_ListIcon_Files_Piece ; "Части" (Графическая полоса прогресса). Result = DrawListIcon_Files(lParam) Else Result = #CDRF_DODEFAULT EndIf ElseIf *pnmh\hwndFrom = G_ProgramMiscInfo\PanelInfo\Page_hWnd[4] If *LVCDHeader\nmcd\dwItemSpec>=0 And *LVCDHeader\iSubItem = #MainWin_Panel_Info_ListIcon_Piece_ProgressBar ; "Состояние загрузки блоков" (Графическая полоса прогресса). Result = DrawListIcon_Piece(lParam) Else Result = #CDRF_DODEFAULT EndIf EndIf EndSelect Case #LVN_BEGINLABELEDIT ListEditItem_Text = GetGadgetItemText(*pnmh\idFrom, G_ProgramMiscInfo\List_Torrent_Pos, 0) Case #LVN_ENDLABELEDIT *lvd = lParam If *lvd\item\pszText String = PeekS(*lvd\item\pszText) If String And ListEditItem_Text<>String SetGadgetItemText(*pnmh\idFrom, G_ProgramMiscInfo\List_Torrent_Pos, String, 0) If Test_LockMutex(G_TorrentList\Mutex, 800)=#True SelectElement(G_TorrentList\TorrentList(), G_ProgramMiscInfo\List_Torrent_Pos) G_TorrentList\TorrentList()\TorrentName = String UnlockMutex(G_TorrentList\Mutex) EndIf SaveTorrentData() EndIf EndIf ListEditItem_Text="" SetWindowLongPtr_(GadgetID(*pnmh\idFrom),#GWL_STYLE, GetWindowLongPtr_(GadgetID(*pnmh\idFrom),#GWL_STYLE)&~#LVS_EDITLABELS) Case #NM_DBLCLK, #NM_RCLICK ; Клик по таблице *lpnmitem.NMITEMACTIVATE = lParam If *lpnmitem\iItem >= 0 If *pnmh\code = #NM_DBLCLK If *lpnmitem\iSubItem = #MainWin_ListIcon_Torrent_Label ; Область метки торрента. Window_LabelTorrent() EndIf ElseIf *pnmh\code = #NM_RCLICK If *lpnmitem\iSubItem = #MainWin_ListIcon_Torrent_Label MainWin_CreateTable_PopupMenu(#False, *lpnmitem\iItem) Else MainWin_CreateTable_PopupMenu(#True, *lpnmitem\iItem) EndIf EndIf EndIf EndSelect EndIf Case #WM_QUERYENDSESSION ; Выключается компьютер. HideWindow(#MainWin, 1) End_Program() Result = 1 Case #MY_MESSAGE If wParam = $A8F24028 And lParam String = PeekS(lParam) If FindString(String, #ProgName+Chr(9), 1) = 1 HideWindow(#MainWin, 0) G_ProgramMiscInfo\Setting\MainWinVisible = #True Set_ForegroundWindow(hWnd) String = Mid(String, Len(#ProgName+Chr(9))+1) If String<>"" If Right(String,1)<>Chr(10) : String+Chr(10) : EndIf Count = CountString(String, Chr(10)) For i=1 To Count *File = AllocateMemory(SizeOf(String)) If *File InitializeStructure(*File, String) *File\s = StringField(String, i, Chr(10)) If FileSize(*File\s)>0 x=CreateThread(@Open_LoadTorrent_Win(), *File) If x ThreadPriority(x, 8) Else ClearStructure(*File, String) FreeMemory(*File) EndIf ;Delay(200) EndIf EndIf Next i EndIf Result = wParam-10 EndIf ElseIf wParam = $22F24028 And lParam>=0 And lParam<=1000 Result = $22F24028 + lParam-10 EndIf Case 12501 ; Отпустили правкую кнопку в значке в трее. If wParam=#SysTrayID Select lParam Case #WM_RBUTTONUP ;517 SetForegroundWindow_(hWnd) DisplayPopupMenu(#TrayMenu, hWnd) Case #NIN_BALLOONSHOW ; Подсказака отобразилась. G_ProgramMiscInfo\TrayInfo\Balloon_Visible = #True Case #NIN_BALLOONTIMEOUT, #NIN_BALLOONUSERCLICK, #NIN_BALLOONHIDE ; Подсказка исчезла. G_ProgramMiscInfo\TrayInfo\Balloon_Visible = #False G_ProgramMiscInfo\TrayInfo\Balloon_Old_Visible = #False EndSelect EndIf EndSelect ProcedureReturn Result EndProcedure Procedure UpdateProgress(Gadget, Item, Column, Progress) Protected rc.RECT SetGadgetItemData(Gadget, Item, Progress) rc\left=#LVIR_BOUNDS rc\top=Column SendMessage_(GadgetID(Gadget),#LVM_GETSUBITEMRECT,Item,@rc) InvalidateRect_(GadgetID(Gadget), @rc, #True) EndProcedure Procedure Systabcontrol32_CB(hWnd, Msg, wParam, lParam) Protected *PanelInfo.TabControl_Info, Result Protected r.RECT, SizeR.RECT, PaintR.RECT Protected wdc, mdc, bmp Protected oldBmp, i Protected *pnmh.NMHDR, *LVCDHeader.NMLVCUSTOMDRAW *PanelInfo = GetWindowLongPtr_(hWnd,#GWL_USERDATA) If *PanelInfo = 0 ProcedureReturn 0 EndIf If Msg = #WM_COMMAND Result = SendMessage_(WindowID(#MainWin), #WM_COMMAND, wParam, lParam) ElseIf Msg = #WM_PAINT SendMessage_(hWnd, #TCM_ADJUSTRECT, 0, @r.RECT) GetClientRect_(hWnd, @SizeR.RECT) PaintR.RECT PaintR\left = SizeR\left PaintR\top = SizeR\top PaintR\right = SizeR\right PaintR\bottom = r\top ValidateRect_(hWnd, @PaintR) If wParam = 0 hDC=GetDC_(hWnd) Else hDC = wParam EndIf If hDC wdc = hDC mdc = CreateCompatibleDC_(wdc) bmp = CreateCompatibleBitmap_(wdc, SizeR\right - SizeR\left, r\top) oldBmp = SelectObject_(mdc, bmp) CallWindowProc_(*PanelInfo\OldFunc, hWnd, #WM_ERASEBKGND, mdc, 0) CallWindowProc_(*PanelInfo\OldFunc, hWnd, #WM_PAINT, mdc, 0) BitBlt_(wdc, 0, 0, SizeR\right, r\top, mdc, 0, 0, #SRCCOPY) SelectObject_(mdc, oldBmp) DeleteObject_(bmp) DeleteDC_(mdc) If wParam = 0 ReleaseDC_(hWnd, hDC) EndIf EndIf Result = CallWindowProc_(*PanelInfo\OldFunc, hWnd, Msg, wParam, lParam) ElseIf Msg = #WM_CTLCOLORSTATIC And (lParam = *PanelInfo\Page_hWnd[0] Or lParam = *PanelInfo\Page_hWnd[5]) And G_ProgramMiscInfo\OS_Version>#PB_OS_Windows_2000 SetBkMode_(wParam, #TRANSPARENT) Result = G_ProgramMiscInfo\Draw\HOLLOW_BRUSH ElseIf Msg = #WM_SIZE Result = CallWindowProc_(*PanelInfo\OldFunc, hWnd, Msg, wParam, lParam) SendMessage_(*PanelInfo\hPanel, #TCM_ADJUSTRECT, 0, @r) GetClientRect_(*PanelInfo\hPanel, @SizeR) SizeR\left + r\left/2 SizeR\top + r\top SizeR\right - r\left-r\left/2 SizeR\bottom + r\bottom-r\top i=SendMessage_(*PanelInfo\hPanel, #TCM_GETCURSEL, 0, 0) SetWindowPos_(*PanelInfo\Page_hWnd[i],#HWND_BOTTOM,SizeR\left,SizeR\top,SizeR\right, SizeR\bottom , #SWP_NOZORDER|#SWP_NOACTIVATE|#SWP_NOCOPYBITS|#SWP_NOREDRAW|#SWP_NOSENDCHANGING) If i=6 ; Лог. FillMemory(@SizeR, SizeOf(RECT), 0) GetClientRect_(*PanelInfo\Page_hWnd[i], @SizeR) SetGadgetItemAttribute(#MainWin_Panel_Info_ListIcon_Log, 0, #PB_ListIcon_ColumnWidth, SizeR\right-SizeR\left-2) RedrawWindow_(*PanelInfo\Page_hWnd[i], 0, 0, #RDW_UPDATENOW) EndIf ElseIf Msg = #WM_NOTIFY *pnmh.NMHDR = lParam For i=1 To 4 If *pnmh\hwndFrom = G_ProgramMiscInfo\PanelInfo\Page_hWnd[i] Result = SendMessage_(WindowID(#MainWin), Msg, wParam, lParam) Break EndIf Next i If i>4 Result = CallWindowProc_(*PanelInfo\OldFunc, hWnd, Msg, wParam, lParam) EndIf Else Result = CallWindowProc_(*PanelInfo\OldFunc, hWnd, Msg, wParam, lParam) EndIf ProcedureReturn Result EndProcedure Procedure TabControl_AddTab(hPanel, index, text.s, Image=0) Protected tie.TC_ITEM, hImageList tie\mask = #TCIF_TEXT tie\pszText = @text tie\cchTextMax = Len(text) If Image<>0 hImageList = SendMessage_(hPanel,#TCM_GETIMAGELIST, 0, 0) If hImageList = 0 hImageList = ImageList_Create_(16, 16, #ILC_COLOR32 | #ILC_MASK, 8, 2) SendMessage_(hPanel, #TCM_SETIMAGELIST, 0, hImageList) EndIf tie\mask = tie\mask | #TCIF_IMAGE tie\iImage = ImageList_ReplaceIcon_(hImageList, -1, Image) EndIf SendMessage_(hPanel, #TCM_INSERTITEM, index, @tie) EndProcedure Procedure TabControl_SetPage(hPanel, Index, *PanelInfo.TabControl_Info) Protected Result, i, r.RECT, SizeR.RECT If *PanelInfo>0 And Index>=0 And *PanelInfo\CountPage>Index SendMessage_(*PanelInfo\hPanel, #TCM_ADJUSTRECT, 0, @r) GetClientRect_(*PanelInfo\hPanel, @SizeR) G_ProgramMiscInfo\Panel_Info_Page = Index SizeR\left + r\left/2 SizeR\top + r\top SizeR\right - r\left-r\left/2 SizeR\bottom + r\bottom-r\top SetWindowPos_(*PanelInfo\Page_hWnd[Index],#HWND_TOP,SizeR\left,SizeR\top,SizeR\right, SizeR\bottom, #SWP_SHOWWINDOW) If Index=6 ; Лог. FillMemory(@SizeR, SizeOf(RECT), 0) GetClientRect_(*PanelInfo\Page_hWnd[Index], @SizeR) SetGadgetItemAttribute(#MainWin_Panel_Info_ListIcon_Log, 0, #PB_ListIcon_ColumnWidth, SizeR\right-SizeR\left-2) EndIf For i=0 To *PanelInfo\CountPage-1 If i<>Index SetWindowPos_(*PanelInfo\Page_hWnd[i],#HWND_BOTTOM,0,0,0, 0, #SWP_NOMOVE|#SWP_NOSIZE|#SWP_HIDEWINDOW|#SWP_NOACTIVATE) EndIf Next SendMessage_(*PanelInfo\hPanel,#TCM_SETCURSEL, Index, #Null) EndIf EndProcedure Procedure TabControl_SelectTab() Protected SizeR.RECT, r.RECT, hPanel Static TabActive.a, OldTabActive.a TabActive = G_ProgramMiscInfo\Panel_Info_Page If OldTabActive<>TabActive And TabActive>=0 And TabActive<=6 hPanel = G_ProgramMiscInfo\PanelInfo\hPanel TabControl_SetPage(hPanel, TabActive, @G_ProgramMiscInfo\PanelInfo) OldTabActive=TabActive EndIf EndProcedure Procedure TabControl_CHANGE(lParam, *PanelInfo.TabControl_Info) Protected Result, TabActiveID;, r.RECT Protected TorrentInfo.Sub_TorrentInfo_TorrentList, TempL Protected x, SizeR.RECT Result = #PB_ProcessPureBasicEvents *pnmhdr.NMHDR = lparam If *pnmhdr\code = #TCN_SELCHANGE Or *pnmhdr\code = #TCN_SELCHANGING TabActiveID = SendMessage_(*pnmhdr\hwndFrom, #TCM_GETCURSEL, 0, 0) If TabActiveID>=0 And TabActiveID<*PanelInfo\CountPage If *pnmhdr\code = #TCN_SELCHANGE If TabActiveID=6 ; Лог. FillMemory(@SizeR, SizeOf(RECT), 0) GetClientRect_(*PanelInfo\Page_hWnd[TabActiveID], @SizeR) SetGadgetItemAttribute(#MainWin_Panel_Info_ListIcon_Log, 0, #PB_ListIcon_ColumnWidth, SizeR\right-SizeR\left-2) EndIf G_ProgramMiscInfo\Panel_Info_Page = TabActiveID SignalSemaphore(G_ProgramMiscInfo\Panel_Info_Semaphore) Else *PanelInfo\tabToHideID = TabActiveID EndIf Result = 0 EndIf EndIf ProcedureReturn Result EndProcedure Procedure WindowChild_Panel_Info_Back_MiscInfo_Resize(hWnd, Width.w, Height.w) ; Изменение размеров гаджетов \в скролле вкладки "Общая информация" панели. Protected Temp_1, Temp_2, ScrollHeight, Temp Width = Width-4 ResizeGadget(#MainWin_Panel_Info_MiscInfo_Scroll_Text_1, #PB_Ignore, #PB_Ignore, Width, #PB_Ignore) ; Надпись "Состояние торрента.". ResizeGadget(#MainWin_Panel_Info_MiscInfo_Scroll_Text_7, #PB_Ignore, #PB_Ignore, Width, #PB_Ignore) ; Надпись "Torrent-файл.". Temp_1 = Width/3 Temp = Temp_1-104 For i=#MainWin_Panel_Info_MiscInfo_Scroll_Text_Passed To #MainWin_Panel_Info_MiscInfo_Scroll_Text_Status ResizeGadget(i,#PB_Ignore, #PB_Ignore,Temp,#PB_Ignore) ; Отображение результата в полях "Прошло", "Загружено", "Вх. скорость", "Лимит приёма" и "Состояние". Next i For i=#MainWin_Panel_Info_MiscInfo_Scroll_Text_17 To #MainWin_Panel_Info_MiscInfo_Scroll_Text_21 ResizeGadget(i,Temp_1, #PB_Ignore,#PB_Ignore,#PB_Ignore) ; Поля "Осталось", "Передано", "Скор. отдачи", "Лимит отлачи" и "Лишнее". Next i Temp_1 + 90 Temp = (Width/1.5-16)-Temp_1 For i=#MainWin_Panel_Info_MiscInfo_Scroll_Text_Remains To #MainWin_Panel_Info_MiscInfo_Scroll_Text_Excess ResizeGadget(i,Temp_1, #PB_Ignore,Temp,#PB_Ignore) ; Отображение результата в полях "Осталось", "Передано", "Скор. отдачи", "Лимит отлачи" и "Лишнее". Next i Temp_1 = Width/1.5-10 For i=#MainWin_Panel_Info_MiscInfo_Scroll_Text_22 To #MainWin_Panel_Info_MiscInfo_Scroll_Text_24 ResizeGadget(i,Temp_1, #PB_Ignore,#PB_Ignore,#PB_Ignore) ; Поля "Сиды", "Активные пиры" и "Коэфф. раздачи". Next i Temp_1 + 102 Temp = (Width-2)-Temp_1 For i=#MainWin_Panel_Info_MiscInfo_Scroll_Text_Seeds To #MainWin_Panel_Info_MiscInfo_Scroll_Text_RatioDistribution ResizeGadget(i,Temp_1, #PB_Ignore,Temp,#PB_Ignore) ; Отображение результата в полях "Сиды", "Активные пиры" и "Коэфф. раздачи". Next i Temp_1 = Width-120 For i=#MainWin_Panel_Info_MiscInfo_Scroll_Text_Path To #MainWin_Panel_Info_MiscInfo_Scroll_Text_Publisher_Url ResizeGadget(i,#PB_Ignore, #PB_Ignore,Temp_1,#PB_Ignore) ; Поля "Путь к файлу", "Общий объём", "Создано", "Хеш-сумма", "Описание" и "Части", "Публикатор", "Адрес публикатора". Next i EndProcedure Procedure MainWindow_PanelInfo_Back_Scroll_CB(hWnd, Msg, wParam, lParam) ; Подложка для для скролла на вкладке "Общая информация" панели. Protected *OldFunc, i, x Protected Width.w, Height.w, Result Static Old_Width.w *OldFunc = GetWindowLongPtr_(hWnd,#GWL_USERDATA) If Msg = #WM_CTLCOLORSTATIC ;And G_ProgramMiscInfo\OS_Version>#PB_OS_Windows_2000 If lParam = GadgetID(#MainWin_Panel_Info_MiscInfo_Scroll_Text_1) Or lParam = GadgetID(#MainWin_Panel_Info_MiscInfo_Scroll_Text_7) SetBkMode_(wParam, #TRANSPARENT) SetTextColor_(wParam, $C70238) ProcedureReturn G_ProgramMiscInfo\Draw\Gray_BRUSH Else x=0 For i=#MainWin_Panel_Info_MiscInfo_Scroll_Text_Passed To #MainWin_Panel_Info_MiscInfo_Scroll_Text_Publisher_Url If GadgetID(i) = lParam x = 1 : Break EndIf Next i If G_ProgramMiscInfo\OS_Version<=#PB_OS_Windows_2000 Result = CallWindowProc_(*OldFunc, hWnd, Msg, wParam, lParam) EndIf If x=0 SetTextColor_(wParam, 0) Else SetTextColor_(wParam, $8E0234) EndIf SetBkMode_(wParam, #TRANSPARENT) If G_ProgramMiscInfo\OS_Version>#PB_OS_Windows_2000 ProcedureReturn G_ProgramMiscInfo\Draw\HOLLOW_BRUSH Else ProcedureReturn Result EndIf EndIf EndIf If Msg = #WM_SIZE Width = lParam & $FFFF Height = (lParam >> 16) & $FFFF If Old_Width<>Width Old_Width = Width WindowChild_Panel_Info_Back_MiscInfo_Resize(hWnd, Width, Height) EndIf EndIf ProcedureReturn CallWindowProc_(*OldFunc, hWnd, Msg, wParam, lParam) EndProcedure Procedure WindowChild_Panel_Info_Back_MiscInfo_CB(hWnd, Msg, wParam, lParam) Protected Result, Width.w, Height.w Protected HeightMax, Temp_1, Temp_2, Temp_3 Protected Scroll.SCROLLINFO, Size.RECT, nNewPos Protected Cursor.POINT, Handle ;Static FocusState.b Static Old_Width.w, Old_Height.w If Msg = #WM_CTLCOLORSTATIC And G_ProgramMiscInfo\OS_Version>#PB_OS_Windows_2000 SetBkMode_(wParam, #TRANSPARENT) ProcedureReturn G_ProgramMiscInfo\Draw\HOLLOW_BRUSH EndIf If Msg = #WM_VSCROLL Scroll\cbSize = SizeOf(SCROLLINFO) Scroll\fMask = #SIF_POS | #SIF_PAGE | #SIF_RANGE GetScrollInfo_(hWnd, #SB_VERT, @Scroll) Select wParam & $FFFF Case #SB_THUMBTRACK nNewPos = (wParam>>16) & $FFFF Case #SB_LINELEFT nNewPos = Scroll\nPos - Scroll\nPage Case #SB_LINERIGHT nNewPos = Scroll\nPos + Scroll\nPage Case #SB_PAGELEFT nNewPos = Scroll\nPos - Scroll\nPage Case #SB_PAGERIGHT nNewPos = Scroll\nPos + Scroll\nPage Default ProcedureReturn 0 EndSelect Scroll\fMask = #SIF_POS Scroll\nPos = nNewPos If Scroll\nPos<0 Scroll\nPos = 0 Temp_1=Scroll\nPos ElseIf Scroll\nPos > Scroll\nMax-Scroll\nPage Scroll\nPos=Scroll\nMax Temp_1=Scroll\nPos-Scroll\nPage+1 Else Temp_1=Scroll\nPos EndIf SetScrollInfo_(hWnd, #SB_VERT, @Scroll, #True) SetWindowPos_(GadgetID(#MainWin_Panel_Info_MiscInfo_Scroll_Back),#HWND_BOTTOM,0,-Temp_1,0, 0, #SWP_NOSIZE) InvalidateRect_(hWnd, #Null, #True) ProcedureReturn 0 ElseIf Msg = #WM_MOUSEWHEEL GetCursorPos_(Cursor) Handle = WindowFromPoint_(Cursor\X|(Cursor\Y<<32)) If Handle<>hWnd ProcedureReturn 0 EndIf Scroll\cbSize = SizeOf(SCROLLINFO) Scroll\fMask = #SIF_POS | #SIF_PAGE | #SIF_RANGE GetScrollInfo_(hWnd, #SB_VERT, @Scroll) If Scroll\nMax < 10 ProcedureReturn 0 EndIf x.w = -((wParam>>16)&$FFFF) x/120*20 Scroll\fMask = #SIF_POS Scroll\nPos + x If Scroll\nPos<0 Scroll\nPos = 0 Temp_1=Scroll\nPos ElseIf Scroll\nPos > Scroll\nMax-Scroll\nPage Scroll\nPos=Scroll\nMax Temp_1=Scroll\nPos-Scroll\nPage+1 Else Temp_1=Scroll\nPos EndIf SetScrollInfo_(hWnd, #SB_VERT, @Scroll, #True) SetWindowPos_(GadgetID(#MainWin_Panel_Info_MiscInfo_Scroll_Back),#HWND_BOTTOM,0,-Temp_1,0, 0, #SWP_NOSIZE) ;InvalidateRect_(hWnd, #Null, #True) RedrawWindow_(hWnd, 0, 0, #RDW_ALLCHILDREN|#RDW_UPDATENOW|#RDW_ERASE) ProcedureReturn 0 ElseIf Msg = #WM_LBUTTONUP SetFocus_(hWnd) ElseIf Msg = #WM_SIZE Width = lParam & $FFFF Height = (lParam >> 16) & $FFFF HeightMax = 334 ; При этом размере скролл уже не нужен Scroll\cbSize = SizeOf(SCROLLINFO) Scroll\fMask = #SIF_RANGE|#SIF_PAGE|#SIF_POS GetScrollInfo_(hWnd,#SB_VERT,@Scroll) If Height <> Old_Height Old_Height = Height Temp_1 = (HeightMax-Height) If Temp_1<=0 : Temp_1 = 1 : EndIf Temp_2=10 If Temp_2 > Temp_1 : Temp_2 = Temp_1 : EndIf If Temp_1<=Temp_2;1 ;And Temp_2<=1 EnableScrollBar_(hWnd,#SB_VERT,#ESB_DISABLE_BOTH) Else EnableScrollBar_(hWnd,#SB_VERT,#ESB_ENABLE_BOTH) EndIf Scroll\cbSize = SizeOf(SCROLLINFO) Scroll\fMask = #SIF_RANGE|#SIF_PAGE Scroll\nMin = 0 Scroll\nMax = Temp_1 Scroll\nPage = Temp_2 SetScrollInfo_(hWnd,#SB_VERT,@Scroll, 1) EndIf If Height > HeightMax Or Old_Width<>Width Or Scroll\nPos+Height+Scroll\nPage > HeightMax Temp_1 = GadgetID(#MainWin_Panel_Info_MiscInfo_Scroll_Back) GetClientRect_(Temp_1, @Size) SetWindowPos_(Temp_1,#HWND_BOTTOM,0,-Scroll\nPos,Width,Size\bottom, 0) Old_Width = Width EndIf EndIf Result = DefWindowProc_(hWnd, Msg, wParam, lParam) ProcedureReturn Result EndProcedure Procedure CreateWindowChild_Panel_Info_Back_MiscInfo(x, y, w, h, hWnd_Parent) Protected wc.WNDCLASSEX, WindowClass.s, hWnd,Scroll.SCROLLINFO ; Protected ;#MessageName+ WindowClass.s = " PureScroll" wc\cbsize = SizeOf(WNDCLASSEX) wc\lpfnWndProc = @WindowChild_Panel_Info_Back_MiscInfo_CB() If G_ProgramMiscInfo\OS_Version>#PB_OS_Windows_2000 wc\hbrBackground = G_ProgramMiscInfo\Draw\HOLLOW_BRUSH Else wc\hbrBackground = #COLOR_WINDOW EndIf wc\lpszClassName = @WindowClass RegisterClassEx_(@wc) hWnd = CreateWindowEx_(#WS_EX_STATICEDGE|#WS_EX_TRANSPARENT, WindowClass, "", #WS_VISIBLE|#WS_CHILD|#WS_CLIPCHILDREN|#WS_VSCROLL, x, y, w, h, hWnd_Parent, 0, 0, 0) If hWnd Scroll\cbSize = SizeOf(SCROLLINFO) Scroll\fMask = #SIF_RANGE|#SIF_POS|#SIF_PAGE Scroll\nMin = 0 Scroll\nMax = 334 Scroll\nPage = 10 Scroll\nPos = 0 SetScrollInfo_(hWnd,#SB_VERT,@Scroll,1) EnableScrollBar_(hWnd,#SB_VERT,#ESB_ENABLE_BOTH) EndIf ProcedureReturn hWnd EndProcedure Procedure NewOpenWindow(id,x,y,cx,cy,title.s,flags,parent=0) Protected wnd.wndclass Protected classname.s = #ProgName+"_WinClass" Protected *WinObj.integer Protected hWnd.i, hinst Protected rc.rect hinst = GetModuleHandle_(0) With wnd \style = 0;#CS_HREDRAW|#CS_VREDRAW \lpfnWndProc = @PB_Window_ProcessEvent() \hInstance = hinst \hIcon = PB_Window_Icon \hCursor = PB_Window_Cursor \lpszClassName = @classname \hbrBackground = #COLOR_WINDOW \cbWndExtra = 0 \cbClsExtra = 0 EndWith If RegisterClass_(wnd) SetRect_(rc,0,0,cx,cy) If x = #PB_Ignore Or y = #PB_Ignore x = #CW_USEDEFAULT y = #CW_USEDEFAULT EndIf hWnd = CreateWindowEx_(#WS_EX_WINDOWEDGE,classname,title,flags,x,y,rc\right-rc\left,rc\bottom-rc\top,parent,0,hinst,0) If hWnd *WinObj = PB_Object_GetOrAllocateID(PB_Window_Objects,id) *WinObj\i = hWnd If id = #PB_Any SetProp_(hWnd,"Pb_WindowID",*WinObj+1) Else SetProp_(hWnd,"Pb_WindowID",id+1) EndIf Else UnregisterClass_(hinst,classname) EndIf EndIf If id = #PB_Any id = *WinObj Else id = hWnd EndIf ProcedureReturn id EndProcedure ; IDE Options = PureBasic 5.11 (Windows - x86) ; Folding = ---- ; EnableXP