View previous topic :: View next topic |
Author |
Message |
MMM-304 Expert Cheater Reputation: 0
Joined: 17 Aug 2020 Posts: 166 Location: Milkey Way
|
Posted: Wed Dec 30, 2020 12:56 am Post subject: Value From a TextBox in C++ |
|
|
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
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Wed Dec 30, 2020 1:42 am Post subject: |
|
|
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 |
|
|
MMM-304 Expert Cheater Reputation: 0
Joined: 17 Aug 2020 Posts: 166 Location: Milkey Way
|
Posted: Wed Dec 30, 2020 3:26 am Post subject: |
|
|
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
|
|
Back to top |
|
|
OldCheatEngineUser Whateven rank Reputation: 20
Joined: 01 Feb 2016 Posts: 1587
|
Posted: Wed Dec 30, 2020 10:29 am Post subject: |
|
|
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 |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Wed Dec 30, 2020 4:17 pm Post subject: |
|
|
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 |
|
|
|