Descricao: |
Mostra os arquivos ativos na memória(Ram) Saberexcel - dicas aplicativo microsoft excel vba macros
Estas declarações com a macro mostra todos os arquivos que estão na memória RAM do seu computador, cria uma planilha com a relação
'****************** declarações******* Private Declare Function GetWindow Lib "user32" _ (ByVal hwnd As Long, ByVal wCmd As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function GetWindowTextLength Lib "user32" _ Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long Private Declare Function GetWindowText Lib "user32" _ Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, _ ByVal cch As Long) As Long
Const GW_HWNDFIRST = 0 Const GW_HWNDNEXT = 2
Sub Load_Lista_Memoria() Dim CurrWnd As Long Dim Length As Long Dim TaskName As String Dim Parent As Long
i = 1 Sheets.Add 'adiciona uma nova planilha para receber os dados twnd& = FindWindow("Shell_traywnd", vbNullString) CurrWnd = GetWindow(twnd, GW_HWNDFIRST)
While CurrWnd <> 0 Length = GetWindowTextLength(CurrWnd) TaskName = Space$(Length + 1) Length = GetWindowText(CurrWnd, TaskName, Length + 1) TaskName = Left$(TaskName, Len(TaskName) - 1)
If Length > 0 Then Cells(i, 1).Value = TaskName i = i + 1 End If CurrWnd = GetWindow(CurrWnd, GW_HWNDNEXT) DoEvents Wend 'mensagem na planilha inserida ActiveSheet.Range("E8").Value = "Nova Planilha inserida com a relação de todos ítens ativos na memória RAM" Columns("A").AutoFit 'Ajusta a coluna A End Sub
Aprenda tudo sobre o aplicativo Microsoft Excel VBA - com SaberExcel
|