elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


  Mostrar Mensajes
Páginas: 1 ... 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 [926] 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 ... 1236
9251  Programación / Scripting / Re: Problema con apertura en batch en: 10 Abril 2013, 19:54 pm
En el primer script:

Código:
Start """" ".\Subcarpeta\Segundo script.bat"

saludos
9252  Sistemas Operativos / Windows / Re: ¿Por que tanto odio hacia Windows 8? en: 10 Abril 2013, 17:50 pm
PD: @gAb1, Aquí tienes un claro ejemplo de porque tanta critica hacia W8. La gente sin mas se fian (copian) de lo que dicen los demás.. No les importa si es cierto o no..

Espero que no me estés llamando mentiroso y eso séa lo que quisiste decir nada más xD

Yo como ya dije cada uno puede sacar sus própias conclusiones respecto al SO que utilice.

Hay aspectos de Windows 8 que algunos consideramos muy malos, pero otras personas se benefician de ellos y les parece bueno, empezándo por algo tán básico como la interfaz del SO, en fín es imposible ponerse deacuerdo en algo como esto si nombramos todos los nuevos aspectos de Win8.

Por otro lado tengo que decir, para defender la postura de dato000 y contradecir un poco ese comentario (porque según se mire...), si una persona va a una tienda de electrodomésticos y le dicen que una plancha es mala o buena, pues todos confiamos en que la opinión del vendedor séa cierta, ¿no?, y esa es la misma opinión que el comprador le va a dar a su familia, amigos, etc, y todos van a pensar que esa plancha es una m**** sin haberla probado, a menos que el tipo séa un maestro en planchar corbatas y sepa que el vendedor le mintió...xD.

En fín, con esto quiero decir que me parece lo más normal del mundo tomar como referencia la opinión de otra persona que te parezca de confianza, aunque si que es cierto que eso es "hablar sin saber" y lo mejor es que uno mismo pruebe "X" producto y obtenga sus própias conclusiones (para que luego te digan eso de: "Cuanta razón tenías!") :).

Saludos!
9253  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Plantillas de Game Launchers para juegos de Steam en: 10 Abril 2013, 17:36 pm
Es que esto de la piratería se lo toman a guasa todo dios, por no decir hasta la policia, pero yo que se...
Es que es de guasa, Copiar no es Robar, Compartir tampoco es robar.

No enserio, se lo que pasa con la pirateria y todo eso, pero si fueses tan amable de explicarme o mandarme un link dnde explicase, que pasaria si denunciasen la web de piratería de IKillnukes? xD

Bueno, yo no soy abogado macho!, pero que yo sepa la SGAE te da un límite de 3 a 7 días (no lo recuerdo bien) para que cierres la web (O sinó te la cierran ellos), pero la multa según tengo entendido te la llevas igual, si quieres saber más sobre estas cosas deberías preguntarle a cualquier admin que lleve una web donde suban pelis y esas cosas, que deben estar muy puestos en el tema.

Para evitar denuncias deberías subirlo a la nube o en servidores rusos (si la política de allí sigue igual como estaba hace unos meses, que no lo sé).

Sabrás de sobra que los temas ilegales están prohibidos en este foro, así que mejor dejar el tema aquí, que además le estás quitando protagonismo a los launchers con el tema de la piratería x'D.

Si quieres podriamos hablar por la chat de mi web :)
Espero que no te sepa mal pero no me interesa en absoluto meterme en esas cosas (formar parte de ese tipo de webs, o algo parecido), no porque subas material ilegal, sinó porque ponerme a subir juegos en una web no es lo mío, no me apetece nada la verdad, ni tampoco me voy a poner a codear launchers para todos los juegos que existen, sólo lo hago para los que tengo ocasión de jugar y me gustan.

Saludos!
9254  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Plantillas de Game Launchers para juegos de Steam en: 10 Abril 2013, 17:14 pm
lo guapo sería una web con estas plantillas y con los chetos
Ya hay demasiadas webs que comparten chetos, y muy buenas, como GameCopyWorld, e incluso de trainers dedicados como CheatHappens donde te hacen un trainer por un módico précío.

(Sorry por el spam)

Que te parece si lo metemos en mi web?

No sé cual es tu web, no creo que séa la del MineCraft porque dices que subes juegos piratas y ahi yo solo véo el MineCraft xD

Pero en fín, mételo donde quieras siempre que respetes el nombre dle autor (YO), es gratis y cada uno puede usar estas plantillas como le apetezca para diseñar un launcher.

Saludos

9255  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Plantillas de Game Launchers para juegos de Steam en: 10 Abril 2013, 16:56 pm
eso se supone que tu le metes la app que es y carga la plantilla?
eing?! no te he entendido, son proyectos (solutions) para el VS.

Las plantillas sólo fácilitan la tarea de cargar esa combinación de aplicaciones (steam + juego + trainer + "X"), para automatizarlo o portabilizarlo, nada más.

Edito: Si, puedes hacer un acceso directo (o 4 en casos como este...), o hacerlo desde un Bat, de hecho yo siempre lo hago primero en Batch, pero un launcher gráfico es mucho más bonito, más seguro (errores), y lo considero más rápido (una vez guardas la configuración actual para usarla la próxima vez).

Y eso de los chets, se puede poner desde Steam? Es que no entiendo bien de Steam. :)

Tampoco lo he entendido muy bien.

Se pueden usar trucos online, yo he jugado con munición infinita por steam y demás.

Las malas lenguas dicen que si usas trucos te banean, pero solo lo hacen para asustar (para ver si asi dejan de joder usando trucos), te lo dice alguien que tiene legálmente Steam hace unos 7 años y chetando a saco en los servers de Steam sin problemas xD.

Si no has entendido algo dímelo.

Saludos!

PD: Aquí tienes la versión Batchera ;) para ti y para todos:

Código
  1. @Echo OFF
  2.  
  3. :: Launcher Configuration
  4. Set "Title=TombRaider Launcher by Elektro H@cker"
  5. Set "Game=TombRaider.exe"
  6. Set "Trainer=TombRaider-Trainer.exe"
  7. Set "MouseLock=MouseLock.exe"
  8. Set "SteamDIR=C:\Juegos\Counter Strike"
  9.  
  10. :: Steam Configuration
  11. (
  12. Echo ActivityLogEnable = disable
  13. Echo ActivityLogGroupSteamAPI = disable
  14. Echo BootStrapperForceClientBootstrap = disable
  15. Echo BootStrapperForceSelfUpdate=disable
  16. Echo BootStrapperInhibitAll=enable
  17. Echo CachePreLoaderMode = disable
  18. Echo EngineInSameProcessAsClient = disable
  19. Echo FullMemoryMinidumps = disable
  20. )>"%SteamDIR%\Steam.cfg"
  21.  
  22. :: CMD Config
  23. TITLE %TITLE%
  24. MODE CON Cols=50 lines=10
  25.  
  26. :: Run Steam
  27. Echo %TITLE% | MORE
  28. Echo Waiting for Steam to load... | MORE
  29. Start /B """" "%SteamDIR%\Steam.exe" -applaunch 0
  30. :Steam_Is_Loading
  31. (cmdow | find /I "steam" | Findstr /I "amigos friends" 1>Nul 2>&1) || (GOTO :Steam_Is_Loading)
  32.  
  33.  
  34. :: Run Game things
  35. Echo Running the game... | MORE
  36. Echo [+] The key to unlock the mouse is "CTRL+C".
  37. (TaskList /FI "IMAGENAME eq %MouseLock%" 1>NUL 2>&1 | FIND "%MouseLock%") || (Start /B """" "%MouseLock%")
  38. (TaskList /FI "IMAGENAME eq   %Trainer%" 1>NUL 2>&1 | FIND   "%Trainer%") || (Start /B """"   "%Trainer%")
  39. (TaskList /FI "IMAGENAME eq      %Game%" 1>NUL 2>&1 | FIND      "%Game%") || (Start /W """"      "%Game%")
  40.  
  41.  
  42. :: Clean
  43. Del /Q /F ".\SteamAPI.log" 2>Nul
  44. Del /Q /F ".\*.mdmp"       2>Nul
  45. TaskKill /F /T /IM "%Trainer%"   1>Nul 2>&1
  46. TaskKill /F /T /IM "%MouseLock%" 1>Nul 2>&1
  47. TaskKill /F /T /IM "Steam.exe"   1>Nul 2>&1
9256  Programación / .NET (C#, VB.NET, ASP) / [APORTE] Plantillas de Game Launchers para juegos de Steam en: 10 Abril 2013, 16:21 pm
Estos dos proyectos los comparto como plantillas para las personas que quieren hacer un Game launcher.

Los dos poryectos son idénticos, y estas son algunas de sus características a resaltar:

· Configuración portable en un archivo INI sencillísima e intuitiva (Para usarlo en juegos autoextraibles con WinRAR por ejemplo)
· Drag&drop en los textboxes
· Permite soltar accesos directos también (.lnk) en los textboxes,
· La mayor parte del code (sobre todo los eventos de controles) está muy simplificado y optimizado
· Está todo bastante optimizado en el code para poder modificar el diseño fácilmente mediante variables (título del juego y del launcher, colores y fuente de texto, etc...)
· Varios controles de errores

...Y en definitiva creo que me han quedado bonito como plantillas.

Los dos proyectos son WinForms, y he usado VS2012 y el FrameWork 3.5.





El método y el orden de carga del programa es este:

1. Primero se ejecuta Steam (si estuviera seleccionado) con el parámetro "-applaunch 0" para que no salga la ventana de auto-login. (el proceso espera a que Steam se haya cargado complétamente)
2. Se ejecuta el Trainer (si hubiera alguno seleccionado)
3. Se ejecuta la aplicación alternativa (si hubiera alguna seleccionada), esta aplicación alternativa puede ser por ejemplo un programa para bloquear el mouse... http://foro.elhacker.net/net/source_mouselock_gui_version-t387309.0.html
4. Se ejecuta el Juego y se monitoriza su ejecución hasta que el proceso del juego se cierre.

Descarga: www.elektrostudios.tk/Game Launchers by Elektro H@cker.rar

Espero que os guste,
Saludos!
9257  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 10 Abril 2013, 13:25 pm
· Cargar fuentes de texto desde los recursos:

Nota: Este code ya lo posteé pero se me olvidó agregar lo más importante, la class, así que lo vuelvo a postear xD

Código
  1. #Region " Use Custom Text-Font "
  2.  
  3.    ' [ Use Custom Text-Font ]
  4.    '
  5.    ' Instructions :
  6.    ' 1. Add a .TTF font to the resources
  7.    ' 2. Add the class
  8.    ' 3. Use it
  9.    '
  10.    ' Examples:
  11.    ' Label1.Font = New Font(GameFont.Font, 10.0!)
  12.    ' Label1.Text = "This is your custom font !!"
  13.  
  14.    Dim MyFont As New CustomFont(My.Resources.kakakaka)
  15.  
  16.    Private Sub Main_Disposed(sender As Object, e As System.EventArgs) Handles Me.Disposed
  17.        MyFont.Dispose()
  18.    End Sub
  19.  
  20.    ' CustomFont.vb
  21. #Region " CustomFont Class "
  22.  
  23. Imports System.Drawing
  24. Imports System.Drawing.Text
  25. Imports System.Runtime.InteropServices
  26.  
  27.    ''' <summary>
  28.    ''' Represents a custom font not installed on the user's system.
  29.    ''' </summary>
  30.    Public NotInheritable Class CustomFont
  31.        Implements IDisposable
  32.  
  33.        Private fontCollection As New PrivateFontCollection()
  34.        Private fontPtr As IntPtr
  35.  
  36. #Region "Constructor"
  37.        ''' <summary>
  38.        ''' Creates a new custom font using the specified font data.
  39.        ''' </summary>
  40.        ''' <param name="fontData">The font data representing the font.</param>
  41.        Public Sub New(ByVal fontData() As Byte)
  42.            'Create a pointer to the font data and copy the
  43.            'font data into the location in memory pointed to
  44.            fontPtr = Marshal.AllocHGlobal(fontData.Length)
  45.            Marshal.Copy(fontData, 0, fontPtr, fontData.Length)
  46.  
  47.            'Add the font to the shared collection of fonts:
  48.            fontCollection.AddMemoryFont(fontPtr, fontData.Length)
  49.        End Sub
  50. #End Region
  51.  
  52. #Region "Destructor"
  53.        'Free the font in unmanaged memory, dispose of
  54.        'the font collection and suppress finalization
  55.        Public Sub Dispose() Implements IDisposable.Dispose
  56.            Marshal.FreeHGlobal(fontPtr)
  57.            fontCollection.Dispose()
  58.  
  59.            GC.SuppressFinalize(Me)
  60.        End Sub
  61.  
  62.        'Free the font in unmanaged memory
  63.        Protected Overrides Sub Finalize()
  64.            Marshal.FreeHGlobal(fontPtr)
  65.        End Sub
  66. #End Region
  67.  
  68. #Region "Properties"
  69.        ''' <summary>
  70.        ''' Gets the font family of the custom font.
  71.        ''' </summary>
  72.        Public ReadOnly Property Font() As FontFamily
  73.            Get
  74.                Return fontCollection.Families(0)
  75.            End Get
  76.        End Property
  77. #End Region
  78.  
  79.    End Class
  80.  
  81. #End Region
  82.  
  83. #End Region





· Esperar a que una aplicación termine de CARGAR

Nota : El código no está muy simplificado, pero se puede usar y funciona bien.
Nota 2: Esto sirve para aquellas aplicaciones a las que no le afecta un "Process.WaitForInputIdle", de lo contrario es una tontería usar este code tán largo y bruto.

Ejemplo de uso:

Código
  1.    Private Sub Wait_For_Application_To_Load(ByVal APP_Path As String, Optional ByVal APP_Arguments As String = Nothing)
  2.  
  3.        Process.Start("Photoshop.exe")
  4.        Timer_CheckCPU.Tag = "Photoshop"
  5.        Timer_CheckCPU.Enabled = True
  6.        While Not Timer_CheckCPU.Tag = ""
  7.            Application.DoEvents()
  8.        End While
  9.    End Sub


Código
  1. #Region " Wait For Application To Load (UNFINISHED AND WAITING TO BE IMPROVED)"
  2.  
  3.    Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
  4.    Private WithEvents Timer_CheckCPU As New Timer
  5.  
  6.    Dim Memory_Value_Changed As Boolean
  7.    Dim CPU_Changed As Boolean
  8.    Dim CPU_Time As Boolean
  9.    Dim Running_Time As Boolean
  10.    Private _desiredTime_ms As Integer = 1500
  11.  
  12.    Private Sub Timer_CheckCPU_Tick(sender As Object, ev As EventArgs) Handles Timer_CheckCPU.Tick
  13.        Timer_CheckCPU.Enabled = False
  14.        Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName(Timer_CheckCPU.Tag)
  15.        Dim hprocess As Process = pProcess(0)
  16.        If hprocess Is Nothing Then
  17.            Running = False
  18.            Timer_CheckCPU.Enabled = True
  19.            Return
  20.        End If
  21.        Running = True
  22.        Memory = hprocess.PrivateMemorySize64
  23.        CPUTotal = hprocess.TotalProcessorTime.TotalMilliseconds
  24.  
  25.        If AllConditionsGood() Then
  26.            If Not (_countdown.IsRunning) Then
  27.                _countdown.Reset()
  28.                _countdown.Start()
  29.            End If
  30.            Dim _elapsed As Long = _countdown.ElapsedMilliseconds
  31.            If _elapsed >= _desiredTime_ms Then
  32.                Timer_CheckCPU.Tag = ""
  33.                Return
  34.            End If
  35.        Else
  36.            _countdown.Reset()
  37.        End If
  38.        Timer_CheckCPU.Enabled = True
  39.    End Sub
  40.  
  41.    Private Function AllConditionsGood() As Boolean
  42.        If CPU_Time Then Return False
  43.        If Memory_Value_Changed Then Return False
  44.        If Running_Time Then Return False
  45.        Return True
  46.    End Function
  47.  
  48.    Private _countdown As New Stopwatch
  49.  
  50.    Private _Running As Boolean = False
  51.    Public WriteOnly Property Running() As Boolean
  52.        Set(ByVal value As Boolean)
  53.            _Running = value
  54.            If value Then
  55.                Running_Time = False
  56.            Else
  57.                Running_Time = True
  58.            End If
  59.        End Set
  60.    End Property
  61.  
  62.    Private _CPUTotal As Double
  63.    Public WriteOnly Property CPUTotal() As Double
  64.        Set(ByVal value As Double)
  65.            CPU = value - _CPUTotal 'used cputime since last check
  66.            _CPUTotal = value
  67.        End Set
  68.    End Property
  69.  
  70.    Private _CPU As Double
  71.    Public WriteOnly Property CPU() As Double
  72.        Set(ByVal value As Double)
  73.            If value = 0 Then
  74.                CPU_Time = False
  75.            Else
  76.                CPU_Time = True
  77.            End If
  78.            _CPU = value
  79.        End Set
  80.    End Property
  81.  
  82.    Private _Memory As Long
  83.    Public WriteOnly Property Memory() As Long
  84.        Set(ByVal value As Long)
  85.            MemoryDiff = Math.Abs(value - _Memory)
  86.            _Memory = value
  87.        End Set
  88.    End Property
  89.  
  90.    Private _MemoryDiff As Long
  91.    Public WriteOnly Property MemoryDiff() As Long
  92.        Set(ByVal value As Long)
  93.            If value = _MemoryDiff Then
  94.                Memory_Value_Changed = False
  95.            Else
  96.                Memory_Value_Changed = True
  97.            End If
  98.            _MemoryDiff = value
  99.        End Set
  100.    End Property
  101.  
  102. #End Region
9258  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 9 Abril 2013, 20:23 pm
· Devuelve el título de la ventana de un proceso

Código
  1. #Region " Get Process Window Title Function "
  2.  
  3.    ' [ Get Process Window Title Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' MsgBox(Get_Process_Window_Title("cmd"))
  9.    ' MsgBox(Get_Process_Window_Title("cmd.exe"))
  10.  
  11.    Private Function Get_Process_Window_Title(ByVal ProcessName As String) As String
  12.        If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4)
  13.        Dim ProcessArray = Process.GetProcessesByName(ProcessName)
  14.        If ProcessArray.Length = 0 Then Return Nothing Else Return ProcessArray(0).MainWindowTitle
  15.    End Function
  16.  
  17. #End Region



· Devuelve el handle de un proceso
Código
  1. #Region " Get Process Handle Function "
  2.  
  3.    ' [ Get Process Handle Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' MsgBox(Get_Process_Handle("cmd"))
  9.    ' MsgBox(Get_Process_Handle("cmd.exe"))
  10.  
  11.    Private Function Get_Process_Handle(ByVal ProcessName As String) As IntPtr
  12.        If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4)
  13.        Dim ProcessArray = Process.GetProcessesByName(ProcessName)
  14.        If ProcessArray.Length = 0 Then Return Nothing Else Return ProcessArray(0).MainWindowHandle
  15.    End Function
  16.  
  17. #End Region



· Devuelve el PID de un proceso

Código
  1. #Region " Get Process PID Function "
  2.  
  3.    ' [ Get Process PID Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' MsgBox(Get_Process_PID("cmd"))
  9.    ' MsgBox(Get_Process_PID("cmd.exe"))
  10.  
  11.    Private Function Get_Process_PID(ByVal ProcessName As String) As IntPtr
  12.        If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4)
  13.        Dim ProcessArray = Process.GetProcessesByName(ProcessName)
  14.        If ProcessArray.Length = 0 Then Return Nothing Else Return ProcessArray(0).Id
  15.    End Function
  16.  
  17. #End Region
9259  Programación / .NET (C#, VB.NET, ASP) / Sobre los child handles en: 9 Abril 2013, 19:54 pm
Necesito listar todos los handles hijos de un proceso, para eso utilizo esta Class: http://kellyschronicles.wordpress.com/2008/06/23/get-window-handles-associated-with-process-in-vb-net/

Código
  1. Imports System.Collections.Generic
  2. Imports System.Runtime.InteropServices
  3. Imports System.Text
  4.  
  5. Public Class ApiWindow
  6.    Public MainWindowTitle As String = ""
  7.    Public ClassName As String = ""
  8.    Public hWnd As Int32
  9. End Class
  10.  
  11. ''' <summary>
  12. ''' Enumerate top-level and child windows
  13. ''' </summary>
  14. ''' <example>
  15. ''' Dim enumerator As New WindowsEnumerator()
  16. ''' For Each top As ApiWindow in enumerator.GetTopLevelWindows()
  17. '''    Console.WriteLine(top.MainWindowTitle)
  18. '''    For Each child As ApiWindow child in enumerator.GetChildWindows(top.hWnd)
  19. '''        Console.WriteLine(" " + child.MainWindowTitle)
  20. '''    Next child
  21. ''' Next top
  22. ''' </example>
  23. Public Class WindowsEnumerator
  24.  
  25.    Private Delegate Function EnumCallBackDelegate(ByVal hwnd As Integer, ByVal lParam As Integer) As Integer
  26.  
  27.    ' Top-level windows.
  28.    Private Declare Function EnumWindows Lib "user32" _
  29.     (ByVal lpEnumFunc As EnumCallBackDelegate, ByVal lParam As Integer) As Integer
  30.  
  31.    ' Child windows.
  32.    Private Declare Function EnumChildWindows Lib "user32" _
  33.     (ByVal hWndParent As Integer, ByVal lpEnumFunc As EnumCallBackDelegate, ByVal lParam As Integer) As Integer
  34.  
  35.    ' Get the window class.
  36.    Private Declare Function GetClassName _
  37.     Lib "user32" Alias "GetClassNameA" _
  38.     (ByVal hwnd As Integer, ByVal lpClassName As StringBuilder, ByVal nMaxCount As Integer) As Integer
  39.  
  40.    ' Test if the window is visible--only get visible ones.
  41.    Private Declare Function IsWindowVisible Lib "user32" _
  42.     (ByVal hwnd As Integer) As Integer
  43.  
  44.    ' Test if the window's parent--only get the one's without parents.
  45.    Private Declare Function GetParent Lib "user32" _
  46.     (ByVal hwnd As Integer) As Integer
  47.  
  48.    ' Get window text length signature.
  49.    Private Declare Function SendMessage _
  50.     Lib "user32" Alias "SendMessageA" _
  51.     (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
  52.  
  53.    ' Get window text signature.
  54.    Private Declare Function SendMessage _
  55.     Lib "user32" Alias "SendMessageA" _
  56.     (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As StringBuilder) As Int32
  57.  
  58.    Private _listChildren As New List(Of ApiWindow)
  59.    Private _listTopLevel As New List(Of ApiWindow)
  60.  
  61.    Private _topLevelClass As String = ""
  62.    Private _childClass As String = ""
  63.  
  64.    ''' <summary>
  65.    ''' Get all top-level window information
  66.    ''' </summary>
  67.    ''' <returns>List of window information objects</returns>
  68.    Public Overloads Function GetTopLevelWindows() As List(Of ApiWindow)
  69.  
  70.        EnumWindows(AddressOf EnumWindowProc, &H0)
  71.  
  72.        Return _listTopLevel
  73.  
  74.    End Function
  75.  
  76.    Public Overloads Function GetTopLevelWindows(ByVal className As String) As List(Of ApiWindow)
  77.  
  78.        _topLevelClass = className
  79.  
  80.        Return Me.GetTopLevelWindows()
  81.  
  82.    End Function
  83.  
  84.    ''' <summary>
  85.    ''' Get all child windows for the specific windows handle (hwnd).
  86.    ''' </summary>
  87.    ''' <returns>List of child windows for parent window</returns>
  88.    Public Overloads Function GetChildWindows(ByVal hwnd As Int32) As List(Of ApiWindow)
  89.  
  90.        ' Clear the window list.
  91.        _listChildren = New List(Of ApiWindow)
  92.  
  93.        ' Start the enumeration process.
  94.        EnumChildWindows(hwnd, AddressOf EnumChildWindowProc, &H0)
  95.  
  96.        ' Return the children list when the process is completed.
  97.        Return _listChildren
  98.  
  99.    End Function
  100.  
  101.    Public Overloads Function GetChildWindows(ByVal hwnd As Int32, ByVal childClass As String) As List(Of ApiWindow)
  102.  
  103.        ' Set the search
  104.        _childClass = childClass
  105.  
  106.        Return Me.GetChildWindows(hwnd)
  107.  
  108.    End Function
  109.  
  110.    ''' <summary>
  111.    ''' Callback function that does the work of enumerating top-level windows.
  112.    ''' </summary>
  113.    ''' <param name="hwnd">Discovered Window handle</param>
  114.    ''' <returns>1=keep going, 0=stop</returns>
  115.    Private Function EnumWindowProc(ByVal hwnd As Int32, ByVal lParam As Int32) As Int32
  116.  
  117.        ' Eliminate windows that are not top-level.
  118.        If GetParent(hwnd) = 0 AndAlso CBool(IsWindowVisible(hwnd)) Then
  119.  
  120.            ' Get the window title / class name.
  121.            Dim window As ApiWindow = GetWindowIdentification(hwnd)
  122.  
  123.            ' Match the class name if searching for a specific window class.
  124.            If _topLevelClass.Length = 0 OrElse window.ClassName.ToLower() = _topLevelClass.ToLower() Then
  125.                _listTopLevel.Add(window)
  126.            End If
  127.  
  128.        End If
  129.  
  130.        ' To continue enumeration, return True (1), and to stop enumeration
  131.        ' return False (0).
  132.        ' When 1 is returned, enumeration continues until there are no
  133.        ' more windows left.
  134.  
  135.        Return 1
  136.  
  137.    End Function
  138.  
  139.    ''' <summary>
  140.    ''' Callback function that does the work of enumerating child windows.
  141.    ''' </summary>
  142.    ''' <param name="hwnd">Discovered Window handle</param>
  143.    ''' <returns>1=keep going, 0=stop</returns>
  144.    Private Function EnumChildWindowProc(ByVal hwnd As Int32, ByVal lParam As Int32) As Int32
  145.  
  146.        Dim window As ApiWindow = GetWindowIdentification(hwnd)
  147.  
  148.        ' Attempt to match the child class, if one was specified, otherwise
  149.        ' enumerate all the child windows.
  150.        If _childClass.Length = 0 OrElse window.ClassName.ToLower() = _childClass.ToLower() Then
  151.            _listChildren.Add(window)
  152.        End If
  153.  
  154.        Return 1
  155.  
  156.    End Function
  157.  
  158.    ''' <summary>
  159.    ''' Build the ApiWindow object to hold information about the Window object.
  160.    ''' </summary>
  161.    Private Function GetWindowIdentification(ByVal hwnd As Integer) As ApiWindow
  162.  
  163.        Const WM_GETTEXT As Int32 = &HD
  164.        Const WM_GETTEXTLENGTH As Int32 = &HE
  165.  
  166.        Dim window As New ApiWindow()
  167.  
  168.        Dim title As New StringBuilder()
  169.  
  170.        ' Get the size of the string required to hold the window title.
  171.        Dim size As Int32 = SendMessage(hwnd, WM_GETTEXTLENGTH, 0, 0)
  172.  
  173.        ' If the return is 0, there is no title.
  174.        If size > 0 Then
  175.            title = New StringBuilder(size + 1)
  176.  
  177.            SendMessage(hwnd, WM_GETTEXT, title.Capacity, title)
  178.        End If
  179.  
  180.        ' Get the class name for the window.
  181.        Dim classBuilder As New StringBuilder(64)
  182.        GetClassName(hwnd, classBuilder, 64)
  183.  
  184.        ' Set the properties for the ApiWindow object.
  185.        window.ClassName = classBuilder.ToString()
  186.        window.MainWindowTitle = title.ToString()
  187.        window.hWnd = hwnd
  188.  
  189.        Return window
  190.  
  191.    End Function
  192.  
  193. End Class


Y la uso de esta manera, pero solo obtengo el "main" handle:

Código
  1. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2.    Dim enumerator As New WindowsEnumerator()
  3.    For Each top As ApiWindow In enumerator.GetTopLevelWindows()
  4.        If top.MainWindowTitle.ToLower.Contains("firefox") Then
  5.            RichTextBox1.Text += vbNewLine & ("main handle: " & top.MainWindowTitle)
  6.            For Each child As ApiWindow In enumerator.GetChildWindows(top.hWnd)
  7.                RichTextBox1.Text += vbNewLine & ("child handle: " & " " + child.MainWindowTitle)
  8.            Next
  9.        End If
  10.    Next top
  11.  
  12. End Sub

Así que algo está mal.

Lo que quiero es obtener todos los handles de un proceso, como por ejemplo el output que nos da la utilidad CommandLine "CMDOW" con este comando:

Código:
C:\>cmdow | find /i "firefox"

Código:
0x2C0242 1  912 Res Ina Ena Hid firefox  Code Sample <pre><code> Ctrl+K
0x1F0C10 1  912 Res Ina Ena Hid firefox  pinvoke.net: EnumWindowsProc (Delegate
0x6E06A8 1  912 Res Ina Ena Hid firefox  MozillaDropShadowWindowClass
0x310ADA 1  912 Res Ina Ena Hid firefox  MozillaDropShadowWindowClass
0x610D3A 1  912 Res Ina Ena Hid firefox  MozillaWindowClass
0x840A54 1  912 Res Ina Ena Hid firefox  MozillaDropShadowWindowClass
0x9A08D6 1  912 Res Ina Ena Hid firefox  Search using Google (English)
0x17E057C 1  912 Res Ina Ena Hid firefox  MozillaDropShadowWindowClass
0x2E0A5A 1  912 Res Ina Ena Hid firefox  MozillaWindowClass
0x4A04DC 1  912 Min Ina Ena Vis firefox  Get all child handles of process - Sta
0xA40994 1  912 Min Ina Ena Hid firefox  pinvoke.net: EnumWindowsProc (Delegate
0x110CF4 1  912 Min Ina Ena Hid firefox  pinvoke.net: EnumChildWindows (user32)
0x560270 1  912 Min Ina Ena Hid firefox  Get handles of process forms c# - Stac
0x7B0CCC 1  912 Min Ina Ena Hid firefox  Get child window handles in C# - Stack
0x74040A 1  912 Min Ina Ena Hid firefox  Get all child handles of process - Sta
0xC0028A 1  912 Min Ina Ena Hid firefox  Get Window Handles Associated With Pro
0xAC067C 1  912 Min Ina Ena Hid firefox  vbnet get child handles of process - B
0x6308B0 1  912 Min Ina Ena Hid firefox  Process Class (System.Diagnostics) - M
0xB20B2E 1  912 Min Ina Ena Hid firefox  How to wait the process until the proc
0xA7021C 1  912 Min Ina Ena Hid firefox  vb.net - Waiting For Process To Comple
0xD30356 1  912 Min Ina Ena Hid firefox  FreeVBCode code snippet: Execute a Pro
0x583207D0 1  912 Res Ina Ena Hid firefox  nsAppShell:EventWindow
0x3C0550 1  912 Res Ina Ena Hid firefox  DDEMLEvent
0x3E065C 1  912 Res Ina Ena Hid firefox  DDEMLMom
0x590288 1  912 Res Ina Ena Hid firefox  FirefoxMessageWindow
0x2D085A 1  912 Min Ina Ena Hid firefox  vbnet wait for process end - Buscar co
0x5F0584 1  912 Res Ina Ena Hid firefox  MCI command handling window
0x2307D2 1  912 Res Ina Ena Hid firefox  MozillaHiddenWindowClass
0x1760466 1  912 Res Ina Dis Hid firefox  MSCTFIME UI
0x200CB4 1  912 Res Ina Dis Hid firefox  Default IME
0x510320 1  912 Res Ina Dis Hid firefox  Default IME
9260  Programación / .NET (C#, VB.NET, ASP) / Sobre los Handles del SystemTray... en: 9 Abril 2013, 19:48 pm
Este tema me lleva días matándome, he creado 5 posts sobre temas relacionados con los handles en StackOverFlow, porque no me aclaro nada con las funciones de la API (FindWindow, FindWindowEx, etc...).

A ver, lo que necesito es, saber si una aplicación de terceros ha mostrado su icono en el systemtray, es decir, saber si "X" icono existe en el SysTray, ya séa buscando el icono por el handle del proceso, o por el nombre de la ventana, o como séa.

Para esto, primero intento obtener el handle de la aplicación, y luego el handle de mi systray, pero hasta aquí, ya no sé como seguir ni que debo hacer.

Código
  1. Imports System.Runtime.InteropServices
  2.  
  3. Public Class Form1
  4.  
  5.    Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  6.    Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
  7.  
  8.    Public Shared Function WindowHandle(sTitle As String) As Long
  9.        Return FindWindow(vbNullString, sTitle)
  10.    End Function
  11.  
  12.    Private Shared Function GetSystemTrayHandle() As IntPtr
  13.        Dim hWndTray As IntPtr = FindWindow("Shell_TrayWnd", Nothing)
  14.        If hWndTray <> IntPtr.Zero Then
  15.            hWndTray = FindWindowEx(hWndTray, IntPtr.Zero, "TrayNotifyWnd", Nothing)
  16.            If hWndTray <> IntPtr.Zero Then
  17.                hWndTray = FindWindowEx(hWndTray, IntPtr.Zero, "SysPager", Nothing)
  18.                If hWndTray <> IntPtr.Zero Then
  19.                    hWndTray = FindWindowEx(hWndTray, IntPtr.Zero, "ToolbarWindow32", Nothing)
  20.                    Return hWndTray
  21.                End If
  22.            End If
  23.        End If
  24.  
  25.        Return IntPtr.Zero
  26.    End Function
  27.  
  28.    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  29.        MsgBox(WindowHandle("Steam")) ' 6687230
  30.        MsgBox(GetSystemTrayHandle()) ' 65728
  31.    End Sub
  32.  
  33. End Class

Páginas: 1 ... 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 [926] 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines