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 


creating hex calculator with vb or c++
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
OmegaCES
Cheater
Reputation: 1

Joined: 02 Jul 2011
Posts: 44

PostPosted: Thu Nov 17, 2011 11:54 am    Post subject: Reply with quote

Just remove the ()'s off all the ones with the errors.
Code:
tRow1 = Split(Lines1(i))
tRow2 = Split(Lines2(i))

etc.

VB6 and VB2010 is very similar but still some big changes (for the better I think).
Worked when I just tested it.
Good luck.
Back to top
View user's profile Send private message
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 109

PostPosted: Thu Nov 17, 2011 4:29 pm    Post subject: Reply with quote

hahahaa.. sorry for being hard on you buddy. I could have just tested myself, but I was afraid to messup the codes so I leave it how it was and wait for your return. Thanks a bunch;
_________________
Back to top
View user's profile Send private message MSN Messenger
OmegaCES
Cheater
Reputation: 1

Joined: 02 Jul 2011
Posts: 44

PostPosted: Fri Nov 18, 2011 10:43 am    Post subject: Reply with quote

Its just trial and error usually.
Always keep a copy of the original code then mess with it and see what happens Razz

There's prob a shorter way or different way of doing it in VB2010, I haven't fully used it yet, (I just installed the professional edition that i got free from for being at uni), I've used previous versions.
Just go through the MSDN Library and you can learn alot.

Good luck wih your project.
Back to top
View user's profile Send private message
OmegaCES
Cheater
Reputation: 1

Joined: 02 Jul 2011
Posts: 44

PostPosted: Sat Nov 19, 2011 11:15 am    Post subject: Reply with quote

It seems I can't reply to PM's asianking, so I hope you find this here.
You have to specify how much you are trying to trim or what you want to trim, is the string the same every time? is it the size each time?
Examples of instr, left, right, and mid:
Code:
Dim test1 As String,test2 As Integer
        'test1 = Your string from textbox1+textbox2 would go here
        test1 = "FFFFFFFF22102F"

        'Finds where in "test1", "FFFFFFFF" starts from (would return 1 if using test1)
        test2 = InStr(test1, "FFFFFFFF", CompareMethod.Text)

        'would return FFFFFFF in textbox1
        TextBox1.Text = Microsoft.VisualBasic.Left(test1, 7)

        'Would return 22102F in textbox 2
        TextBox2.Text = Microsoft.VisualBasic.Right(test1, 6)

        'Would return 22102f in textbox 3
        TextBox3.Text = Mid(test1, 9)


Is it always just "FFFFFFF" you wish to remove.
A little more info is needed sorry.
Back to top
View user's profile Send private message
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 109

PostPosted: Sun Nov 20, 2011 9:04 pm    Post subject: Reply with quote

nevermind about textbox1 and 2. Everytime when I add up textbox1 and 2, textbox three always pop-up 8 of the F(s) before the the actual number I needed. What I really want to is to remove all the first 8 letter and just display the rest number after 8 characters. I tried the MID method; it works, but it also only work if you create a separate button alone for this code. Just wondering if there's a way I can make it happen with the same button calculation.

EDIT: The result in bold won't always come out the same. The F(s) will come out the same through any calculation. So I'm assuming there's another method to put MID code with the Calculator button instead of a separate button.
FFFFFFFF22102F.

_________________
Back to top
View user's profile Send private message MSN Messenger
OmegaCES
Cheater
Reputation: 1

Joined: 02 Jul 2011
Posts: 44

PostPosted: Mon Nov 21, 2011 12:43 pm    Post subject: Reply with quote

You can't just add the line Mid into it, you need to encorperate it into the part of the code which adds the text to the textbox.
I don't know what you are doing as I can't get it to add F'sx8 to the list.

But if you get a number say. 281474976649312(Decimal), FFFFFFFF1060h, then you will also remove that and be left with 1060h (4192) so its not the same number.
Maybe you have edited the code slightly?

I remember a problem when I was doing it in VB a while back where it was displaying them as F's, but i can't remember what was causing it.
Recheck the code.

Which are you using? the one with the spaces? ff 02 03 + AA 01 04 or just the single FF0203+AA0104
Back to top
View user's profile Send private message
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 109

PostPosted: Mon Nov 21, 2011 4:21 pm    Post subject: Reply with quote

the one with spaces... I tried it on the calculator hex and it doesn't show the F(s), but with the vb project; I get it. Weird since now that you mention it.
_________________
Back to top
View user's profile Send private message MSN Messenger
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 109

PostPosted: Tue Nov 22, 2011 7:11 am    Post subject: Reply with quote

using this project.

try something like 82022122-7FE00000

answer should be 2222122. But with the project; it totals is FFFFFFFF02222122.

_________________
Back to top
View user's profile Send private message MSN Messenger
OmegaCES
Cheater
Reputation: 1

Joined: 02 Jul 2011
Posts: 44

PostPosted: Tue Nov 22, 2011 12:31 pm    Post subject: Reply with quote

Oops haha, forgot about that.
All data types apart from Byte are Signed and anything larger than 7FFFFFFF will result in a negative number.

To have unsigned you need to "+ 4294967296#"
so if value < 0 then value = value + 4294967296#.
Back to top
View user's profile Send private message
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 109

PostPosted: Tue Nov 22, 2011 1:03 pm    Post subject: Reply with quote

so i'll have to add an if statement correct?

