Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 11:03

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[VB.NET] Need a little help

Discussion on [VB.NET] Need a little help within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2008
Posts: 556
Received Thanks: 545
[VB.NET] Need a little help

I created a windows tool to minimize, maximize, hide, and show sro_client in vb.net. It works great, but how is a way to make it list the clients, and make it possible to rename them and chose them to hide, because mine only supports one client ^^

Code:
Imports System.Runtime.InteropServices 'Import #1
Imports System.Diagnostics 'Import #2
Public Class Form1
    Const SW_HIDE As Integer = 0 'Hide Widnow
    Const SW_RESTORE As Integer = 9 'Show Window
    Const SW_MINIMIZE As Integer = 6 'Minimize Window
    Const SW_MAXIMIZE As Integer = 3 'Maximize Window
    Dim hWnd As Integer 'Special command
    Dim p As Process() = Process.GetProcessesByName("sro_client") 'Process Name
    <DllImport("User32")> Private Shared Function ShowWindow(ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer 'dll Imports
    End Function

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        hWnd = p(0).MainWindowHandle.ToInt32 'Handle Window
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
         ShowWindow(hWnd, SW_HIDE) 'Hide Window Button
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ShowWindow(hWnd, SW_RESTORE) 'Show Window Button
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        ShowWindow(hWnd, SW_MINIMIZE) 'Minimize Window Button
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        ShowWindow(hWnd, SW_MAXIMIZE) 'Maximize Window Button
    End Sub
End Class
Murgen is offline  
Old 06/26/2011, 12:37   #2
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
Loop all processes and ask if ProcessName = "SRO_Client" and save MainWindowHandle.
Kraizy​ is offline  
Old 06/26/2011, 18:20   #3
 
xXTraXx's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 292
Received Thanks: 84
BTW if you are using .NET (and not vb6) the handle is an IntPtr, not a integer . (I know if you use integer it will work too, but IntPtr is better )
xXTraXx is offline  
Old 06/26/2011, 18:25   #4
 
elite*gold: 0
Join Date: Nov 2007
Posts: 959
Received Thanks: 602
in c# I'd do this like this:
Quote:
Process[] AllProcesses = Process.GetProcesses();
List<Process> Sro_clients = new List<Process>();
foreach(Process process in AllProcesses)
{
if(process.Name == "SRO_Client")
{
Sro_clients.Add(process);
}
}
then you can work with that list..^^
good luck with your project!
vorosmihaly is offline  
Old 06/26/2011, 23:19   #5
 
elite*gold: 0
Join Date: Mar 2008
Posts: 556
Received Thanks: 545
Quote:
Originally Posted by vorosmihaly View Post
in c# I'd do this like this:


then you can work with that list..^^
good luck with your project!
I will convert that and see what I get.

Btw, your domain is suspended.
Murgen is offline  
Old 06/27/2011, 13:26   #6
 
chea77er's Avatar
 
elite*gold: 12
Join Date: Oct 2009
Posts: 290
Received Thanks: 194
BTW: You can use
Code:
List<Process> sro_clients = new List<Process>();
sro_clients.AddRange(Process.getprocessesbyname("sro_client");
chea77er is offline  
Old 06/29/2011, 23:45   #7
 
elite*gold: 0
Join Date: Sep 2010
Posts: 783
Received Thanks: 921
here you can do it with autoshit aka autoit !
Quote:
#include <GuiListBox.au3>

$win = WinList("[CLASS:CLIENT]")
For $i = 1 To $win[0][0]
_AddToList($win[$i][0])
Next

Func _AddToList($string)
_GUICtrlListBox_AddString($list,$string)
EndFunc
i hope i helped
ÑõÑ_Ŝŧóp is offline  
Reply




All times are GMT +1. The time now is 11:04.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.