I was bored and decided in all my usual wizdom that i would make a lil program that made Emotions, basicly the file format holds the text to chang IE and it holds a 16x16 BMP that it will change into any time it occurs, the spec for this file is
<1 byte string - text to replace with icon>
<4 byte string - 16x16 BMP emoticon graphic>
but i have no idea how to do that in code, im sure its something really simple, i have enclosed a few of the finished Emotes from the guy that wrote the fomat...
Anyone have a clue where to start on pulling existing emotes apart and putting new ones together, so far all i have been able to do it pull the BMP out, but not the text...
Well I got no clue what those emotions are but oh well seems like smilies or something that replace a certain text in some program automatically... (am I right on this?)
now if you want to make a custom file format you can just do it by using get and put in binary mode.
Now I really don't understand your specs since I got no clue what a one byte string is supposed to be... it is described as "text to replace with icon" but one byte could be only one character... so are you sure it is one byte? If it (the one byte string) would be a token to devide different parts what is it and why would there be one in the beginning of the file...?
so now to the 4byte string... is this supposed to be the picture? Are those pictures black and white? That way you could have 8 pixels per byte, 4*8 would make 32 pixels but don't you have 16*16=256???
I had the same problem not understanding what the 1 byte and 4 byte is, i assume its some form or Identifier or Delimiter...
<1 byte string - text to replace with icon>
This refers to the ':o)' part of the file, if you open the files in Notepad u can see the smilie text as the first thing, but i have no idea what the 1 byte string is, i thought was some form of Delimiter.....
<4 byte string - 16x16 BMP emoticon graphic>
This then refers to the location of the actual Graphic, but i can't see how a 16pixel X 16pixel X 256 Color Bitmap can be 4bytes, so again i think this is some kind of Delimited/Identifer....
These files are like lil "plug-ins" for a chat program... on the left hand side of this box that i am typing in to post a message is Table that contains the Images of the Smilies, in the chat program in question it would read the Emotes Directorty and the above files into memory and parse out the image, and add them to the Smiles Table, then anywhere in the chat text that it sees the 'smilie text' like the ':o)' it will be replaced with the 16x16 bitmap, Very Much like Yahoo chat does....
These VEM files can be customised tho, so u can make it change anything into a picture....the chat in question is Voodoo Chat , the file info can be found here, 50% Here Gesture Format + Basic and the [URL=http://www.voodoochat.com/darkhorse/forum.php?op=readthread&threadid=6] Emoticons Format Info [\URL]....
I have just read it again, the 1 byte says its the Length of the thing, so the 1 Byte and 4bytes are identifiers that tell a program how long the following data is going to be... I dunno i have never really done much in this sorta field....
One i understand the basic principle, i can figure the rest out, its just getting a grip on the Idea....
OK i have been playing with the Idea's i got since posting and i understand 90% of it now, im just having trouble putting my thoughts into code, i have some code that i have been playing with that looks like it does the job... I can also explain the 1 Byte and 4 Byte Strings now... here goes
The First byte in the file is the len of the Smile Text so in the case of the attached file its Hex Value is 08 (The 1 Byte Len) so that tells me that the Smilie Text is 8 Characters long...
I then read the next 8 characters and find they are "(smiley)" which is 8 Letters, so now i have read the first 9 bytes, the next 4 (4 Byte String) is also a length in Hex in this case 00 00 04 36 so the 4 Byte String tells me that the next part of the file is 436 Bytes long, so i need to read the next part...
The above apears to have been set wrong, its actually closer to double the size, anyway i decided i would just take Byte 1 + Len of Smile Text + 4 and then read the remainder of the file into a Variable and push that into an ImgBox but that dont work, if i write that data i can see the bmp, but i cant seem to get it into a Picture Box or Image Box...
Hopefully this explained it, and if not maybe my code will, or maybe there are other better ways to do it....
My main problem is displaying the imgParser Varibale in a Picture/Image box, i keep getting errors no matter what i declare it as...
Private Sub Try_Click()
Dim strParse As String, strParsing As String, _
lenParser As String, FileLenz As Integer, _
imgParser, lenImgStart As Integer
'text1 is the path to the emote file
Open Text1.Text For Binary Access Read As #1
FileLenz = FileLen(Text1.Text) 'get files len
strParse = Input(FileLenz, #1) ' read the whole file into the buffer
lenParser = Asc(Mid(strParse, 1, 1))
txtEmote.Text = Mid(strParse, 2, Val(lenParser))
lenImgStart = 1 + Val(lenParser)
lenParser = Mid(strParse, lenImgStart, 4)
imgParser = Mid(strParse, lenImgStart + 4, FileLenz - lenImgStart + 4)
imgEmote = imgParser
Close
End Sub
OK i have the Decompile working fine, but, i need away to load the picture into the imgEmote image box control without first writting the data to disk....
Here how i did it, Can someone tell me how to use the VB Code tag on here ??
Private Sub Command2_Click()
Dim strParse As String, strParsing As String, _
lenParser As String, FileLenz As Integer, _
imgParser, lenImgStart As Integer
Open Text1.Text For Binary Access Read As #1
FileLenz = FileLen(Text1.Text) 'get files len
strParse = Input(FileLenz, #1) ' read the whole file into the buffer
lenParser = Asc(Mid(strParse, 1, 1))
txtEmote.Text = Mid(strParse, 2, Val(lenParser))
lenImgStart = 1 + Val(lenParser)
lenParser = Mid(strParse, lenImgStart, 4)
imgParser = Mid(strParse, lenImgStart + 5, FileLenz - lenImgStart + 4)
Open App.Path & "/" & "test.bmp" For Output As #2
Print #2, imgParser
Close
imgEmote.Picture = LoadPicture(App.Path & "/" & "test.bmp")
Close
End Sub
I want to be able to put the imgParser Varibale straight into the imgEmote ImageBox Control without writting it to disk first, once i can do this i can work on tidier code... any one have an idea how ??
alright I even though I think it is the best way you could set up a dc in memory copy the memory to the dc and than blit it from there...
look into copymemory and stuff like this. (I might help some more but today I wont have the time, so just post a new thread many people here know how to do that kind of stuff)