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 


Question For Hex
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sun Nov 25, 2007 11:15 am    Post subject: Question For Hex Reply with quote

How do you convert A Hex number to decimal and dec to hex???
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Sun Nov 25, 2007 11:27 am    Post subject: Reply with quote

Try this:
http://www.easycalculation.com/hex-converter.php

_________________
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sun Nov 25, 2007 11:50 am    Post subject: Reply with quote

I am trying to make a program... I need the calculation...
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Sun Nov 25, 2007 11:55 am    Post subject: Reply with quote

Oh
Divide the decimal by 16 and record the remainder, and do it until the number is 0
Look at the remainders, from last division to first, and that's your hexidecimal

I think, someone told me that one day Rolling Eyes
Hold on...

_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Nov 25, 2007 11:56 am    Post subject: Reply with quote

You want a formula or a function?
Well in delphi its IntToHex.
In C# I think its Convert.ToHex ot something...
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sun Nov 25, 2007 12:00 pm    Post subject: Reply with quote

My delphi isn't working right now... Can u make a library with IntToHex and HexToInt please?
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Sun Nov 25, 2007 2:19 pm    Post subject: Reply with quote

All numbers are in hex, you just see it in decimal.
But here is 2 functions to convert a decimal number and hexadecimal:
Code:

Function HexToDec(NumberAsString:String):String;
begin
Result:=IntToStr(StrToInt('$'+NumberAsString));
End;

Function DecToHex(NumberAsString:String):String;
begin
Result:=Format('%x',[strtoint(NumberAsString)]);
End;

usage:
Code:
procedure TForm1.Button1Click(Sender: TObject);
begin
 if Button1.Caption='HexToDec' then
 begin
   Button1.Caption:='DecToHex';
   label1.Caption:=HexToDec(label1.Caption);
 end
 else
 begin
   Button1.Caption:='HexToDec';
   label1.Caption:=DecToHex(label1.Caption);
 end
end;
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon Nov 26, 2007 5:56 pm    Post subject: Reply with quote

Can you make it into visual basic? I wanted to make a program with vb6.0
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Mon Nov 26, 2007 6:52 pm    Post subject: Reply with quote

VB6 actually has hex commands, I just figured it out now XD
Pretty simple, can't believe it's only 1 line of code Rolling Eyes

So for a converter, you would need a button and 2 text boxes
So text1 = the decemal, and text2 = the converted hex

Code:
Private Sub Command1_Click
text2.text = Hex(text1.Text)
End Sub

_________________
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon Nov 26, 2007 7:54 pm    Post subject: Reply with quote

How to UNhex???
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Mon Nov 26, 2007 7:56 pm    Post subject: Reply with quote

Umm, you could try saving the number before, or, try this

Dec(whatever here)

Not sure if it could work though Rolling Eyes
Nvm it doesn't

Try this for saving
Goes under button click

Code:
Dim decimal as String
decimal = text1.text
text2.text = Hex(decimal)


As for converting back, on another button
Code:
text1.text = decimal

_________________
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon Nov 26, 2007 7:59 pm    Post subject: Reply with quote

Dec() is not a function.
But I did find Oct() but its not for converting hex -> dec...
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Mon Nov 26, 2007 7:59 pm    Post subject: Reply with quote

I edited my post, try it
_________________
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon Nov 26, 2007 8:03 pm    Post subject: Reply with quote

Blader I found it on google lol.

Code:
For y = 1 To Len(Text1.Text)
    num = Mid(Text1.Text, y, 2)
    Value = Value & Val("&h" & num)
    y = y + 1
Next y
Text2.Text = Value


It works lol.
Back to top
View user's profile Send private message
sphere90
Grandmaster Cheater
Reputation: 0

Joined: 24 Jun 2006
Posts: 912

PostPosted: Mon Nov 26, 2007 8:05 pm    Post subject: Reply with quote

Use the Calculator provided by Windows.
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 1, 2  Next
Page 1 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