Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C# Displaying an array on Form

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Itachi08
Expert Cheater
Reputation: 0

Joined: 03 Nov 2006
Posts: 101

PostPosted: Thu Jun 12, 2014 8:26 am    Post subject: C# Displaying an array on Form Reply with quote

Hello everyone.
I am working on some tool similar to cheat engine(very basic for personal use).
1. maybe its a newbie question but i don't know the best way to Display
the result of a scan onto the Form or any type of window.
2. even if i do get to display them on the Form. how will I display IntPtr
values as Hex(on the Form)??

_________________
Back to top
View user's profile Send private message
Matze500
Expert Cheater
Reputation: 8

Joined: 25 Jan 2012
Posts: 241
Location: Germany

PostPosted: Thu Jun 12, 2014 1:22 pm    Post subject: Reply with quote

you have to convert the IntPtr with an own method into an hex value store it as a string and then you can put it into a label on a form.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu Jun 12, 2014 2:02 pm    Post subject: Reply with quote

You can format the IntPtr via the ToString method like this:
Code:
Console.WriteLine(new IntPtr(12345).ToString("X"));


You can also pad the formatting with 0's if you want all the addresses to align together:
Code:
Console.WriteLine(new IntPtr(12345).ToString("X8"));


Adding the 8 makes sure that the string fills up at least 8 characters. Any missing slot will be a 0.

So for example the output of both of those will look like:
BBDF5E
00BBDF5E

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Itachi08
Expert Cheater
Reputation: 0

Joined: 03 Nov 2006
Posts: 101

PostPosted: Fri Jun 13, 2014 5:11 am    Post subject: Reply with quote

Matze500: thanks but what if the result is like a million addresses at first - how will i display all of them on the form??

atom0s: thank you but last time i tried using IntPtr's ToString it was not actual hex value.. but an integer or something..

another thing i just tested the program to scan for a value.
I used a List<IntPtr> to save the scan result which is probably not the best way to do it(takes alot of memory i guess)..
I tried scanning once and after a certain time an exception(indexOutOfBounds) was thrown by the result List so im guessing you can't add millions of objects on a List haha..

any ideas?? am kinda new to programming an especially cSharp so sorry in advance :p

_________________
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Jun 13, 2014 1:38 pm    Post subject: Reply with quote

IntPtr's ToString will default to an integer if you do not give it any formatting like I did in the example above with the "X" and "X8". Those format the string into hexadecimal.

As for your exception, set Visual Studio to break on all exceptions so you can see where it is occurring at. Otherwise there is not much anyone can do to help you without seeing the source code.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites