size : 3642 uploaded_on : Mon Feb 1 00:00:00 1999 modified_on : Wed Dec 8 14:03:33 1999 title : Windows icons in DOS program org_filename : IconsInDOSApp.txt author : Algirdas Kepezinskas authoremail : cyber@vil.ktu.lt description : How to use Windows icons in a Pascal DOS program keywords : tested : not tested yet submitted_by : The CKB Crew submitted_by_email : ckb@netalive.org uploaded_by : nobody modified_by : nobody owner : nobody lang : pas file-type : text/plain category : pascal-dos-graphics __END_OF_HEADER__ > How can I use Windows Icons in a Pascal Dos Program ? well, here is my quick and dirty code. It doesnt however take attention to AND mask, so icon wont be transpearant(sp?) Also it uses two files:)) sorry, i was too lazy.. Type á TIconHeader = Record ááááááááááááááááá idReserved : Word; (* Always set to 0 *) ááááááááááááááááá idType : Word;áááá (* Always set to 1 *) ááááááááááááááááá idCount : Word;ááá (* Number of icon images *) ááááááááááááááááá (* immediately followed by idCount TIconDirEntries *) ááááááááááááááá End; á TIconDirEntry = Record ááááááááááááááááááá bWidth : Byte;ááááááááá (* Width *) ááááááááááááááááááá bHeight : Byte;áááááááá (* Height *) ááááááááááááááááááá bColorCount : Byte;áááá (* Nr. of colors used, see below *) ááááááááááááááááááá bReserved : Byte;áááááá (* not used, 0 *) ááááááááááááááááááá wPlanes : Word;áááááááá (* not used, 0 *) ááááááááááááááááááá wBitCount : Word;áááááá (* not used, 0 *) ááááááááááááááááááá dwBytesInRes : LongInt; (* total number of bytes in images *) ááááááááááááááááááá dwImageOffset : LongInt;(* location of image from the beginning of file *) ááááááááááááááááá End; á TBitmapInfoHeader = Record ááááááááááááááááááááááá biSize : LongInt;ááá (* sizeof(TBitmapInfoHeader *) ááááááááááááááááááááááá biWidth : LongInt;áá (* width of bitmap *) ááááááááááááááááááááááá biHeight : LongInt;á (* height of bitmap, see notes *) ááááááááááááááááááááááá biPlanes : Word;áááá (* planes, always 1 *) ááááááááááááááááááááááá biBitCount : Word;áá (* number of color bits *) ááááááááááááááááááááááá biCompression : LongInt; (* compression used, 0 *) ááááááááááááááááááááááá biSizeImage : LongInt;áá (* size of the pixel data, see notes *) ááááááááááááááááááááááá biXPelsPerMeter : LongInt; (* not used, 0 *) ááááááááááááááááááááááá biYPelsPerMeter : LongInt; (* not used, 0 *) ááááááááááááááááááááááá biClrUsed : LongInt;áááááá (* nr of colors used, set to 0 *) ááááááááááááááááááááááá biClrImportant : LongInt;á (* important colors, set to 0 *) ááááááááááááááááááááá End; á TRGBQuad = Record áááááááááááááá rgbBlue : Byte;ááááá (* blue component of color *) áááááááááááááá rgbGreen : Byte;áááá (* green component of color *) áááááááááááááá rgbRed : Byte;áááááá (* red component of color *) áááááááááááááá rgbReserved : Byte;á (* reserved, 0 *) áááááááááááá End; á TIconPalette = Array [0..15] Of á TRGBQuad; á TIcon = Record ááááááááááá Headeráááááááááááá : TIconHeader; ááááááááááá DirEntryáááááááááá : TIconDirEntry; ááááááááááá InfoHeaderáááááááá : TBitmapInfoHeader; ááááááááááá IconPaletteááááááá : TIconPalette; ááááááááá End; á Var ááá Iconáááááááááááááááá : TIcon; ááá Fááááááááááááááááááá : File Of ááá TIcon; ááá F2áááááááááááááááááá : File Of ááá Byte; ááá I, J, K, Láááááááááá : Integer; ááá C, C2ááááááááááááááá : Byte; ááá Rowááááááááááááááááá : Array [1..32] Of ááá Byte; Procedure SetPal (I, r, g, b : Byte); Begin á port [$3c8] := I; á port [$3c9] := r; á port [$3c9] := g; á port [$3c9] := b; End; Begin á Assign (F, ParamStr (1) ); á Reset (F); á Read (F, Icon); á Assign (F2, ParamStr (1) ); á Reset (F2); á Seek (F2, 126); á Asm áá mov al, 13h áá Int 10h á End; á For I := 0 To 15 Do ááááá SetPal (I, Icon.IconPalette [I] .rgbRed Div 4, ááááááááááááá Icon.IconPalette [I] .rgbGreen Div 4, ááááááááááááá Icon.IconPalette [I] .rgbBlue Div 4); á For I := 32 DownTo 1 Do ááááá For J := 1 To 16 Do ááááááááá Begin áááááááááá Read (F2, C); áááááááááá mem [$A000 : (80 + I) * 320 + (J * 2 - 1) + 140] := C Div 16; áááááááááá mem [$A000 : (80 + I) * 320 + (J * 2) + 140] := C Mod 16; ááááááááá End; á ReadLn; á Asm áá mov al, 3h áá Int 10h á End; End. {end of code}