Click here to Skip to main content
15,898,036 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Wanting Windows Message Pin
Ravi Bhavnani2-Jan-05 16:38
professionalRavi Bhavnani2-Jan-05 16:38 
GeneralCharacter Internal leading Pin
LiYS2-Jan-05 13:40
LiYS2-Jan-05 13:40 
GeneralRe: Character Internal leading Pin
Monty22-Jan-05 18:07
Monty22-Jan-05 18:07 
GeneralRe: Character Internal leading Pin
LiYS2-Jan-05 19:16
LiYS2-Jan-05 19:16 
GeneralAnyone got source code for Programming Applications for MS Windows - Advanced Pin
Defenestration2-Jan-05 12:37
Defenestration2-Jan-05 12:37 
Generalreading bitmap image Pin
mathrose2-Jan-05 11:09
mathrose2-Jan-05 11:09 
GeneralRe: reading bitmap image Pin
ThatsAlok2-Jan-05 19:02
ThatsAlok2-Jan-05 19:02 
GeneralRe: reading bitmap image Pin
mathrose2-Jan-05 21:22
mathrose2-Jan-05 21:22 
Roll eyes | :rolleyes: Hey Alok ! The following is the c++ code... and the " unsigned char *VGA=(unsigned char *)0xA0000000L; " is giving error " connot cast unsigned long to unsigned char * " Can you help me in this ?

And if you can provide me the bitmap_read code in C# then also it will be a great help .....

The following is the original code ::::::

Thanx a lot,,,
*********************************************************************

#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <mem.h>


#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 200
#define NUM_COLORS 256

unsigned char *VGA=(unsigned char *)0xA0000000L;

void setmode(unsigned char mode)
{
union REGS i, o;

i.h.ah = 0x00;
i.h.al = mode;
int86(16, &i, &o);
}

void setrgbpalette(int n, unsigned char r, unsigned char g, unsigned char b)
{
union REGS i, o;
i.h.ah=0x10;
i.h.al=0x10;
i.x.bx=n;
i.h.dh=r;
i.h.ch=g;
i.h.cl=b;
int86(16, &i, &o);
}

void putpixel(int x, int y, char c)
{
*(VGA+((y<<8)+(y<<6)+x)) = c;
}

struct Fileheader
{
unsigned short Type;
unsigned long Size;
unsigned short Reserved1;
unsigned short Reserved2;
unsigned long OffBits;
unsigned long StructSize;
unsigned long Width;
unsigned long Height;
unsigned short Planes;
unsigned short BitCount;
unsigned long Compression;
unsigned long SizeImage;
long XPelsPerMeter;
long YPelsPerMeter;
unsigned long ClrUsed;
unsigned long ClrImportant;
Fileheader()
{
Size=Width=Height=Planes=BitCount=Compression=SizeImage=XPelsPerMeter=
YPelsPerMeter=ClrUsed=ClrImportant=Type=StructSize=Reserved1=Reserved2=
OffBits=0;
}
};

struct RGBQuad
{
unsigned char rgbBlue;
unsigned char rgbGreen;
unsigned char rgbRed;
unsigned char rgbReserved;
RGBQuad()
{
rgbBlue = rgbGreen = rgbRed = 0;
rgbReserved = 0;
}
};

class Bitmap
{
private :
Fileheader f;
unsigned char* Bmp;
RGBQuad Palette[256];
public :
void ReadBitmap(char*);
void DisplayBitmap(void);
};



void Bitmap::ReadBitmap(char *file)
{
FILE *fp;
unsigned short num_colors;

if ((fp = fopen(file,"rb")) == NULL)
{
printf("Error opening file %s.\n",file);
exit(1);
}

fread(&f, sizeof(Fileheader), 1, fp);

if (f.ClrUsed==0) num_colors=NUM_COLORS;
else num_colors=f.ClrUsed;

if ((Bmp = (unsigned char * ) malloc(sizeof(unsigned char)*(f.Width*f.Height))) == NULL)
{
fclose(fp);
printf("Error allocating memory for file %s.\n",file);
exit(1);
}

for(int i=0; i<num_colors; i++)
="" {
="" fread(&palette[i],="" sizeof(rgbquad),="" 1,="" fp);
="" setrgbpalette(i,="" (palette[i].rgbred="">>2), (Palette[i].rgbGreen>>2), (Palette[i].rgbBlue>>2));
}

for(long j=(f.Height-1)*f.Width; j>=0; j-=f.Width)
{
for(i=0;i
GeneralRe: reading bitmap image Pin
ThatsAlok2-Jan-05 22:41
ThatsAlok2-Jan-05 22:41 
GeneralRe: reading bitmap image Pin
Selvam R3-Jan-05 1:31
professionalSelvam R3-Jan-05 1:31 
GeneralFinding matching regions in file.. Pin
moliate2-Jan-05 10:36
moliate2-Jan-05 10:36 
GeneralIncorrect end/crash at app end Pin
Roland E.2-Jan-05 9:45
Roland E.2-Jan-05 9:45 
GeneralRe: Incorrect end/crash at app end Pin
David Crow3-Jan-05 3:38
David Crow3-Jan-05 3:38 
GeneralRe: Incorrect end/crash at app end Pin
Roland E.3-Jan-05 4:49
Roland E.3-Jan-05 4:49 
Generalhookless keylogger Pin
Spiritofamerica2-Jan-05 8:47
Spiritofamerica2-Jan-05 8:47 
GeneralRe: hookless keylogger Pin
User 66582-Jan-05 11:06
User 66582-Jan-05 11:06 
GeneralRe: hookless keylogger Pin
Spiritofamerica3-Jan-05 9:33
Spiritofamerica3-Jan-05 9:33 
GeneralRe: hookless keylogger Pin
User 66584-Jan-05 4:21
User 66584-Jan-05 4:21 
GeneralRe: hookless keylogger Pin
Anonymous4-Jan-05 8:39
Anonymous4-Jan-05 8:39 
GeneralRe: hookless keylogger Pin
User 66584-Jan-05 8:47
User 66584-Jan-05 8:47 
GeneralVCTerm will not run on computers without VC++ 5.0 installed Pin
fklldsvs2-Jan-05 4:58
fklldsvs2-Jan-05 4:58 
GeneralRe: VCTerm will not run on computers without VC++ 5.0 installed Pin
Michael Dunn2-Jan-05 19:31
sitebuilderMichael Dunn2-Jan-05 19:31 
QuestionHow to... Pin
Valie2-Jan-05 4:39
Valie2-Jan-05 4:39 
AnswerRe: How to... Pin
User 66582-Jan-05 11:10
User 66582-Jan-05 11:10 
AnswerRe: How to... Pin
Archer2822-Jan-05 13:16
Archer2822-Jan-05 13:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.