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 


Value From a TextBox in C++

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

Joined: 17 Aug 2020
Posts: 108
Location: Milkey Way

PostPosted: Wed Dec 30, 2020 12:56 am    Post subject: Value From a TextBox in C++ Reply with quote

How do i parse a string from a TextBox as Hexadecimal Value and if its not a Hex value then show an error message. Also the reverse of it ie convert a Hex value to a string and store it in TextBox's Text
_________________
Hitler PeaceBeUponYou
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 157

Joined: 25 Jan 2006
Posts: 8143
Location: 127.0.0.1

PostPosted: Wed Dec 30, 2020 1:42 am    Post subject: Reply with quote

If you are using a dialog:
- GetDlgItemTextA / GetDlgItemTextW

If you are using a standard window control, or in general:
- GetWindowTextA / GetWindowTextW

You can also obtain the text via SendMessage/PostMessage with 'WM_GETTEXT'.

With that, you can then parse the text as you see fit.

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

Joined: 17 Aug 2020
Posts: 108
Location: Milkey Way

PostPosted: Wed Dec 30, 2020 3:26 am    Post subject: Reply with quote

sorry i dont get it.
For more info I have this text Box in a Form I designed and i want to parse its text as a hexadecimal value. I know how to parse it as decimal (double) like this:
Code:
 double value = Double::Parse(textBoxMain->Text);

but i want it to be parsed as Hex. If i do it like this ^ and try to write a hex value it causes an exception

_________________
Hitler PeaceBeUponYou
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 18

Joined: 01 Feb 2016
Posts: 1580

PostPosted: Wed Dec 30, 2020 10:29 am    Post subject: Reply with quote

well, it doesnt look like he is doing win32 programming.
probably a library that subclass window controls, and it doesnt look like he have a handle to edit control.

MMM-304 wrote:
How do i parse a string from a TextBox as Hexadecimal Value


how do you define as hex?
- string contain hex digits
- or to get hex equivalent of that ASCII code

how do you define parsing?

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
atom0s
Moderator
Reputation: 157

Joined: 25 Jan 2006
Posts: 8143
Location: 127.0.0.1

PostPosted: Wed Dec 30, 2020 4:17 pm    Post subject: Reply with quote

MMM-304 wrote:
sorry i dont get it.
For more info I have this text Box in a Form I designed and i want to parse its text as a hexadecimal value. I know how to parse it as decimal (double) like this:
Code:
 double value = Double::Parse(textBoxMain->Text);

but i want it to be parsed as Hex. If i do it like this ^ and try to write a hex value it causes an exception


This looks more like you're using C++/CLI (C++ .NET) I'm not familiar with their setup of things as I don't use it (or recommend it).

However, since it's just .NET in general, the setup should be similar. You'd need to attach to the textboxes input events such as 'TextChanged' or 'KeyPress' depending on how you wish to approach the goal.

From there you can just query the string the textbox has via its 'Text' property and then compare each character within the value to valid hexadecimal characters.

No idea what that should look like though, as the syntax to C++/CLI is god awful and I don't know it.

_________________
- 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