VERSION 5.00 Begin VB.Form fTray AutoRedraw = -1 'True BackColor = &H000000FF& BorderStyle = 0 'None Caption = "fTray" ClientHeight = 1470 ClientLeft = 105 ClientTop = 105 ClientWidth = 1800 FillColor = &H00FFC0C0& BeginProperty Font Name = "Arial" Size = 9 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& HasDC = 0 'False LinkTopic = "frmMain" MaxButton = 0 'False MinButton = 0 'False Moveable = 0 'False NegotiateMenus = 0 'False ScaleHeight = 1470 ScaleWidth = 1800 ShowInTaskbar = 0 'False Begin VB.Frame fmr_Main BackColor = &H0000FF00& BorderStyle = 0 'None Height = 255 Left = 120 MousePointer = 1 'Arrow TabIndex = 0 Top = 120 Width = 1575 Begin VB.PictureBox pb_Main Appearance = 0 'Flat AutoRedraw = -1 'True BackColor = &H00FF0000& BorderStyle = 0 'None CausesValidation= 0 'False ClipControls = 0 'False BeginProperty Font Name = "Arial" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H8000000E& Height = 255 Left = 0 MousePointer = 1 'Arrow ScaleHeight = 17 ScaleMode = 3 'Pixel ScaleWidth = 89 TabIndex = 1 Top = 0 Width = 1335 End End Begin VB.Timer tmr_FastTaskBar Enabled = 0 'False Left = 120 Top = 960 End Begin VB.Timer tmr_ResizeTray Enabled = 0 'False Interval = 6000 Left = 1080 Top = 480 End Begin VB.Timer tmr_TaskBar Enabled = 0 'False Left = 120 Top = 480 End Begin VB.Timer tmr_Pos Enabled = 0 'False Left = 600 Top = 480 End End Attribute VB_Name = "fTray" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Form exibido no tray do sistema ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' API's externas Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long ' Guarda o nome do form Private Const ST_MY_NAME As String = "fTray" ' Guarda o tamanho das bordas Private Const IT_FORM_BORDER As Integer = 3 Private Const IT_FORM_BOTTOM_BORDER As Integer = 1 ' Guarda o tamanho mínimo das janelas Private Const LN_FORM_MIN_HEIGHT As Long = 12 Private Const LN_FORM_MIN_WIDTH As Long = 20 ' Guarda a borda da janela (por conta do efeito de arrendondamento Private Const LN_FORM_EFFECT_BORDER As Long = 1 ' Guarda o limites para exibição do picture Private Const LN_PICTURE_UPPER_LIMIT As Long = 0 Private Const LN_PICTURE_LEFT_LIMIT As Long = 0 ' Guarda qual a divisão de posição Private Const LN_PICTURE_POS_DIV_V As Long = 3 Private Const LN_PICTURE_POS_DIV_H As Long = 6 ' Botão direito do mouse Private Const IT_MOUSE_RIGHT_CLICK As Integer = 2 ' Guarda o ponteiro para a letra Private cl_Lyric As cLyric ' Referência a sua música correspondente Private cm_Music As cMusic ' Guarda o tipo de janela atual Private tw_Window(2) As TRAY_WINDOW ' Guarda o tamanho visível do form Private cd_FormDelta As New cDelta ' Guarda o tamanho visível do frame Private cd_FmrDelta As New cDelta ' Guarda os índices do line e word atuais Private vtln_Index(1) As Long ' Guarda a última posição do mouse capturada Private pt_Mouse As POINTAPI ' Guarda a posição do mouse quando se clicou no form para arrastar Private pt_MouseMove As POINTAPI ' Guarda as propriedades de tamanho da tela ao clicar para arrastar Private wp_BeforeResize As WIN_CONFIG ' Posição do form ao processar posição do mouse Private wp_AuxResize As WIN_CONFIG ' Guarda qual o tipo de resize do mouse está ativada Private mr_Resize As MOUSE_RESIZE ' Guarda se o form está em resize ou não Private bl_Resize As Boolean ' Guarda se o form está no modo tiny ou não Private bl_Tiny As Boolean ' Guarda se o form está em movimento ou não Private bl_Move As Boolean ' Seta se carregou tela ou não Private bl_Loaded As Boolean ' Se está usando mouse-scroll Private bl_MouseScroll As Boolean ' Se está sempre visível Private bl_IsAlwaysOnTop As Boolean ' Guarda a melhor posição do picture Private c2p_PicturePos As New c2DPoint Private c2p_PicturePosDiff As New c2DPoint ' Posição de impressão de texto Private r_Draw As RECT ' Tamanhos do tray Private it_LastTrayWidth As Integer Private it_NewTrayWidth As Integer Private it_LastTrayHeight As Integer Private it_NewTrayHeight As Integer ' Se tray é horizontal Private bl_HorizontalTray As Boolean ' Auxiliares centralizadores de texto Private ln_CTop As Long Private ln_CLeft As Long Private ln_CMinLeft As Long Private ln_CMaxLeft As Long ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Seta um tamanho do tray ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub SetTraySize(ByVal itWidth As Integer, ByVal itHeight As Integer, Optional blForceUpdate As Boolean = False) ' Se tamanho for menor que o mínimo permitido If (itWidth < LN_FORM_MIN_WIDTH) Then ' Seta tamanho mínimo itWidth = LN_FORM_MIN_WIDTH End If ' Se tamanho for menor que o mínimo permitido If (itHeight < LN_FORM_MIN_HEIGHT) Then ' Seta tamanho mínimo itHeight = LN_FORM_MIN_HEIGHT End If ' Se for maior que o anterior If (itWidth > it_NewTrayWidth) Or (itHeight > it_NewTrayHeight) Or blForceUpdate Then ' Salva valores it_LastTrayWidth = itWidth it_NewTrayWidth = itWidth it_LastTrayHeight = itHeight it_NewTrayHeight = itHeight ' Seta tamanho ResizeTray it_NewTrayWidth, it_NewTrayHeight ' Seta timers de tamanho do tray tmr_ResizeTray.Enabled = False tmr_TaskBar.Enabled = False tmr_FastTaskBar.Enabled = True Else ' Salva valor it_NewTrayWidth = itWidth it_NewTrayHeight = itHeight ' Seta timers de tamanho do tray tmr_FastTaskBar.Enabled = False tmr_ResizeTray.Enabled = False tmr_ResizeTray.Enabled = True tmr_TaskBar.Enabled = True End If End Sub Private Sub tmr_ResizeTray_Timer() ' Desativa timer tmr_ResizeTray.Enabled = False ' Seta tamanho do tray ResizeTray it_NewTrayWidth, it_NewTrayHeight ' Salva valores it_LastTrayWidth = it_NewTrayWidth it_LastTrayHeight = it_NewTrayHeight End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Propriedade do tipo de janela ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Property Let Window(twWindows As TRAY_WINDOW) On Error GoTo ErrTreat: ' Verifica se Window é diferente do anterior If (tw_Window(0) <> twWindows) Then ' Desliga efeitos de resize e posição bl_Move = False bl_Resize = False ' Desativa o modo tiny tinyWindow False ' Redesenha o form DrawWindow twWindows End If Exit Property ErrTreat: LogErrMessage Err.Description, ST_MY_NAME + ".Window", twWindows End Property Public Property Get Window() As TRAY_WINDOW ' Retorna valor Window = tw_Window(0) End Property ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Limpa a letra atual ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub Clear() On Error GoTo ErrTreat: ' Se handler for válido If (CheckHandler) Then ' Seta que não está carregado bl_Loaded = False ' Oculta menu de Lyrik fMain.mnuLyrik.Visible = False ' Reajusta tamanho do picture pb_Main.Width = LN_NEUTRAL_VALUE pb_Main.Top = LN_NEUTRAL_VALUE pb_Main.Height = LN_NEUTRAL_VALUE ' Limpa picturebox pbClear pb_Main ' Atualiza objetos gráficos pb_Main.Refresh fmr_Main.Refresh Me.Refresh ' Limpa últimas impressões vtln_Index(0) = LN_INVALID_VALUE vtln_Index(1) = LN_INVALID_VALUE ' Libera objeto anterior Set cl_Lyric = Nothing ' Libera info da música Set cm_Music = Nothing End If Exit Sub ErrTreat: LogErrMessage Err.Description, ST_MY_NAME + ".Clear" End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Reajusta a janela, player está parado ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub ReajustWindow() ' Verifica programa If CheckHandler Then ' Verifica o tipo de janela Select Case Window ' Se for systray Case TRAY_WINDOW.twTray ' Reajusta o tray AdjusteSystray ' Redimenciona o tray SetTraySize cd_FormDelta.Final.X, cd_FormDelta.Final.Y ' Se for janela Case TRAY_WINDOW.twFree ' Retira temporariamente do always-on-top UpdateAlwaysOnTop False End Select End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Propriedade de carregamento do form ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub Load() ' Seta tamanho mínimo Me.Height = LN_FORM_MIN_HEIGHT * Screen.TwipsPerPixelY Me.Width = LN_FORM_MIN_WIDTH * Screen.TwipsPerPixelX ' Oculta menu de Lyrik fMain.mnuLyrik.Visible = False ' Seta que não está carregando bl_Loaded = False ' Desativa timers DisableTimers ' Seta fundos pb_Main.BackColor = GetColor(cBackround) fmr_Main.BackColor = pb_Main.BackColor Me.BackColor = pb_Main.BackColor ' Seta fonte SetFontType pb_Main ' Seta cor de texto para fundo pb_Main.ForeColor = GetColor(cBackText) ' Seta propriedades pb_Main.AutoRedraw = True pb_Main.ScaleMode = 3 End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Propriedade de letra ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Property Let Lyric(clInput As cLyric) ' Seta que está carregando bl_Loaded = False ' Desativa timers DisableTimers ' Libera anterior Set cl_Lyric = Nothing ' Guarda ponteiro Set cl_Lyric = clInput ' Seta que já foi carregado bl_Loaded = True ' Deixa menu de lyrik visível fMain.mnuLyrik.Visible = clInput.Editable ' Imprime a letra DrawLyric End Property Public Property Get Lyric() As cLyric ' Retorna Set Lyric = cl_Lyric End Property ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Propriedade do info da música ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Property Let Music(cmInput As cMusic) ' Libera anterior Set cm_Music = Nothing ' Salva Set cm_Music = cmInput End Property Public Property Get Music() As cMusic ' Retorna Set Music = cm_Music End Property ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Reseta texto e reimprime ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub Reset(picAux As PictureBox) ' Verifica se possui letra carregada If bl_Loaded Then ' Seta que não está pronto bl_Loaded = False ' Seta objeto auxiliar cl_Lyric.AuxPictureBox = picAux ' Executa procedimentos anteriores antes de continuar DoEvents ' Redimenciona letra cl_Lyric.Resize ' Seta que está pronto bl_Loaded = True End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Imprime todo o texto atual ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub DrawLyric() Dim lnI As Long On Error GoTo ErrTreat: ' Verifica programa If CheckHandler Then ' Seta fundos pb_Main.BackColor = GetColor(cBackround) fmr_Main.BackColor = pb_Main.BackColor Me.BackColor = pb_Main.BackColor ' Seta fonte SetFontType pb_Main, cl_Lyric.Charset ' Seta cor de texto para fundo pb_Main.ForeColor = GetColor(cBackText) ' Seta tamanho do picture pb_Main.Height = cl_Lyric.Delta.Final.Y * Screen.TwipsPerPixelY pb_Main.Width = cl_Lyric.Delta.Final.X * Screen.TwipsPerPixelX ' Limpa picturebox pbClear pb_Main ' Limpa últimas impressões vtln_Index(0) = LN_INVALID_VALUE vtln_Index(1) = LN_INVALID_VALUE ' Verifica se a letra é do tipo simples If cl_Lyric.Simple Then ' Varre o vetor de lines For lnI = 0 To (cl_Lyric.GetLineSize - 1) ' Imprime texto (normal) DrawText cl_Lyric.GetLine(lnI), cHighlighText, (lnI = 0) Next lnI ' Ativa mouse-scroll startMouseScroll pb_Main, cl_Lyric.TextHeight, fmr_Main.Height - (cl_Lyric.Delta.Final.Y * Screen.TwipsPerPixelY) ' Seta que está usando o mouse-scroll bl_MouseScroll = True ' Reposiciona imagem pb_Main.Top = LN_NEUTRAL_VALUE Else ' Varre o vetor de lines For lnI = 0 To (cl_Lyric.GetLineSize - 1) ' Imprime texto (fundo) DrawTextLine cl_Lyric.GetLine(lnI), cBackText, (lnI = 0) Next lnI ' Seta que não está usando mouse-scroll bl_MouseScroll = False ' Desativa mouse-scroll endMouseScroll pb_Main End If ' Verifica o tipo de janela Select Case Window ' Se for systray Case TRAY_WINDOW.twTray ' Reajusta o tamanho do tray AdjusteSystray ' Redimenciona o form no tray SetTraySize cd_FormDelta.Final.X, cd_FormDelta.Final.Y ' Se for janela Case TRAY_WINDOW.twFree ' Seta sempre visível (se definido) UpdateAlwaysOnTop bl_AlwaysOnTop End Select ' Tratamentos pós redimencionamento Form_Resize End If Exit Sub ErrTreat: LogErrMessage Err.Description, ST_MY_NAME + ".DrawLyric" End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Retorna se o tray mudou de sentido ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Function TrayChanged() As Boolean On Error GoTo ErrTreat: ' Verifica o tipo do tray Select Case GetTrayType ' Se for horizontal Case TASK_TYPE.ttBottom, TASK_TYPE.ttTop ' Se tray era horizontal If bl_HorizontalTray Then ' Não houve mudanças TrayChanged = False Else ' Houve mudanças TrayChanged = True ' Seta que tray é horizontal bl_HorizontalTray = True End If ' Se for vertical Case Else ' Se tray era horizontal If bl_HorizontalTray Then ' Houve mudanças TrayChanged = True ' Seta que tray é vertical bl_HorizontalTray = False Else ' Não houve mudanças TrayChanged = False End If End Select Exit Function ErrTreat: LogErrMessage Err.Description, ST_MY_NAME + ".TrayChanged" End Function ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Ajusta o tamanho da janela no systray (somente memória) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub AdjusteSystray() Dim itWidth As Integer Dim itHeight As Integer Dim itMaxTraySize As Integer On Error GoTo ErrTreat: ' Se está no modo Tiny If bl_Tiny Then ' Seta o menor valor itMaxTraySize = LN_FORM_MIN_WIDTH Else ' Seta valor de configuração itMaxTraySize = it_MaxTraySize End If ' Verifica o tipo do tray Select Case GetTrayType ' Se for horizontal Case TASK_TYPE.ttBottom, TASK_TYPE.ttTop ' Calcula o tamanho (x) ideal itWidth = (pb_Main.Width / Screen.TwipsPerPixelX) + (2 * IT_FORM_BORDER) ' Verifica se existe um tamanho (x) máximo e se o ideal é maior If (itMaxTraySize > 0) And (itWidth > itMaxTraySize) Then ' Seta o tamanho (x) como sendo o maior permitido itWidth = itMaxTraySize End If ' Se tamanho é menor que o mínimo If (itWidth < LN_FORM_MIN_WIDTH) Then ' Seta tamanho mínimo itWidth = LN_FORM_MIN_WIDTH End If ' Calcula o tamanho (y) ideal do form itHeight = GetTrayHeigh - IT_TRAYBAR_BORDER ' Se for vertical Case Else ' Calcula o tamanho (y) ideal itHeight = (pb_Main.Height / Screen.TwipsPerPixelY) + (2 * IT_FORM_BORDER) ' Verifica se existe um tamanho (y) máximo e se o ideal é maior If (itMaxTraySize > 0) And (itHeight > itMaxTraySize) Then ' Seta o tamanho (y) como sendo o maior permitido itHeight = itMaxTraySize End If ' Se tamanho é menor que o mínimo If (itHeight < LN_FORM_MIN_HEIGHT) Then ' Seta tamanho mínimo itHeight = LN_FORM_MIN_HEIGHT End If ' Calcula o tamanho (x) ideal do form itWidth = GetTrayWidth - IT_TRAYBAR_BORDER End Select ' Guarda o tamanho (x,y) no delta do form cd_FormDelta.Initial.X = LN_INVALID_VALUE cd_FormDelta.Initial.Y = LN_INVALID_VALUE cd_FormDelta.Final.Y = itHeight cd_FormDelta.Final.X = itWidth Exit Sub ErrTreat: LogErrMessage Err.Description, ST_MY_NAME + ".AdjusteSystray" End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Propriedade de sempre visível ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Property Let AlwaysOnTop(blEnabled As Boolean) On Error GoTo ErrTreat: ' Guarda valor bl_AlwaysOnTop = blEnabled bl_IsAlwaysOnTop = blEnabled ' Se for modo janela If (Window = twFree) Then ' Seta visibilidade SetAlwaysOnTop Me, bl_AlwaysOnTop End If Exit Property ErrTreat: LogErrMessage Err.Description, ST_MY_NAME + ".AlwaysOnTop [let]" End Property Public Property Get AlwaysOnTop() As Boolean ' Retorna AlwaysOnTop = bl_AlwaysOnTop End Property ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Desativa/Reativa o always-on-top temporariamente ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub UpdateAlwaysOnTop(blEnabled As Boolean, Optional blForce As Boolean = False) On Error GoTo ErrTreat: ' Se está no always-on-top If bl_IsAlwaysOnTop Then ' Se quer desativar temporariamente If Not blEnabled Then ' Tira do always-on-top temporiamente SetAlwaysOnTop Me, blEnabled ' Guarda valor bl_IsAlwaysOnTop = blEnabled End If Else ' Se quer reativar e se pode reativar If blEnabled And (bl_AlwaysOnTop Or blForce) Then ' Coloca no always on top novamente SetAlwaysOnTop Me, blEnabled ' Guarda valor bl_IsAlwaysOnTop = blEnabled End If End If Exit Sub ErrTreat: LogErrMessage Err.Description, ST_MY_NAME + ".UpdateAlwaysOnTop" End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' 'Imprime' a janela no lugar ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub DrawWindow(ByVal twWindow As TRAY_WINDOW) On Error GoTo ErrTreat: ' Verifica programa If CheckHandler Then ' Verifica qual o tipo de janela deve ser impressa Select Case twWindow ' Se for janela do tray Case TRAY_WINDOW.twTray ' Se não houver tray If Not TrayBarExists Then ' Coloca no modo window Window = twFree Exit Sub End If ' Guarda valor anterior tw_Window(1) = tw_Window(0) ' Seta valor atual tw_Window(0) = twWindow ' Ajusta o tamanho no systray AdjusteSystray ' Verifica se o form era de tray If (tw_Window(1) = twTray) Then ' Apenas reajusta o tamanho SetTraySize cd_FormDelta.Final.X, cd_FormDelta.Final.Y Else ' Verifica se o form era free If (tw_Window(1) = twFree) Then ' Guarda posição rt_Win.Height = Me.Height rt_Win.Width = Me.Width rt_Win.Left = Me.Left rt_Win.Top = Me.Top ' Tira do sempre visível UpdateAlwaysOnTop False ' Tira efeito alpha ApplyAlpha Me, BT_INVALID_VALUE End If ' Se tela não está visível If Not Me.Visible Then ' Imprime tela showNonModal Me End If ' Coloca o form no tray AttachForm Me, cd_FormDelta.Final.X, cd_FormDelta.Final.Y, True ' Ativa timer do taskbar tmr_TaskBar.Interval = ln_TrayRefresh tmr_FastTaskBar.Interval = ln_FastTrayRefresh tmr_TaskBar.Enabled = True tmr_FastTaskBar.Enabled = False End If ' Se for livre Case TRAY_WINDOW.twFree ' Guarda valor anterior tw_Window(1) = tw_Window(0) ' Seta valor atual tw_Window(0) = twWindow ' Verifica se o form era de tray If (tw_Window(1) = twTray) Then ' Desativa timer do taskbar tmr_TaskBar.Enabled = False tmr_FastTaskBar.Enabled = False ' Tira-o do tray DetachForm End If ' Atualiza a área visível da tela UpdateScreenArea ' Seta posição do form e tamanhos Me.Top = rt_Win.Top Me.Left = rt_Win.Left Me.Height = rt_Win.Height Me.Width = rt_Win.Width ' Verifica e reajusta área VerifyArea ' Aplica efeito alpha ApplyAlpha Me, bt_TrayAlpha ' Seta sempre visível (se definido) UpdateAlwaysOnTop bl_AlwaysOnTop ' Se for nenhum Case TRAY_WINDOW.twNothing ' Tira do sempre visível UpdateAlwaysOnTop False ' Deixa invisível Me.Visible = False ' Guarda valor anterior tw_Window(1) = tw_Window(0) ' Seta valor atual tw_Window(0) = twWindow ' Verifica se o form era de tray If (tw_Window(1) = twTray) Then ' Desativa timer do taskbar tmr_TaskBar.Enabled = False tmr_FastTaskBar.Enabled = False ' Tira-o do tray DetachForm Else ' Guarda posição rt_Win.Height = Me.Height rt_Win.Width = Me.Width rt_Win.Left = Me.Left rt_Win.Top = Me.Top End If ' Se for para voltar Case TRAY_WINDOW.twRedo ' Seta fundos pb_Main.BackColor = GetColor(cBackround) fmr_Main.BackColor = pb_Main.BackColor Me.BackColor = pb_Main.BackColor ' Se anterior é válido (diferente de nada/redo) If ((tw_Window(1) <> twNothing) And (tw_Window(1) <> twRedo)) Then ' Volta para estado anterior DrawWindow tw_Window(1) Else ' Volta para estado padrão DrawWindow rt_Win.Type End If ' Re-imprime letra If bl_Loaded Then DoEvents DrawLyric End If Exit Sub End Select ' Verifica se há lyrik carregada If bl_Loaded Then ' Centraliza texto Centralize True End If ' Aplica redimencionamento Form_Resize End If Exit Sub ErrTreat: LogErrMessage Err.Description, ST_MY_NAME + ".DrawWindow", twWindow End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Aplica limites na tela ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub VerifyArea() ' Seta valores atuais wp_AuxResize.Height = Me.Height / Screen.TwipsPerPixelX wp_AuxResize.Top = Me.Top / Screen.TwipsPerPixelX wp_AuxResize.Width = Me.Width / Screen.TwipsPerPixelY wp_AuxResize.Left = Me.Left / Screen.TwipsPerPixelY ' Verifica se algum limite é ultrapassado If (wp_AuxResize.Top < rt_ValidScreen.Top) Then: wp_AuxResize.Top = rt_ValidScreen.Top If (wp_AuxResize.Left < rt_ValidScreen.Left) Then: wp_AuxResize.Left = rt_ValidScreen.Left If (wp_AuxResize.Height > rt_ValidScreen.Bottom) Then: wp_AuxResize.Height = rt_ValidScreen.Bottom If (wp_AuxResize.Width > rt_ValidScreen.Right) Then: wp_AuxResize.Width = rt_ValidScreen.Right ' Verifica se está fora da área útil (altura) If ((wp_AuxResize.Top + wp_AuxResize.Height) > (rt_ValidScreen.Bottom - rt_ValidScreen.Top)) Then ' Reajusta altura wp_AuxResize.Top = rt_ValidScreen.Bottom - wp_AuxResize.Height End If ' Verifica se está fora da área útil (largura) If ((wp_AuxResize.Left + wp_AuxResize.Width) > (rt_ValidScreen.Right - rt_ValidScreen.Left)) Then ' Reajusta largura wp_AuxResize.Left = rt_ValidScreen.Right - wp_AuxResize.Width End If ' Reajusta Me.Height = wp_AuxResize.Height * Screen.TwipsPerPixelY Me.Top = wp_AuxResize.Top * Screen.TwipsPerPixelY Me.Left = wp_AuxResize.Left * Screen.TwipsPerPixelX Me.Width = wp_AuxResize.Width * Screen.TwipsPerPixelX End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Atualiza a área útil da tela ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub UpdateScreenArea() On Error Resume Next ' Atualiza as dimensões válida total da tela updateValidScreen ' Incrementa bordas no fundo e lateral direita rt_ValidScreen.Bottom = rt_ValidScreen.Bottom + LN_FORM_EFFECT_BORDER rt_ValidScreen.Right = rt_ValidScreen.Right + LN_FORM_EFFECT_BORDER ' Verifica o tipo do tray Select Case GetTrayType ' Se está no 'teto' Case TASK_TYPE.ttTop ' Incrementa bordas no topo rt_ValidScreen.Top = rt_ValidScreen.Top - LN_FORM_EFFECT_BORDER ' Se está na 'parede esquerda' Case TASK_TYPE.ttLeft ' Incrementa bordas na lateral esquerda rt_ValidScreen.Left = rt_ValidScreen.Left - LN_FORM_EFFECT_BORDER End Select End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Imprime texto no picturebox ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub DrawText(lwInput, cColor As COLORS, Optional blUnderline As Boolean) ' Limpa campo FillRect pb_Main, lwInput.Delta, cBackround ' Seta cor pb_Main.ForeColor = GetColor(cColor) ' Seta posição do texto With r_Draw .Top = lwInput.Delta.Initial.Y .Left = lwInput.Delta.Initial.X .Bottom = lwInput.Delta.Final.Y .Right = lwInput.Delta.Final.X End With ' Se propriedade underline pb_Main.FontUnderline = (blUnderline And fn_UnderlineTitle) Or fn_Underline ' Imprime texto DrawTextE pb_Main.hdc, lwInput.text, r_Draw, BF_RIGHT Or BF_NOCAPTION End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Imprime texto (line) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub DrawTextLine(clInput As cLyricLine, cColor As COLORS, blUnderline As Boolean) On Error GoTo ErrTreat: ' Verifica se possui separação em words If (clInput.GetWordSize > 0) Then ' Cria auxiliar Dim lnI As Long ' Varre lista de words For lnI = 0 To (clInput.GetWordSize - 1) ' Imprime word DrawText clInput.GetWord(lnI), cColor, blUnderline Next lnI Else ' Imprime texto direto DrawText clInput, cColor, blUnderline End If Exit Sub ErrTreat: LogErrMessage Err.Description, ST_MY_NAME + ".DrawTextLine" End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Marca um texto/word ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub ChooseText(lnLine As Long, Optional lnWord As Long = LN_INVALID_VALUE) On Error GoTo ErrTreat: ' Verifica programa If CheckHandler Then ' Verifica se é necessário redesenhar line If (vtln_Index(0) <> lnLine) Or (vtln_Index(0) = LN_INVALID_VALUE) Or _ ((vtln_Index(1) <> lnWord) And (lnWord = LN_INVALID_VALUE)) Then ' Verifica se existia line anterior If (vtln_Index(0) <> LN_INVALID_VALUE) Then ' Re-imprime a line anterior DrawTextLine cl_Lyric.GetLine(vtln_Index(0)), cBackText, (vtln_Index(0) = 0) ' Define que não há word interior vtln_Index(1) = LN_INVALID_VALUE End If ' Se possui linha para desenhar If (lnLine <> LN_INVALID_VALUE) Then ' Imprime line atual DrawTextLine cl_Lyric.GetLine(lnLine), cNormalText, (lnLine = 0) End If ' Seta última line como sendo essa vtln_Index(0) = lnLine End If ' Verifica se é para imprimir word If (lnWord <> LN_INVALID_VALUE) Then ' Verifica se é necessário redesenhar If (vtln_Index(1) <> lnWord) Or (vtln_Index(1) = LN_INVALID_VALUE) Then ' Verifica se existia word anterior If (vtln_Index(1) <> LN_INVALID_VALUE) Then ' Re-imprime a word anterior DrawText cl_Lyric.GetLine(vtln_Index(0)).GetWord(vtln_Index(1)), cNormalText, (vtln_Index(0) = 0) End If ' Imprime word atual DrawText cl_Lyric.GetLine(vtln_Index(0)).GetWord(lnWord), cHighlighText, (lnLine = 0) ' Seta última word como sendo essa vtln_Index(1) = lnWord End If End If ' Centraliza texto Centralize False End If Exit Sub ErrTreat: LogErrMessage Err.Description, ST_MY_NAME + ".ChooseText", CStr(lnLine) + ST_ERR_SEP + CStr(lnWord) End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Procedimento para centralizar a linha/word atuais ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub Centralize(blFast As Boolean) Dim llLine As cLyricLine Dim lwWord As cLyricWord ' Verifica se há linha If (vtln_Index(0) <> LN_INVALID_VALUE) Then ' Pega a linha Set llLine = cl_Lyric.GetLine(vtln_Index(0)) ' Calcula o top de modo que o texto fique no meio ln_CTop = CLng((cd_FmrDelta.Final.Y / 2) - (llLine.Delta.Diff.Y / 2)) - llLine.Delta.Initial.Y ' Verifica se é menor que o limite inferior If (ln_CTop < cd_FmrDelta.Initial.Y) Then ' Seta no limite ln_CTop = cd_FmrDelta.Initial.Y End If ' Verifica se é maior que o limite superior If (ln_CTop > LN_PICTURE_UPPER_LIMIT) Then ' Seta no limite ln_CTop = LN_PICTURE_UPPER_LIMIT End If ' Verifica se há word If (vtln_Index(1) <> LN_INVALID_VALUE) Then ' Pega a word Set lwWord = llLine.GetWord(vtln_Index(1)) ' Calcula o left de modo que o texto fique no meio ln_CLeft = (cd_FmrDelta.Final.X / 2) - (lwWord.Delta.Diff.X / 2) - lwWord.Delta.Initial.X ' Se for da direita para esquerda If cl_Lyric.RightToLeft Then ' Calcula o mínimo left ln_CMinLeft = cd_FmrDelta.Final.X - lwWord.Delta.Final.X Else ' Calcula o mínimo left ln_CMinLeft = cd_FmrDelta.Final.X - llLine.Delta.Final.X End If ' Verifica qual é o alinhamento Select Case cl_Lyric.Alignment ' Se for esquerda Case TEXT_ALIGNMENT.taLeft, TEXT_ALIGNMENT.taNone ' Se for da direita para esquerda If cl_Lyric.RightToLeft Then ' Seta máximo à esquerda If (cd_FmrDelta.Final.X >= llLine.Delta.Diff.X) Then ln_CMaxLeft = cd_FmrDelta.Final.X - llLine.Delta.Final.X Else ln_CMaxLeft = LN_PICTURE_LEFT_LIMIT End If Else ' Seta máximo à esquerda ln_CMaxLeft = LN_PICTURE_LEFT_LIMIT End If ' Se for centralizado Case TEXT_ALIGNMENT.taCenter ' Calcula o máximo left If (cd_FmrDelta.Final.X >= llLine.Delta.Diff.X) Then ln_CMaxLeft = (cd_FmrDelta.Final.X - cl_Lyric.Delta.Final.X) / 2 Else ln_CMaxLeft = -(cl_Lyric.Delta.Final.X - llLine.Delta.Final.X) End If ' Se for a direita Case TEXT_ALIGNMENT.taRigth ' Calcula o máximo left If (cd_FmrDelta.Final.X >= llLine.Delta.Diff.X) Then ln_CMaxLeft = cd_FmrDelta.Final.X - cl_Lyric.Delta.Final.X Else ln_CMaxLeft = -llLine.Delta.Initial.X End If End Select ' Verifica se é menor que o limite da direita If (ln_CLeft < ln_CMinLeft) Then ' Seta no limite ln_CLeft = ln_CMinLeft End If ' Verifica se é maior que o limite da esquerda If (ln_CLeft > ln_CMaxLeft) Then ' Seta valor mínimo ln_CLeft = ln_CMaxLeft End If ' Libera apontamento Set lwWord = Nothing Else ' Verifica qual é o alinhamento Select Case cl_Lyric.Alignment ' Se for esquerda Case TEXT_ALIGNMENT.taLeft, TEXT_ALIGNMENT.taNone ' Verifica se é righttoleft If cl_Lyric.RightToLeft Then ' Seta máximo à direita ln_CLeft = cd_FmrDelta.Final.X - llLine.Delta.Final.X Else ' Seta máximo à esquerda ln_CLeft = LN_PICTURE_LEFT_LIMIT End If ' Se for centralizado Case TEXT_ALIGNMENT.taCenter ' Verifica se é righttoleft If cl_Lyric.RightToLeft Then ' Seta valor If (cd_FmrDelta.Final.X >= llLine.Delta.Diff.X) Then ln_CLeft = (cd_FmrDelta.Final.X - cl_Lyric.Delta.Final.X) / 2 Else ln_CLeft = cd_FmrDelta.Final.X - llLine.Delta.Final.X End If Else ' Seta valor If (cd_FmrDelta.Final.X >= llLine.Delta.Diff.X) Then ln_CLeft = (cd_FmrDelta.Final.X - cl_Lyric.Delta.Final.X) / 2 Else ln_CLeft = -(cl_Lyric.Delta.Final.X - llLine.Delta.Final.X) End If End If ' Se for à direita Case TEXT_ALIGNMENT.taRigth ' Verifica se é righttoleft If cl_Lyric.RightToLeft Then ' Seta valor ln_CLeft = cd_FmrDelta.Final.X - llLine.Delta.Final.X Else ' Seta valor If (cd_FmrDelta.Final.X >= llLine.Delta.Diff.X) Then ln_CLeft = cd_FmrDelta.Final.X - cl_Lyric.Delta.Final.X Else ln_CLeft = -llLine.Delta.Initial.X End If End If End Select End If ' Libera apontamento Set llLine = Nothing Else ' Se letra possuir pelo menos uma linha If (cl_Lyric.GetLineSize > 0) Then ' Escolhe a primeira linha vtln_Index(0) = 0 ' Recentraliza Centralize True ' Volta para linha inválida vtln_Index(0) = LN_INVALID_VALUE Exit Sub End If ' Seta nos limites ln_CTop = LN_PICTURE_UPPER_LIMIT ln_CLeft = LN_PICTURE_LEFT_LIMIT End If ' Seta posição do picture SetPicturePos ln_CTop * Screen.TwipsPerPixelY, ln_CLeft * Screen.TwipsPerPixelX, blFast End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Repassa o foco pro picture ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub Form_GotFocus() ' Verifica se pode receber foco If pb_Main.Visible Then ' Seta foco pb_Main.SetFocus End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Procedimento que seta a posição do picturebox ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub SetPicturePos(ByVal lnTop As Long, ByVal lnLeft As Long, blFast As Boolean) ' Guarda valores c2p_PicturePos.Y = lnTop c2p_PicturePos.X = lnLeft ' Se estiver usando mouse-scroll If bl_MouseScroll Then ' Seta valores pb_Main.Left = c2p_PicturePos.X ' Calcula min top lnTop = fmr_Main.Height - (cl_Lyric.Delta.Final.Y * Screen.TwipsPerPixelY) ' Corrige mínimo If (lnTop > 0) Then: lnTop = 0 ' Atualiza min top do picture updateMouseScrollMinTop pb_Main, lnTop ' Se imagem estiver além do mínimo If (pb_Main.Top < lnTop) Then ' Seta valor mínimo pb_Main.Top = lnTop End If ' Não está usando mouse-scroll Else ' Verifica se é para centralizar rapidamente If blFast Then ' Seta valores pb_Main.Top = c2p_PicturePos.Y pb_Main.Left = c2p_PicturePos.X Else ' Ativa o timer tmr_Pos.Interval = ln_PicturePosRefresh tmr_Pos.Enabled = True End If End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Procedimento que seta a posição do picturebox ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub tmr_Pos_Timer() ' Calcula o quanto deve ser aplicado c2p_PicturePosDiff.Y = c2p_PicturePos.Y - pb_Main.Top c2p_PicturePosDiff.X = c2p_PicturePos.X - pb_Main.Left ' Se ambos forem pequenos (menores que um pixel) If (Abs(c2p_PicturePosDiff.Y) < Screen.TwipsPerPixelY) _ And (Abs(c2p_PicturePosDiff.X) < Screen.TwipsPerPixelX) Then ' Desativa timer tmr_Pos.Enabled = False ' Seta valores pb_Main.Top = c2p_PicturePos.Y pb_Main.Left = c2p_PicturePos.X Else ' Aplica valor pb_Main.Top = pb_Main.Top + (c2p_PicturePosDiff.Y / LN_PICTURE_POS_DIV_V) pb_Main.Left = pb_Main.Left + (c2p_PicturePosDiff.X / LN_PICTURE_POS_DIV_H) End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Procedimento de quando o form é redimencionado ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub Form_Resize() On Error GoTo ErrTreat: ' Se o form não estiver visível If Not Me.Visible Then ' Se não for do tipo nothing If (tw_Window(0) <> twNothing) Then ' Torna-o visível Me.Visible = True End If End If ' Calcula e guarda o tamanho (x,y) no delta do form cd_FormDelta.Final.X = Me.Width / Screen.TwipsPerPixelX cd_FormDelta.Final.Y = Me.Height / Screen.TwipsPerPixelY ' Calcula e guarda o tamanho (x,y) no delta do frame cd_FmrDelta.Final.X = cd_FormDelta.Final.X - (2 * IT_FORM_BORDER) cd_FmrDelta.Final.Y = cd_FormDelta.Final.Y - (2 * IT_FORM_BORDER) - IT_FORM_BOTTOM_BORDER If bl_Loaded Then cd_FmrDelta.Initial.Y = cd_FmrDelta.Final.Y - cl_Lyric.Delta.Final.Y End If ' Redimenciona o frame fmr_Main.Top = IT_FORM_BORDER * Screen.TwipsPerPixelY fmr_Main.Left = IT_FORM_BORDER * Screen.TwipsPerPixelX fmr_Main.Width = cd_FmrDelta.Final.X * Screen.TwipsPerPixelX fmr_Main.Height = cd_FmrDelta.Final.Y * Screen.TwipsPerPixelY ' Aplica efeito transparente ApplyTransparence Me, ln_TrayBorder ' Centraliza texto If bl_Loaded Then Centralize False End If Exit Sub ErrTreat: Exit Sub End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Procedimento quando passa um mouse sob o form ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error Resume Next ' Verifica o tipo Select Case tw_Window(0) ' Se for livre Case TRAY_WINDOW.twFree ' Se não estiver no modo tiny If Not bl_Tiny Then ' Verifica se o resize está ativado If bl_Resize Then ' Redimenciona ResizeForm Else ' Próximo do 'chão' If (Y >= fmr_Main.Height) Then ' Seta tipo cima mr_Resize.blDown = True mr_Resize.blUp = False ' Próximo da esquerda If (X <= fmr_Main.Left) Then ' Seta mouse diagonal 1 Me.MousePointer = MOUSE_TYPE.mtDiagonal1 mr_Resize.blLeft = True mr_Resize.blRight = False ' Próximo da direita ElseIf (X >= fmr_Main.Width) Then ' Seta mouse diagonal 2 Me.MousePointer = MOUSE_TYPE.mtDiagonal2 mr_Resize.blLeft = False mr_Resize.blRight = True ' Sem diagonal Else ' Seta mouse vertical Me.MousePointer = MOUSE_TYPE.mtVertical mr_Resize.blLeft = False mr_Resize.blRight = False End If ' Próximo do 'teto' ElseIf (Y <= fmr_Main.Top) Then ' Seta tipo cima mr_Resize.blDown = False mr_Resize.blUp = True ' Próximo da esquerda If (X <= fmr_Main.Left) Then ' Seta mouse diagonal 2 Me.MousePointer = MOUSE_TYPE.mtDiagonal2 mr_Resize.blLeft = True mr_Resize.blRight = False ' Próximo da direita ElseIf (X >= fmr_Main.Width) Then ' Seta mouse diagonal 1 Me.MousePointer = MOUSE_TYPE.mtDiagonal1 mr_Resize.blLeft = False mr_Resize.blRight = True ' Sem diagonal Else ' Seta mouse vertical Me.MousePointer = MOUSE_TYPE.mtVertical mr_Resize.blLeft = False mr_Resize.blRight = False End If ' Não possui cima ou baixo Else ' Seta que não possui cima ou baixo mr_Resize.blDown = False mr_Resize.blUp = False ' Somente próximo da esquerda If (X <= fmr_Main.Left) Then ' Seta mouse horizontal Me.MousePointer = MOUSE_TYPE.mtHorizontal mr_Resize.blLeft = True mr_Resize.blRight = False ' Somente próximo da direita ElseIf (X >= fmr_Main.Width) Then ' Seta mouse horizontal Me.MousePointer = MOUSE_TYPE.mtHorizontal mr_Resize.blLeft = False mr_Resize.blRight = True ' Perto de nada Else ' Se mouse para padrão Me.MousePointer = MOUSE_TYPE.mtNormal End If End If End If Else ' Seta mouse para padrão Me.MousePointer = MOUSE_TYPE.mtNormal ' Desativa propriedade de resize bl_Resize = False End If ' Se for traybar Case TRAY_WINDOW.twTray ' Se não está no modo tiny If Not bl_Tiny Then ' Verifica o tipo do tray Select Case GetTrayType ' Se for horizontal Case TASK_TYPE.ttBottom, TASK_TYPE.ttTop ' Se mouse está na esquerda If (X <= fmr_Main.Left) Then ' Seta mouse modo tiny Me.MousePointer = MOUSE_TYPE.mtCross Else ' Seta mouse para parão Me.MousePointer = MOUSE_TYPE.mtNormal End If ' Se for vertical Case Else ' Se mouse está em 'cima' If (Y <= fmr_Main.Top) Then ' Seta mouse modo tiny Me.MousePointer = MOUSE_TYPE.mtCross Else ' Seta mouse para parão Me.MousePointer = MOUSE_TYPE.mtNormal End If End Select Else ' Seta mouse para parão Me.MousePointer = MOUSE_TYPE.mtNormal End If ' Se for qualquer outro tipo Case Else ' Seta mouse para padrão Me.MousePointer = MOUSE_TYPE.mtNormal ' Desativa propriedade de resize bl_Resize = False End Select End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Procedimento quando aperta/solta o mouse sob o form ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) ' Verifica qual o clique Select Case Button ' Se for botão direito Case IT_MOUSE_RIGHT_CLICK ' Verifica o modo da janela If ((tw_Window(0) = twFree) Or (tw_Window(0) = twTray)) Then ' Abre pop-up Me.PopupMenu fMain.mnuPopUp End If ' Caso for qualquer outro Case Else ' Verifica o tipo de janela Select Case tw_Window(0) ' Se for livre Case TRAY_WINDOW.twFree ' Se não estiver no modo tiny If Not bl_Tiny Then ' Salva posição atual do mouse GetCursorPos pt_MouseMove ' Salva o tamanho do form wp_BeforeResize.Height = Me.Height / Screen.TwipsPerPixelY wp_BeforeResize.Width = Me.Width / Screen.TwipsPerPixelX wp_BeforeResize.Left = Me.Left / Screen.TwipsPerPixelX wp_BeforeResize.Top = Me.Top / Screen.TwipsPerPixelY ' Copia valores para o auxiliar wp_AuxResize = wp_BeforeResize ' Atualiza a área visível da tela UpdateScreenArea ' Ativa propriedade de resize bl_Resize = True End If ' Se for traybar Case TRAY_WINDOW.twTray ' Se está no modo tiny If bl_Tiny Then ' Tira do modo tiny tinyWindow False Else ' Verifica o tipo do tray Select Case GetTrayType ' Se for horizontal Case TASK_TYPE.ttBottom, TASK_TYPE.ttTop ' Se mouse está na esquerda If (X <= fmr_Main.Left) Then ' Ativa modo tiny tinyWindow True End If ' Se for vertical Case Else ' Se mouse está em 'cima' If (Y <= fmr_Main.Top) Then ' Ativa modo tiny tinyWindow True End If End Select End If End Select End Select End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) ' Verifica o tipo Select Case tw_Window(0) ' Se for livre Case TRAY_WINDOW.twFree ' Desativa propriedade de resize bl_Resize = False End Select End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Timer que atualiza o taskbar ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub tmr_TaskBar_Timer() On Error GoTo ErrTreat: ' Desativa tmr_TaskBar.Enabled = False ' Atualiza If UpdateTaskBar Then ' Seta para modo rápido tmr_FastTaskBar.Enabled = True Else ' Reativa tmr_TaskBar.Enabled = True End If Exit Sub ErrTreat: MsgBox "blah" End Sub Private Sub tmr_FastTaskBar_Timer() On Error GoTo ErrTreat: ' Desativa tmr_FastTaskBar.Enabled = False ' Atualiza If UpdateTaskBar Then ' Verifica se houve mudança na direção do tray If TrayChanged Then ' Gera novos valores para o tray ReajustWindow Else ' Seta para modo rápido tmr_FastTaskBar.Enabled = True End If Else ' Reativa o normal-timer tmr_TaskBar.Enabled = True End If Exit Sub ErrTreat: MsgBox "blah" End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Redimenciona o formulário ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub ResizeForm() ' Desativa modo tiny bl_Tiny = False ' Pega posição atual do mouse GetCursorPos pt_Mouse ' Se tiver baixo If mr_Resize.blDown Then ' Calcula o height do form wp_AuxResize.Height = pt_Mouse.Y - wp_AuxResize.Top End If ' Se tiver direito If mr_Resize.blRight Then ' Calcula o width do form wp_AuxResize.Width = pt_Mouse.X - wp_AuxResize.Left End If ' Se tiver cima If mr_Resize.blUp Then ' Calcula o top do form wp_AuxResize.Top = pt_Mouse.Y ' Calcula o heigth wp_AuxResize.Height = wp_BeforeResize.Height + (pt_MouseMove.Y - pt_Mouse.Y) End If ' Se tiver esquerda If mr_Resize.blLeft Then ' Calcula o left do form wp_AuxResize.Left = pt_Mouse.X ' Calcula o width wp_AuxResize.Width = wp_BeforeResize.Width + (pt_MouseMove.X - pt_Mouse.X) End If ' Verifica se o form não está ficando pra fora da tela válida If (wp_AuxResize.Top < rt_ValidScreen.Top) Then ' Seta valor válido wp_AuxResize.Top = rt_ValidScreen.Top End If ' Verifica se o form não está ficando pra fora da tela válida If (wp_AuxResize.Left < rt_ValidScreen.Left) Then ' Seta valor válido wp_AuxResize.Left = rt_ValidScreen.Left End If ' Verifica se o form não está ficando pra fora da tela válida If ((wp_AuxResize.Height + wp_AuxResize.Top) > rt_ValidScreen.Bottom) Then ' Seta valor válido wp_AuxResize.Height = rt_ValidScreen.Bottom - wp_AuxResize.Top End If ' Verifica se o form não está ficando pra fora da tela válida If ((wp_AuxResize.Width + wp_AuxResize.Left) > rt_ValidScreen.Right) Then ' Seta valor válido wp_AuxResize.Width = rt_ValidScreen.Right - wp_AuxResize.Left End If ' Verifica se tamanhos dos form são válidos If (wp_AuxResize.Height >= LN_FORM_MIN_HEIGHT) And (wp_AuxResize.Width >= LN_FORM_MIN_WIDTH) Then ' Seta valores de tamanho e posição do form Me.Height = wp_AuxResize.Height * Screen.TwipsPerPixelY Me.Top = wp_AuxResize.Top * Screen.TwipsPerPixelY Me.Left = wp_AuxResize.Left * Screen.TwipsPerPixelX Me.Width = wp_AuxResize.Width * Screen.TwipsPerPixelX End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Seta posição do form ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub SetPos(Top As Long, Left As Long) ' Seta valores wp_AuxResize.Left = Left wp_AuxResize.Top = Top ' Seta valores no form Me.Top = wp_AuxResize.Top * Screen.TwipsPerPixelY Me.Left = wp_AuxResize.Left * Screen.TwipsPerPixelX End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Movimento do form ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub StartMoveForm(X As Long, Y As Long) ' Atualiza a área visível da tela UpdateScreenArea ' Guarda valores pt_MouseMove.X = X pt_MouseMove.Y = Y wp_AuxResize.Top = X wp_AuxResize.Left = Y wp_AuxResize.Height = Me.Height / Screen.TwipsPerPixelY wp_AuxResize.Width = Me.Width / Screen.TwipsPerPixelX End Sub Private Sub MoveForm() ' Pega posição atual do mouse GetCursorPos pt_Mouse ' Calcula e seta a posição do form wp_AuxResize.Top = pt_Mouse.Y - pt_MouseMove.Y wp_AuxResize.Left = pt_Mouse.X - pt_MouseMove.X ' Verifica se o form não está ficando pra fora da tela válida If (wp_AuxResize.Top < rt_ValidScreen.Top) Then ' Seta valor válido wp_AuxResize.Top = rt_ValidScreen.Top End If ' Verifica se o form não está ficando pra fora da tela válida If (wp_AuxResize.Left < rt_ValidScreen.Left) Then ' Seta valor válido wp_AuxResize.Left = rt_ValidScreen.Left End If ' Verifica se o form não está ficando pra fora da tela válida If ((wp_AuxResize.Top + wp_AuxResize.Height) > rt_ValidScreen.Bottom) Then ' Seta valor válido wp_AuxResize.Top = rt_ValidScreen.Bottom - wp_AuxResize.Height End If ' Verifica se o form não está ficando pra fora da tela válida If ((wp_AuxResize.Left + wp_AuxResize.Width) > rt_ValidScreen.Right) Then ' Seta valor válido wp_AuxResize.Left = rt_ValidScreen.Right - wp_AuxResize.Width End If ' Seta a posição do form Me.Top = wp_AuxResize.Top * Screen.TwipsPerPixelY Me.Left = wp_AuxResize.Left * Screen.TwipsPerPixelX ' Se estiver usando attachment 'If bl_PlayerUseAttach Then ' ' ' Verifica o attach ' verifyAttach 'End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Tira do exibe a letra inteira ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub unShowAllLyric() ' Tira do sempre visível UpdateAlwaysOnTop False ' Seta o tipo do form tw_Window(0) = TRAY_WINDOW.twTray ' Coloca o tray no form novamente FastFreeForm False ' Se possui letra carregada If bl_Loaded Then ' Centraliza texto Centralize True End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Exibe a letra inteira ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub ShowAllLyric() ' Verifica se há letra carregada If bl_Loaded Then ' Salva o tamanho do form wp_BeforeResize.Height = Me.Height / Screen.TwipsPerPixelY wp_BeforeResize.Width = Me.Width / Screen.TwipsPerPixelX wp_BeforeResize.Left = Me.Left / Screen.TwipsPerPixelX wp_BeforeResize.Top = Me.Top / Screen.TwipsPerPixelY ' Libera do tray FastFreeForm True ' Seta o tipo do form tw_Window(0) = TRAY_WINDOW.twTrayView ' Calcula os tamanhos ideais wp_AuxResize.Width = (pb_Main.Width / Screen.TwipsPerPixelX) + (2 * IT_FORM_BORDER) wp_AuxResize.Height = (pb_Main.Height / Screen.TwipsPerPixelY) + (2 * IT_FORM_BORDER) ' Verifica se tamanho é válido (horizontal) If (wp_AuxResize.Width > ((Screen.Width / Screen.TwipsPerPixelX) / 2)) Then ' Seta tamanho válido wp_AuxResize.Width = (Screen.Width / Screen.TwipsPerPixelX) / 2 End If ' Verifica se tamanho é válido (vertical) If (wp_AuxResize.Height > (Screen.Height / Screen.TwipsPerPixelY) - IT_FORM_BORDER) Then ' Seta tamanho válido wp_AuxResize.Height = (Screen.Height / Screen.TwipsPerPixelY) End If ' Verifica se o tamanho não é menor que o anterior (horizontal) If (wp_AuxResize.Width < wp_BeforeResize.Width) Then ' Seta de mesmo tamanho anterior wp_AuxResize.Width = wp_BeforeResize.Width End If ' Verifica se o tamanho não é menor que o anterior (vertical) If (wp_AuxResize.Height < wp_BeforeResize.Height) Then ' Seta de mesmo tamanho anterior wp_AuxResize.Height = wp_BeforeResize.Height End If ' Verifica o tipo do task Select Case GetTrayType ' Se for 'chão' ou direita Case TASK_TYPE.ttBottom, TASK_TYPE.ttRigth ' Calcula a posição ideal wp_AuxResize.Top = (wp_BeforeResize.Top + wp_BeforeResize.Height) - wp_AuxResize.Height wp_AuxResize.Left = (wp_BeforeResize.Left + wp_BeforeResize.Width) - wp_AuxResize.Width ' Se for cima Case TASK_TYPE.ttTop ' Calcula a posição ideal wp_AuxResize.Top = wp_BeforeResize.Top wp_AuxResize.Left = (wp_BeforeResize.Left + wp_BeforeResize.Width) - wp_AuxResize.Width ' Se for esquerda Case TASK_TYPE.ttLeft ' Calcula a posição ideal wp_AuxResize.Top = (wp_BeforeResize.Top + wp_BeforeResize.Height) - wp_AuxResize.Height wp_AuxResize.Left = wp_BeforeResize.Left End Select ' Seta valores de tamanho e posição do form Me.Top = wp_AuxResize.Top * Screen.TwipsPerPixelY Me.Left = wp_AuxResize.Left * Screen.TwipsPerPixelX Me.Height = wp_AuxResize.Height * Screen.TwipsPerPixelY Me.Width = wp_AuxResize.Width * Screen.TwipsPerPixelX ' Centraliza texto Centralize True ' Atualiza DoEvents ' Seta para sempre visível UpdateAlwaysOnTop True, True End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Clique duplo sobre a letra ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub pb_Main_DblClick() ' Se há lyric If Not (cl_Lyric Is Nothing) Then ' Se letra possuir URL If (Len(cl_Lyric.URL) > 0) Then ' Abre URL ShellExecute Me.hWnd, ST_SHELL_OPEN, cl_Lyric.URL, ST_INVALID_VALUE, ST_INVALID_VALUE, LN_SHELL_NORMAL ' Se era URL de atualização If (cl_Lyric.URL = st_LyrikUpdateUrl) Then ' Atualiza última atualização vista cc_Configuration.lastUpdateVersion = ln_LastVersion ln_LastVersionShow = ln_LastVersion ' Remove letra Clear End If Exit Sub End If End If ' Verifica o tipo do form Select Case tw_Window(0) ' Se for do tipo livre Case TRAY_WINDOW.twFree ' Ativa modo mínimo tinyWindow Not bl_Tiny End Select End Sub Private Sub fmr_Main_DblClick() ' Verifica o tipo do form Select Case tw_Window(0) ' Se for do tipo livre Case TRAY_WINDOW.twFree ' Ativa modo mínimo tinyWindow Not bl_Tiny End Select End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Inicia modo tinywindow ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub tinyWindow(blActive As Boolean) Dim lnNewHeight As Long Dim lnNewTop As Long ' Verifica o tipo do form Select Case tw_Window(0) ' Se for do tipo livre Case TRAY_WINDOW.twFree ' Se é para ativar If blActive And (Not bl_Tiny) Then ' Guarda tamanho original wp_BeforeResize.Height = Me.Height / Screen.TwipsPerPixelY ' Se possui letra carregada If bl_Loaded Then ' Define o tamanho mínimo lnNewHeight = cl_Lyric.TextHeight + (IT_FORM_BORDER * 2) ' Se não for o mínimo If (lnNewHeight < LN_FORM_MIN_HEIGHT) Then ' Seta tamanho mínimo lnNewHeight = LN_FORM_MIN_HEIGHT End If Else ' Usa tamanho mínimo lnNewHeight = LN_FORM_MIN_HEIGHT End If ' Se o tamanho calculado for menor que o atual If (lnNewHeight < wp_BeforeResize.Height) Then ' Seta que está no tiny bl_Tiny = True ' Calcula diferença do top wp_BeforeResize.Top = lnNewHeight - wp_BeforeResize.Height ' Seta tamanho do form Me.Height = lnNewHeight * Screen.TwipsPerPixelY ' Se form está no baixo If Not formIsOnTop Then ' Calcula novo top lnNewTop = (Me.Top / Screen.TwipsPerPixelY) - wp_BeforeResize.Top ' Verifica se o form não está ficando pra fora da tela válida If ((lnNewTop + lnNewHeight) > rt_ValidScreen.Bottom) Then ' Seta valor válido lnNewTop = rt_ValidScreen.Bottom - lnNewHeight ElseIf (lnNewTop < 0) Then ' Seta valor válido lnNewTop = 0 End If ' Seta top Me.Top = lnNewTop * Screen.TwipsPerPixelY End If End If ' Se é para desativar ElseIf (Not blActive) And bl_Tiny Then ' Seta que não está mais no tiny bl_Tiny = False ' Se form está no baixo If Not formIsOnTop Then ' Calcula novo top lnNewTop = (Me.Top / Screen.TwipsPerPixelY) + wp_BeforeResize.Top ' Verifica se o form não está ficando pra fora da tela válida If ((lnNewTop + wp_BeforeResize.Height) > rt_ValidScreen.Bottom) Then ' Seta valor válido lnNewTop = rt_ValidScreen.Bottom - wp_BeforeResize.Height ElseIf (lnNewTop < 0) Then ' Seta valor válido lnNewTop = 0 End If ' Seta top Me.Top = lnNewTop * Screen.TwipsPerPixelY End If ' Restaura tamamnhos e posição do form Me.Height = wp_BeforeResize.Height * Screen.TwipsPerPixelY End If ' Se for do tipo traybar Case TRAY_WINDOW.twTray ' Se valores estão diferentes If (bl_Tiny <> blActive) Then ' Seta valor bl_Tiny = blActive ' Calcula tamanho AdjusteSystray ' Redimenciona o tray SetTraySize cd_FormDelta.Final.X, cd_FormDelta.Final.Y, True End If ' Guarda valor bl_Tiny = blActive End Select End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Retorna se o form está na parte superior da tela ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Function formIsOnTop() As Boolean Dim lnPosTop As Long On Error Resume Next ' Calcula tamanho para ser considerado baixo lnPosTop = (rt_ValidScreen.Bottom * Screen.TwipsPerPixelY) - (Me.Top + Me.Height) ' Se o top for maior If (Me.Top > lnPosTop) Then ' Está no baixo formIsOnTop = False Else ' Está no alto formIsOnTop = True End If End Function ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Quando aperta / solta o mouse no picture / frame ou quando movimenta o mouse sobre eles ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub pb_Main_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) ' Verifica qual o clique Select Case Button ' Se for botão direito Case IT_MOUSE_RIGHT_CLICK ' Verifica o modo da janela If ((tw_Window(0) = twFree) Or (tw_Window(0) = twTray)) Then ' Abre pop-up Me.PopupMenu fMain.mnuPopUp End If ' Caso for qualquer outro clique Case Else ' Verifica o tipo do form Select Case tw_Window(0) ' Se for do tipo livre Case TRAY_WINDOW.twFree ' Se estiver no modo mínimo If bl_Tiny Then Dim lnAuxTop As Single ' Recupera o top atual lnAuxTop = Me.Top ' Tira do modo mínimo tinyWindow Not bl_Tiny ' Calcula diferença no top lnAuxTop = lnAuxTop - Me.Top ' Calcula o centro StartMoveForm X + ((pb_Main.Left + fmr_Main.Left) / Screen.TwipsPerPixelX), (lnAuxTop / Screen.TwipsPerPixelY) + Y + ((pb_Main.Top + fmr_Main.Top) / Screen.TwipsPerPixelY) Else ' Calcula o centro StartMoveForm X + ((pb_Main.Left + fmr_Main.Left) / Screen.TwipsPerPixelX), Y + ((pb_Main.Top + fmr_Main.Top) / Screen.TwipsPerPixelY) End If ' Atualiza a área visível da tela UpdateScreenArea ' Ativa movimento do form bl_Move = True ' Se for do tipo tray Case TRAY_WINDOW.twTray ' Se estiver no modo tiny If bl_Tiny Then ' Desabilita modo tiny tinyWindow False Else ' Exibe a letra inteira ShowAllLyric End If End Select End Select End Sub Private Sub fmr_Main_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) ' Verifica qual o clique Select Case Button ' Se for botão direito Case IT_MOUSE_RIGHT_CLICK ' Verifica o modo da janela If ((tw_Window(0) = twFree) Or (tw_Window(0) = twTray)) Then ' Abre pop-up Me.PopupMenu fMain.mnuPopUp End If ' Caso for qualquer outro Case Else ' Verifica o tipo do form Select Case tw_Window(0) ' Se for do tipo livre Case TRAY_WINDOW.twFree ' Se estiver no modo mínimo If bl_Tiny Then Dim lnAuxTop As Single ' Recupera o top atual lnAuxTop = Me.Top ' Tira do modo mínimo tinyWindow Not bl_Tiny ' Calcula diferença no top lnAuxTop = lnAuxTop - Me.Top ' Calcula o centro StartMoveForm ((X + fmr_Main.Left) / Screen.TwipsPerPixelX), (((Y + lnAuxTop) + fmr_Main.Top) / Screen.TwipsPerPixelY) Else ' Calcula o centro StartMoveForm ((X + fmr_Main.Left) / Screen.TwipsPerPixelX), ((Y + fmr_Main.Top) / Screen.TwipsPerPixelY) End If ' Se estiver no modo mínimo If bl_Tiny Then ' Tira do modo mínimo tinyWindow Not bl_Tiny End If ' Atualiza a área visível da tela UpdateScreenArea ' Ativa movimento do form bl_Move = True ' Se for do tipo tray Case TRAY_WINDOW.twTray ' Se estiver no modo tiny If bl_Tiny Then ' Desabilita modo tiny tinyWindow False Else ' Exibe a letra inteira ShowAllLyric End If End Select End Select End Sub Private Sub pb_Main_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) ' Verifica o tipo do form Select Case tw_Window(0) ' Se for do tipo livre Case TRAY_WINDOW.twFree ' Desativa movimento bl_Move = False ' Se estiver em visualização extendida do tray (all lyric) Case TRAY_WINDOW.twTrayView ' Tira do exibir a letra inteira unShowAllLyric End Select End Sub Private Sub fmr_Main_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) ' Verifica o tipo do form Select Case tw_Window(0) ' Se for do tipo livre Case TRAY_WINDOW.twFree ' Desativa movimento bl_Move = False ' Se estiver em visualização extendida do tray (all lyric) Case TRAY_WINDOW.twTrayView ' Tira do exibir a letra inteira unShowAllLyric End Select End Sub Private Sub fmr_Main_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ' Verifica se é para mover o form If bl_Move Then ' Move o form MoveForm End If End Sub Private Sub pb_Main_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ' Verifica se é para mover o form If bl_Move Then ' Move o form MoveForm End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Procedimento que desativa todos os timers ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub DisableTimers() ' Desativa movimentos tmr_Pos.Enabled = False bl_Resize = False bl_Move = False End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Procedimentos de quando o form é carregado ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub Form_Load() ' Inicia variáveis bl_Resize = False bl_Move = False bl_Loaded = False Set cl_Lyric = Nothing Set cm_Music = Nothing TrayChanged ' Limpa Clear End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Verifica se handler principal é válido ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Function CheckHandler() ' Se não há handler válido If (pb_Main.hWnd = LN_NO_ADDRESS) Then ' Seta retorno CheckHandler = False ' Reinicia programa fMain.restartProgram Else ' É valido CheckHandler = True End If End Function ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Procedimentos de quando o form é fechado ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub Form_Unload(Cancel As Integer) On Error Resume Next ' Deixa a tela invisível Me.Visible = False ' Desativa timers de posicionamento DisableTimers ' Desativa restante dos timers tmr_TaskBar.Enabled = False tmr_ResizeTray.Enabled = False tmr_FastTaskBar.Enabled = False ' Tira do sempre visível UpdateAlwaysOnTop False ' Verifica qual o tipo Select Case tw_Window(0) ' Se estava no tray Case TRAY_WINDOW.twTray ' Tira-o do tray DetachForm ' Se era livre Case TRAY_WINDOW.twFree ' Desativa o modo tiny tinyWindow False ' Guarda posições rt_Win.Height = Me.Height rt_Win.Width = Me.Width rt_Win.Left = Me.Left rt_Win.Top = Me.Top ' Tira efeito alpha ApplyAlpha Me, BT_INVALID_VALUE End Select ' Desativa mouse-scroll endMouseScroll pb_Main ' Libera letra Set cl_Lyric = Nothing ' Libera info da música Set cm_Music = Nothing End Sub