Author | Message | Time |
---|---|---|
FrostWraith | As some of you may know, Skywing made a nifty program to read icons. Ok. What I did was use his program to make a new (Blank) bni file which contained the 1 (default) image. In VB, I have been able to parse this correctly. Now to move onto the real bni files. Spht made a legacy icons file (which Skywing's program can parse correctly). All I'm working on is getting the first one out of it, but the code for some reason doesn't work for this file. Here is my code (sure criticize me). Any help appreciated [code]Private Sub FRead() Dim nFreefile As Integer, strData As String nFreefile = FreeFile strPath = "C:\Documents and Settings\Admin\Desktop\IconView\legacy_icons.bni" Open strPath For Binary Access Read As #nFreefile strData = String(LOF(nFreefile), Chr$(0)) Get #nFreefile, , strData Close #nFreefile Debuff.DebuffPacket strData With Header .HeaderLength = Debuff.DebuffDWORD .BNIVersion = Debuff.DebuffWORD Debuff.RemoveWORD .NumIcons = Debuff.DebuffDWORD .DataStart = Debuff.GetDWORD End With Debuff.RemoveDWORD With Info .Flags = Debuff.DebuffDWORD .Width = Debuff.DebuffDWORD .Height = Debuff.DebuffDWORD .Game = Debuff.DebuffDWORD End With With THeader .InfoLength = Debuff.DebuffBYTE .ColorMapType = Debuff.DebuffBYTE .ImageType = Debuff.DebuffBYTE .ColorMapSpecification = Debuff.DebuffRaw(5) .XOrigin = Debuff.DebuffWORD .YOrigin = Debuff.DebuffWORD .Width = Debuff.DebuffWORD .Height = Debuff.DebuffWORD .Depth = Debuff.DebuffBYTE .Descriptor = Debuff.DebuffBYTE .NumChars = Debuff.DebuffBYTE End With Dim x As Long, y As Long, h As Long h = Me.hdc For y = 0 To 13 For x = 0 To 27 TempBlue = Debuff.DebuffBYTE TempGreen = Debuff.DebuffBYTE TempRed = Debuff.DebuffBYTE SetPixel h, x, 13 - y, RGB(TempRed, TempGreen, TempBlue) Next Next End Sub[/code] | September 23, 2006, 2:35 AM |
Kp | [quote author=FrostWraith link=topic=15772.msg158750#msg158750 date=1158978919]Here is my code (sure criticize me). [code]"C:\Documents and Settings\Admin\Desktop\IconView\legacy_icons.bni"[/code][/quote] OK! I see two problems. First, you're using VB. Second, you appear to be logged in as an administrator. Both of these are bad ideas. You should not run as an administrator for daily operation of the computer, especially since Microsoft finally got multiple concurrent users somewhat working on a desktop OS with Windows XP (it's still pretty flaky, though). Among other problems, XP seems not to support having one user on the console and another user logged in concurrently on an active RDP session. All that aside, you could use fast user switching to switch to an administrator account on those rare occasions where you need privilege. For normal use, you should use a non-privileged user account. I'll let someone else lay into you for using VB. | September 23, 2006, 3:27 AM |
dRAgoN | The data is in standerd TGA format you will need to write a decompressor for it before printing the pixels. | September 23, 2006, 4:03 AM |
FrostWraith | Thanks for observing I use VB, and that I'm logged on as an Administator. In fact, there is only one account on this computer (Admin). Now I will have to look in decompressing the data. Edit: Can anyone show me an article that helps with decompressing the data. | September 23, 2006, 2:37 PM |
rabbit | http://www.google.com/search?client=opera&rls=en&q=TGA+specification&sourceid=opera&ie=utf-8&oe=utf-8 | September 23, 2006, 2:51 PM |
FrostWraith | Apparently I have some of the code correct because it can open bni files that only have 1 image inside. But when files with multiple images come around, it fails. | September 23, 2006, 5:49 PM |
dRAgoN | This will fill the icons array which is after the main bni header. [code] With BHead .HeadLength = Reader.GetDWORD .Version = Reader.GetWORD .Unknowen = Reader.GetWORD .NumberOfIcons = Reader.GetDWORD .LocationStart = Reader.GetDWORD ReDim sIcons(.NumberOfIcons - 1) As ICON_STRUCT 'add a check to be sure the icon count is never '0'. End With Dim I As Long For I = LBound(sIcons) To UBound(sIcons) With sIcons(I) .Flags = Reader.GetDWORD .Width = Reader.GetDWORD .Height = Reader.GetDWORD If .Flags = 0 Then .Icon = Reader.GetStringByLength(4) If InStr(.Icon, Chr(0)) Then .Icon = "None" Else Reader.GetDWORD End If Else Reader.GetDWORD End If End With Next I[/code] | September 23, 2006, 9:36 PM |