Code:

If hex(val(text3 < 0) then text3 + 4294967296#)

_________________
Back to top
View user's profile Send private message MSN Messenger
OmegaCES
Cheater
Reputation: 1

Joined: 02 Jul 2011
Posts: 44

PostPosted: Tue Nov 22, 2011 2:38 pm    Post subject: Reply with quote

If its less than 0 then u need to add the 4294967296# to the 2 values you are adding up as they signed because of the way vb data is stored.
if debug the code you will see if both values turn into a negative so will have to be converted to a + or the FF's will follow.
So you add the if statement to check its a negative rather than just adding it to a positive.
As for your if statement I can't remember for 2010 (don't have vb on this pc atm) but i remember in VB6 you had to do text3 = text3+4294967296#.

I'm happy to help and will continue to do so but it just appears to me that you want someone else to complete all the code and ask then just ask questions instead of trying it for yourself and if it fails then come back and ask.
Programming is all about trial and error. I don't mean to sound rude or anything so don't take this the wrong way.
Do you have any coding experience? You seem to want everything spoon fed rather than trial and error methods like most use.

Like I said I'm not being rude, i just know from past experience helping people they don't learn anything if they are given everything, I learn by trial and error (and still am learning by trial and error).

Good luck.
Back to top
View user's profile Send private message
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 109

PostPosted: Tue Nov 22, 2011 2:54 pm    Post subject: Reply with quote

you're right; i have no experiences in coding. I'm trying to understand the functionality, but it's not easy to understand. I tried a couple of ways, but because I'm stuck with not know the how to use the functions. Will not take it as rude or disrepect as I'm not good a programmer so therefore will not be angry or mad. I'll just take it as an advise to help courage myself to become better.
_________________
Back to top
View user's profile Send private message MSN Messenger
OmegaCES
Cheater
Reputation: 1

Joined: 02 Jul 2011
Posts: 44

PostPosted: Tue Nov 22, 2011 4:39 pm    Post subject: Reply with quote

Like I said, No offence was ment, I'm more than happy to help out.
It was just the questions being asked seemed like you didn't have any experience and wondered what level you was at.
(Things come out harsh that I type Razz )

I would read up on microsoft MSDN online library, helps you understand functions like Mid, Left, Right, layouts etc. I found it very useful when starting out and still do.

VB structure is pretty easy to understand
As for the code, find the part which calculates in the textboxes and edit it.

Code:
       On Error GoTo Errer
        Dim Lines1() As String, Lines2() As String
        Dim tRow1() As String, tRow2() As String
        Dim i As Integer, j As Integer
        Dim tTotal1 As Long, tTotal2 As Long
        Dim tString As String

        Lines1 = Split(Text1.Text, vbCrLf)
        Lines2 = Split(Text2.Text, vbCrLf)

        tString = ""

        For i = 0 To UBound(Lines1)
            tRow1 = Split(Lines1(i))
            tRow2 = Split(Lines2(i))
            For j = 0 To UBound(tRow1)

                tTotal1 = Val("&H" + tRow1(j))
                tTotal2 = Val("&H" + tRow2(j))

                If tTotal1 < 0 Then tTotal1 = tTotal1 + 4294967296.0#
                If tTotal2 < 0 Then tTotal2 = tTotal2 + 4294967296.0#

                If j = UBound(tRow1) Then
                    tString = tString & Hex(tTotal1 + tTotal2) & vbCrLf
                Else
                    tString = tString & Hex(tTotal1 + tTotal2) & " "
                End If
            Next j
        Next
        Text3.Text = tString
        Exit Sub
Errer:
        If Err.Number = 9 Then
            MsgBox("Invalid Format", vbCritical)
        Else
            MsgBox(Err.Number & ": " & Err.Description, vbCritical)
        End If


I've been busy with my course, so haven't had time to rewrite the code and find shorter ways of doing things.
This worked after I changed the + to a minus to test the hex values you had problems with and it worked fine.
Back to top
View user's profile Send private message
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 109

PostPosted: Wed Nov 23, 2011 9:09 am    Post subject: Reply with quote

kool... so after i did some reading...

I add a button to auto add 7fe00000 on textbox2.
What happen is each time i add 7fe00000, it keep replacing instead of added to the second line. I then try to play around with vbCrLf and it worked great.

Code:
TextBox2.Text = "7FE00000" + vbCrLf + TextBox2.Text


I'll do more reading afterwards.

[EDIT]: What I didn't like about microsoft library is; they tell you what the functions are for, but you'll have to figure out how to use it. They should have shown an example on how to use it. Very Happy

_________________
Back to top
View user's profile Send private message MSN Messenger
OmegaCES
Cheater
Reputation: 1

Joined: 02 Jul 2011
Posts: 44

PostPosted: Wed Nov 23, 2011 10:09 am    Post subject: Reply with quote

There are some examples but you can also google things and find them.

If you just wanted to add the text "7FE00000" to textbox2.text
You would do

Code:
TextBox2.Text = "7FE00000"


If you wanted to add "7FE00000" to a new line and keep the old text in the box you would do.

Add to bottom:
Code:
Textbox2.Text = Textbox2.Text & "7FE00000" & vbCrLf
or

Textbox2.Text = Textbox2.Text & vbCrLf & "7FE00000"


Add to top:
Code:
Textbox2.Text = "7FE00000" & vbCrLf & Textbox2.Text
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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