Register for your free account! | Forgot your password?

You last visited: Today at 19:44

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

Advertisement



Accessing GUI Thread

Discussion on Accessing GUI Thread within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
Accessing GUI Thread

Hey guys,
I'm having problems with editing my gui,
i use vb.NET and for example i want to add something to my listbox from another thread.
I used a lot of invoke styles but everyone gives me
"BeginInvoke or Invoke cannot be called before window handle has been created."
btw, I have to do a lot changes so it should not sooo long.
I already checked CheckForIllegalCrossThreadCalls = False but it doesnt work =/ Waitin for ur helps..
sarkoplata is offline  
Old 07/02/2011, 02:43   #2

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
Ok.. now i add some text to my listbox ^^
PHP Code:
 Public Shared Sub Log(ByVal oo As Object)
        
Application.OpenForms(0).Invoke(New MethodInvoker(Function()
                                                              
Main.LogBox.Items.Add("[" DateTime.Now.ToLongTimeString "]" oo)
                                                          
End Function)) 
But when i create same sub for changing a label's text, it doesnt work.
PHP Code:
 Public Shared Sub Log(ByVal oo As string labe as label)
        
Application.OpenForms(0).Invoke(New MethodInvoker(Function()
                                                              
labe.text=oo
                                                          End 
Function)) 
BUT If i create sub with only 1parameter again, no problems ; like this
PHP Code:
Public Shared Sub ChangeLabelText(ByVal oo As String)
        
Application.OpenForms(0).Invoke(New MethodInvoker(Function()
                                                              
Main.NameLabel.Text oo
                                                          End 
Function))
    
End Sub 
So.. will i create the sub again and again for each label?

sarkolata
sarkoplata is offline  
Old 07/02/2011, 19:41   #3
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
PHP Code:
//Add a text to any label, for example when clicking a button:
Public Sub Button_Click()
     
Log(New Object() {Label1"myText"})
End Sub

//methods to invoke:
Private Delegate Sub testDel(cLabel as LabelText as String)

Public 
Sub Log(params() as Object)
     
Me.Invoke(New testDel(AddressOf invokeTest), params(0), params(1))
     
//params(0) = Label1
     //params(1) = "myText"
End Sub

Private Sub invokeTest(cLabel as LabelText as String)
     
cLabel.Text Text
End Sub 
But I did not try the code, maybe u will have to change something...
Kraizy​ is offline  
Reply


Similar Threads Similar Threads
Pk2 Editor - There is a problem accessing the GFXFileManager.dll
06/24/2010 - SRO Private Server - 4 Replies
Hi, I am trying to have a bot and when i turn on pk2 editor there is an error (this which i have written in title). Can someone help me and tell WTF is going on :P ?? I have Windows 7 if someone asks.
Tutorial[C#]: Accessing form properties from different thread
01/03/2010 - Coding Tutorials - 3 Replies
Hello, I originally wrote this tutorial for Stealthex ,but I will post it here aswell. The purpose of the tutorial is to teach you how to access form members from threads other than the main thread. I hope you like it. // In the beggining of my C# development I encounted much problems when I wanted to access the properties on my Form.
Accessing storage
05/13/2008 - RF Online - 5 Replies
Question! Is there a way to access your storage bank from anywhere?
Accessing Servers
10/27/2007 - Conquer Online 2 - 2 Replies
I think i've found a new way to get into TQ's servers using FTP but I'm having trouble with the username and password. I think I need to use an email address for the password. Ive been trying for a couple of days but i've only been using brutus and haven't had much luck. If anyone can offer some assistance or advice PM me



All times are GMT +1. The time now is 19:45.


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.