Help me get this Bomberman code to work on MSVC

This is a discussion on Help me get this Bomberman code to work on MSVC within the C++ Programming forums, part of the General Programming Boards category; Yeah I got some code and I keep on getting a linking error called -error LNK2001: unresolved external symbol _main ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    15

    Help me get this Bomberman code to work on MSVC

    Yeah I got some code and I keep on getting a linking error called

    -error LNK2001: unresolved external symbol _main
    -fatal error LNK1120: 1 unresolved externals

    Ill post the code and the extra classes I used.

    Code:
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include <time.h>
    #include <stdlib.h>
    #include "resource.h"
    #include <mmsystem.h>
    #include <fstream.h>
    
    const char g_szClassName[] = "myWindowClass";
    const int ID_TIMER = 10000;
    
    HDC hdcBuffer;
    HBITMAP hbmBuffer;
    HBITMAP hbmOldBuffer;
    
    int level[19][19]=
    {
    	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    	{0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0},
    	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    	{0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0},
    	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    	{0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0},
    	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    	{0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0},
    	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    	{0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0},
    	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    	{0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0},
    	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    	{0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0},
    	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    	{0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0},
    	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    	{0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0},
    	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    };
    
    //Bomberman Logo: 288x180
    //Explosion: 420x360
    //Bomb: 85x100
    
    struct p
    {
    	int x,y;
    	int bombs;
    	int fire;
    	int bombslaid;
    	int hp;
    	int icount;
    } player1, player2;
    
    struct b
    {
    	bool alive;
    	int x,y;
    	int count;
    	int fire;
    } p1b[4], p2b[4];
    
    HBITMAP graphics[2];
    HBITMAP introg[2];
    HBITMAP wing[2];
    
    int screennum=0;
    int timedd=0;
    
    void MidiAccess(int command, char * midi)
    {
    	/*char string[200], ret[200];
    	if (command==0)
    	{
    		wsprintf(string, "open sequencer!%s alias midi",midi);
    		MessageBox(NULL,string,string,NULL);
    		mciSendStringA(string,ret,200,NULL);
    		if (ret) {
    			mciGetErrorString(ret, 
    		MessageBox(NULL,ret,ret,NULL);
    		wsprintf(string, "play midi repeat",midi); 
    		mciSendString(string,ret,200,NULL);
    	}
    	else if (command==1)
    	{
    		wsprintf(string, "close midi"); 
    		mciSendString(string,ret,200,NULL);
    	}
    	*/
    }
    
    void sndExplode()
    {
    	//PlaySound("Z:/Game/explode.wav",NULL,SND_ASYNC||SND_FILENAME);
    }
    
    HBITMAP CreateBitmapMask(HBITMAP hbmColour, COLORREF crTransparent)
    {
    	HDC hdcMem, hdcMem2;
    	HBITMAP hbmMask;
    	BITMAP bm;
    
    	GetObject(hbmColour, sizeof(BITMAP), &bm);
    	hbmMask = CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 1, NULL);
    
    	hdcMem = CreateCompatibleDC(0);
    	hdcMem2 = CreateCompatibleDC(0);
    
    	SelectObject(hdcMem, hbmColour);
    	SelectObject(hdcMem2, hbmMask);
    
    	SetBkColor(hdcMem, crTransparent);
    
    	BitBlt(hdcMem2, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
    
    	BitBlt(hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem2, 0, 0, SRCINVERT);
    
    	DeleteDC(hdcMem);
    	DeleteDC(hdcMem2);
    
    	return hbmMask;
    }
    void DrawScreen(HDC hdc, RECT* prc)
    {
    	HDC hdcMem = CreateCompatibleDC(hdc);
    
    	FillRect(hdcBuffer, prc, WHITE_BRUSH);
    
    	if (screennum==1)
    	{
    		SelectObject(hdcMem,graphics[1]);
    	
    		for (int x=0;x<13;x++)
    			for (int y=0;y<13;y++)
    			{
    				BitBlt(hdcBuffer,x*48,y*48,48,48,hdcMem,48*level[y][x],48,SRCCOPY);
    			}
    
    		for (int i=0;i<4;i++)
    		{
    			if (p1b[i].alive)
    			{
    				SelectObject(hdcMem,graphics[0]);
    				BitBlt(hdcBuffer,p1b[i].x*48,p1b[i].y*48,48,48,hdcMem,48*(p1b[i].count%4),96,SRCAND);
    				SelectObject(hdcMem,graphics[1]);
    				BitBlt(hdcBuffer,p1b[i].x*48,p1b[i].y*48,48,48,hdcMem,48*(p1b[i].count%4),96,SRCPAINT);
    
    				if (p1b[i].count>60)
    				{
    					bool l = true,r = true,u = true,d =true;
    					bool lf = true,rf = true,uf = true,df =true;
    					for (int x=1;x<=p1b[i].fire;x++)
    					{
    						if (level[p1b[i].y][p1b[i].x-x]==1)
    							l=false,lf=false;
    						if (level[p1b[i].y][p1b[i].x-x]==2)
    							lf=false;
    						if (level[p1b[i].y][p1b[i].x+x]==1)
    							r=false,rf=false;
    						if (level[p1b[i].y][p1b[i].x+x]==2)
    							rf=false;
    						if (level[p1b[i].y-x][p1b[i].x]==1)
    							u=false,uf=false;
    						if (level[p1b[i].y-x][p1b[i].x]==2)
    							uf=false;
    						if (level[p1b[i].y+x][p1b[i].x]==1)
    							d=false,df=false;
    						if (level[p1b[i].y+x][p1b[i].x]==2)
    							df=false;
    
    						if (l==true)
    						{
    							SelectObject(hdcMem,graphics[0]);
    							BitBlt(hdcBuffer,(p1b[i].x-x)*48,p1b[i].y*48,48,48,hdcMem,144,0,SRCAND);
    							SelectObject(hdcMem,graphics[1]);
    							BitBlt(hdcBuffer,(p1b[i].x-x)*48,p1b[i].y*48,48,48,hdcMem,144,0,SRCPAINT);
    						}
    						if (r==true)
    						{
    							SelectObject(hdcMem,graphics[0]);
    							BitBlt(hdcBuffer,(p1b[i].x+x)*48,p1b[i].y*48,48,48,hdcMem,144,0,SRCAND);
    							SelectObject(hdcMem,graphics[1]);
    							BitBlt(hdcBuffer,(p1b[i].x+x)*48,p1b[i].y*48,48,48,hdcMem,144,0,SRCPAINT);							
    						}
    						if (u==true)
    						{
    							SelectObject(hdcMem,graphics[0]);
    							BitBlt(hdcBuffer,p1b[i].x*48,(p1b[i].y-x)*48,48,48,hdcMem,144,0,SRCAND);
    							SelectObject(hdcMem,graphics[1]);
    							BitBlt(hdcBuffer,p1b[i].x*48,(p1b[i].y-x)*48,48,48,hdcMem,144,0,SRCPAINT);
    						}								
    						if (d==true)
    						{
    							SelectObject(hdcMem,graphics[0]);
    							BitBlt(hdcBuffer,p1b[i].x*48,(p1b[i].y+x)*48,48,48,hdcMem,144,0,SRCAND);
    							SelectObject(hdcMem,graphics[1]);
    							BitBlt(hdcBuffer,p1b[i].x*48,(p1b[i].y+x)*48,48,48,hdcMem,144,0,SRCPAINT);								
    
    						}
    
    						l=lf;
    						r=rf;
    						u=uf;
    						d=df;
    					}
    				}
    			}
    		}
    		for (i=0;i<4;i++)
    		{
    			if (p2b[i].alive)
    			{
    				SelectObject(hdcMem,graphics[0]);
    				BitBlt(hdcBuffer,p2b[i].x*48,p2b[i].y*48,48,48,hdcMem,48*(p2b[i].count%4),96,SRCAND);
    				SelectObject(hdcMem,graphics[1]);
    				BitBlt(hdcBuffer,p2b[i].x*48,p2b[i].y*48,48,48,hdcMem,48*(p2b[i].count%4),96,SRCPAINT);
    
    				if (p2b[i].count>60)
    				{
    					bool l = true,r = true,u = true,d =true;
    					bool lf = true,rf = true,uf = true,df =true;
    					for (int x=1;x<=p2b[i].fire;x++)
    					{
    						if (level[p2b[i].y][p2b[i].x-x]==1)
    							l=false,lf=false;
    						if (level[p2b[i].y][p2b[i].x-x]==2)
    							lf=false;
    						if (level[p2b[i].y][p2b[i].x+x]==1)
    							r=false,rf=false;
    						if (level[p2b[i].y][p2b[i].x+x]==2)
    							rf=false;
    						if (level[p2b[i].y-x][p2b[i].x]==1)
    							u=false,uf=false;
    						if (level[p2b[i].y-x][p2b[i].x]==2)
    							uf=false;
    						if (level[p2b[i].y+x][p2b[i].x]==1)
    							d=false,df=false;
    						if (level[p2b[i].y+x][p2b[i].x]==2)
    							df=false;
    
    						if (l==true)
    						{
    							SelectObject(hdcMem,graphics[0]);
    							BitBlt(hdcBuffer,(p2b[i].x-x)*48,p2b[i].y*48,48,48,hdcMem,144,0,SRCAND);
    							SelectObject(hdcMem,graphics[1]);
    							BitBlt(hdcBuffer,(p2b[i].x-x)*48,p2b[i].y*48,48,48,hdcMem,144,0,SRCPAINT);
    						}
    						if (r==true)
    						{
    							SelectObject(hdcMem,graphics[0]);
    							BitBlt(hdcBuffer,(p2b[i].x+x)*48,p2b[i].y*48,48,48,hdcMem,144,0,SRCAND);
    							SelectObject(hdcMem,graphics[1]);
    							BitBlt(hdcBuffer,(p2b[i].x+x)*48,p2b[i].y*48,48,48,hdcMem,144,0,SRCPAINT);							
    						}
    						if (u==true)
    						{
    							SelectObject(hdcMem,graphics[0]);
    							BitBlt(hdcBuffer,p2b[i].x*48,(p2b[i].y-x)*48,48,48,hdcMem,144,0,SRCAND);
    							SelectObject(hdcMem,graphics[1]);
    							BitBlt(hdcBuffer,p2b[i].x*48,(p2b[i].y-x)*48,48,48,hdcMem,144,0,SRCPAINT);
    						}								
    						if (d==true)
    						{
    							SelectObject(hdcMem,graphics[0]);
    							BitBlt(hdcBuffer,p2b[i].x*48,(p2b[i].y+x)*48,48,48,hdcMem,144,0,SRCAND);
    							SelectObject(hdcMem,graphics[1]);
    							BitBlt(hdcBuffer,p2b[i].x*48,(p2b[i].y+x)*48,48,48,hdcMem,144,0,SRCPAINT);								
    
    						}
    
    						l=lf;
    						r=rf;
    						u=uf;
    						d=df;
    					}
    				}
    			}
    		}
    		if (player1.icount%3!=1)
    		{
    			SelectObject(hdcMem,graphics[0]);
    			BitBlt(hdcBuffer,player1.x*48,player1.y*48,48,48,hdcMem,0,0,SRCAND);
    			SelectObject(hdcMem,graphics[1]);
    			BitBlt(hdcBuffer,player1.x*48,player1.y*48,48,48,hdcMem,0,0,SRCPAINT);
    		}
    		if (player2.icount%3!=1)
    		{
    			SelectObject(hdcMem,graphics[0]);
    			BitBlt(hdcBuffer,player2.x*48,player2.y*48,48,48,hdcMem,48,0,SRCAND);
    			SelectObject(hdcMem,graphics[1]);
    			BitBlt(hdcBuffer,player2.x*48,player2.y*48,48,48,hdcMem,48,0,SRCPAINT);
    		}
    
    		if (timedd<=50)
    		{
    			SelectObject(hdcMem,graphics[0]);
    			BitBlt(hdcBuffer,(13*48/2)-(186/2),200,186,144,hdcMem,48,144,SRCAND);
    			SelectObject(hdcMem,graphics[1]);
    			BitBlt(hdcBuffer,(13*48/2)-(186/2),200,186,144,hdcMem,48,144,SRCPAINT);
    		}
    
    		BitBlt(hdc, 0, 24, 13*48, 13*48,hdcBuffer,0, 0,SRCCOPY);
    
    		FillRect(hdcBuffer, prc, WHITE_BRUSH);
    
    		SelectObject(hdcMem,introg[1]);
    		BitBlt(hdcBuffer,0,0,13*48,24,hdcMem,0,0,SRCCOPY);
    
    		SelectObject(hdcMem,graphics[0]);
    		BitBlt(hdcBuffer,0,0,24,24,hdcMem,0,48*3,SRCAND);
    		BitBlt(hdcBuffer,(13*48)-4*24,0,24,24,hdcMem,0,48*3,SRCAND);
    
    		BitBlt(hdcBuffer,24,0,24,24,hdcMem,0,48*3+24*(player1.bombs+1),SRCAND);
    		BitBlt(hdcBuffer,(13*48)-3*24,0,24,24,hdcMem,0,48*3+24*(player2.bombs+1),SRCAND);
    
    		BitBlt(hdcBuffer,48+24,0,24,24,hdcMem,0,48*3+24*(player1.fire+1),SRCAND);
    		BitBlt(hdcBuffer,13*48-1*24,0,24,24,hdcMem,0,48*3+24*(player2.fire+1),SRCAND);
    
    		BitBlt(hdcBuffer,48,0,24,24,hdcMem,0,48*3+24,SRCAND);
    		BitBlt(hdcBuffer,13*48-48,0,24,24,hdcMem,0,48*3+24,SRCAND);
    
    		for (x=1;x<=player1.hp;x++)
    		{
    			BitBlt(hdcBuffer,24*4+24*x,0,24,24,hdcMem,24,3*48,SRCAND);	
    		}
    		
    		for (x=1;x<=player2.hp;x++)
    		{
    			BitBlt(hdcBuffer,(48*13)-(48*2+24*(x+1)),0,24,24,hdcMem,24,3*48,SRCAND);	
    		}
    
    		BitBlt(hdcBuffer,48,0,24,24,hdcMem,0,48*3+24,SRCAND);
    
    		SelectObject(hdcMem,graphics[1]);
    		BitBlt(hdcBuffer,0,0,24,24,hdcMem,0,48*3,SRCPAINT);
    		BitBlt(hdcBuffer,(13*48)-4*24,0,24,24,hdcMem,0,48*3,SRCPAINT);
    
    		BitBlt(hdcBuffer,24,0,24,24,hdcMem,0,48*3+24*(player1.bombs+1),SRCPAINT);
    		BitBlt(hdcBuffer,(13*48)-3*24,0,24,24,hdcMem,0,48*3+24*(player2.bombs+1),SRCPAINT);
    
    		BitBlt(hdcBuffer,48+24,0,24,24,hdcMem,0,48*3+24*(player1.fire+1),SRCPAINT);
    		BitBlt(hdcBuffer,13*48-1*24,0,24,24,hdcMem,0,48*3+24*(player2.fire+1),SRCPAINT);
    
    		BitBlt(hdcBuffer,48,0,24,24,hdcMem,0,48*3+24,SRCPAINT);
    		BitBlt(hdcBuffer,13*48-48,0,24,24,hdcMem,0,48*3+24,SRCPAINT);
    
    		for (x=1;x<=player1.hp;x++)
    		{
    			BitBlt(hdcBuffer,24*4+24*x,0,24,24,hdcMem,24,3*48,SRCPAINT);	
    		}
    		for (x=1;x<=player2.hp;x++)
    		{
    			BitBlt(hdcBuffer,(48*13)-(48*2+24*(x+1)),0,24,24,hdcMem,24,3*48,SRCPAINT);	
    		}
    
    		BitBlt(hdc,0,0,13*48,24,hdcBuffer,0,0,SRCCOPY);
    	}
    	else if (screennum==0)
    	{
    		SelectObject(hdcMem,introg[1]);
    		BitBlt(hdcBuffer,0,0,13*48,13*48+48,hdcMem,0,0,SRCCOPY);
    
    		BitBlt(hdc,0,0,13*48,14*48,hdcBuffer,0,0,SRCCOPY);
    	}
    	else if (screennum==2)
    	{
    		SelectObject(hdcMem,wing[1]);
    		BitBlt(hdcBuffer,0,0,13*48,13*48+48,hdcMem,0,0,SRCCOPY);
    
    		SelectObject(hdcMem,wing[0]);
    		BitBlt(hdcBuffer,190,108,136,55,hdcMem,(player1.hp==0)?136:0,648,SRCAND);
    		SelectObject(hdcMem,wing[1]);
    		BitBlt(hdcBuffer,190,108,136,55,hdcMem,(player1.hp==0)?136:0,648,SRCPAINT);
    
    		BitBlt(hdc,0,0,13*48,14*48,hdcBuffer,0,0,SRCCOPY);
    	}
    
    	DeleteDC(hdcMem);
    }
    
    LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
    	switch(msg)
    	{
    		case WM_CREATE:
    		{
    			HDC hdc= GetDC(hwnd);
    			SetTimer(hwnd, ID_TIMER, 1, NULL);
    			hdcBuffer = CreateCompatibleDC(hdc);
    			hbmBuffer = CreateCompatibleBitmap(hdc, 2500, 1200);
    			SelectObject(hdcBuffer, hbmBuffer);
    			graphics[1] = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BMBRMAN));
    			graphics[0]= CreateBitmapMask(graphics[1],RGB(255,0,255));
    			introg[1] = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_INTRO));
    			introg[0]= CreateBitmapMask(introg[1],RGB(255,0,255));
    			wing[1] = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_WIN));
    			wing[0]= CreateBitmapMask(wing[1],RGB(255,0,255));
    
    			MidiAccess(0,"Intro.mid");
    
    			player1.x=0;
    			player1.y=0;
    			player1.bombs=1;
    			player1.bombslaid=0;
    			player1.fire=1;
    			player1.hp=3;
    
    			player2.x=12;
    			player2.y=12;
    			player2.bombs=1;
    			player2.bombslaid=0;
    			player2.fire=1;
    			player2.hp=3;
    
    			screennum=0;
    
    			srand(int(time(NULL)));
    			for (int x=0;x<70;x++)
    			{
    				int xrand=rand()%13;
    				int yrand=rand()%13;
    				while (((xrand%2!=0)&&(yrand%2!=0))||
    					   ((xrand==0)&&(yrand==0))||
    					   ((xrand==1)&&(yrand==0))||
    					   ((xrand==2)&&(yrand==0))||
    					   ((xrand==3)&&(yrand==0))||
    					   ((xrand==0)&&(yrand==1))||
    					   ((xrand==0)&&(yrand==2))||
    					   ((xrand==0)&&(yrand==3))||
    
    					   ((xrand==12)&&(yrand==12))||
    					   ((xrand==12)&&(yrand==11))||
    					   ((xrand==12)&&(yrand==10))||
    					   ((xrand==12)&&(yrand==9))||
    					   ((xrand==11)&&(yrand==12))||
    					   ((xrand==10)&&(yrand==12))||
    					   ((xrand==9)&&(yrand==12)))
    				{
    					xrand=rand()%13;
    					yrand=rand()%13;
    				}
    				level[yrand][xrand]=2;
    			}
    		}
    		break;
    		case WM_CLOSE:
    		{
    			DestroyWindow(hwnd);
    		}
    		break;
    		case WM_DESTROY:
    		{
    			KillTimer(hwnd,ID_TIMER);
    			DeleteDC(hdcBuffer);
    			DeleteObject(hbmBuffer);
    			DeleteObject(graphics);
    			DeleteObject(wing);
    			DeleteObject(introg);
    			PostQuitMessage(0);
    		}
    		break;
    		case WM_PAINT:
    		{
    			RECT rcClient;
    			PAINTSTRUCT ps;
    			HDC hdc = BeginPaint(hwnd, &ps);
    			GetClientRect(hwnd, &rcClient);
    			DrawScreen(hdc, &rcClient);
    			EndPaint(hwnd,&ps);
    		}
    		break;
    		case WM_TIMER:
    		{
    			if ((screennum==1)&&(timedd>50))
    			{
    				if (player1.icount!=0)
    					player1.icount++;
    				if (player1.icount==50)
    					player1.icount=0;
    				if (player2.icount!=0)
    					player2.icount++;
    				if (player2.icount==50)
    					player2.icount=0;
    				for (int i=0;i<4;i++)
    				{
    					if (p1b[i].alive)
    					{
    						p1b[i].count++;
    
    						if ((p1b[i].count>60)&&(p1b[i].count<75))
    						{
    							bool l = true,r = true,u = true,d =true;
    							bool lf = true,rf = true,uf = true,df =true;
    							for (int x=1;x<=p1b[i].fire;x++)
    							{
    								if (level[p1b[i].y][p1b[i].x-x]==1)
    									l=false,lf=false;
    								if (level[p1b[i].y][p1b[i].x-x]==2)
    									lf=false;
    
    								if (level[p1b[i].y][p1b[i].x+x]==1)
    									r=false,rf=false;
    								if (level[p1b[i].y][p1b[i].x+x]==2)
    									rf=false;
    
    								if (level[p1b[i].y-x][p1b[i].x]==1)
    									u=false,uf=false;
    								if (level[p1b[i].y-x][p1b[i].x]==2)
    									uf=false;
    
    								if (level[p1b[i].y+x][p1b[i].x]==1)
    									d=false,df=false;
    								if (level[p1b[i].y+x][p1b[i].x]==2)
    									df=false;
    
    								if (l==true)
    								{
    									for (int z=0;z<4;z++)
    									{	
    										if ((p1b[z].x==p1b[i].x-x)&&(p1b[z].y==p1b[i].y)&&(p1b[z].count<50))
    											p1b[z].count=60;
    									}
    									if ((player1.x==p1b[i].x-x)&&(player1.y==p1b[i].y)&&(player1.icount==0))
    									{
    										player1.hp--;
    										player1.icount=1;
    									}
    									if ((player2.x==p1b[i].x-x)&&(player2.y==p1b[i].y)&&(player2.icount==0))
    									{
    										player2.hp--;
    										player2.icount=1;
    									}
    								}
    								if (r==true)
    								{
    									for (int z=0;z<4;z++)
    									{	
    										if ((p1b[z].x==p1b[i].x+x)&&(p1b[z].y==p1b[i].y)&&(p1b[z].count<50))
    											p1b[z].count=60;
    									}
    
    									if ((player1.x==p1b[i].x+x)&&(player1.y==p1b[i].y)&&(player1.icount==0))
    									{
    										player1.hp--;
    										player1.icount=1;
    									}
    									if ((player2.x==p1b[i].x+x)&&(player2.y==p1b[i].y)&&(player2.icount==0))
    									{
    										player2.hp--;
    										player2.icount=1;
    									}
    								}
    								if (u==true)
    								{
    									for (int z=0;z<4;z++)
    									{	
    										if ((p1b[z].x==p1b[i].x)&&(p1b[z].y==p1b[i].y-x)&&(p1b[z].count<50))
    											p1b[z].count=60;
    									}
    
    									if ((player1.x==p1b[i].x)&&(player1.y==p1b[i].y-x)&&(player1.icount==0))
    									{
    										player1.hp--;
    										player1.icount=1;
    									}
    									if ((player1.x==p1b[i].x)&&(player1.y==p1b[i].y-x)&&(player1.icount==0))
    									{
    										player1.hp--;
    										player1.icount=1;
    									}
    								}								
    								if (d==true)
    								{
    									for (int z=0;z<4;z++)
    									{	
    										if ((p1b[z].x==p1b[i].x-x)&&(p1b[z].y==p1b[i].y+x)&&(p1b[z].count<50))
    											p1b[z].count=60;
    									}
    
    									if ((player1.x==p1b[i].x)&&(player1.y==p1b[i].y+x)&&(player1.icount==0))
    									{
    										player1.hp--;
    										player1.icount=1;
    									}
    									if ((player2.x==p1b[i].x)&&(player2.y==p1b[i].y+x)&&(player2.icount==0))
    									{
    										player2.hp--;
    										player2.icount=1;
    									}
    								}
    
    								l=lf;
    								r=rf;
    								u=uf;
    								d=df;
    							}	
    						}
    						if (p1b[i].count==75)
    						{
    							bool l = true,r = true,u = true,d =true;
    							bool lf = true,rf = true,uf = true,df =true;
    							for (int x=1;x<=p1b[i].fire;x++)
    							{
    								if (level[p1b[i].y][p1b[i].x-x]==1)
    									l=false,lf=false;
    								if (level[p1b[i].y][p1b[i].x-x]==2)
    									lf=false;
    
    								if (level[p1b[i].y][p1b[i].x+x]==1)
    									r=false,rf=false;
    								if (level[p1b[i].y][p1b[i].x+x]==2)
    									rf=false;
    
    								if (level[p1b[i].y-x][p1b[i].x]==1)
    									u=false,uf=false;
    								if (level[p1b[i].y-x][p1b[i].x]==2)
    									uf=false;
    
    								if (level[p1b[i].y+x][p1b[i].x]==1)
    									d=false,df=false;
    								if (level[p1b[i].y+x][p1b[i].x]==2)
    									df=false;
    
    								if (l==true)
    								{
    									int random=rand()%6;
    									int m=0;
    									if (random==1)
    										m=3;
    									else if (random==2)
    										m=4;
    									if (level[p1b[i].y][p1b[i].x-x]==2) 
    										level[p1b[i].y][p1b[i].x-x]=m;
    									else 
    										level[p1b[i].y][p1b[i].x-x]=0;
    									for (int z=0;z<4;z++)
    									{	
    										if ((p1b[z].x==p1b[i].x-x)&&(p1b[z].y==p1b[i].y)&&(p1b[z].count<50))
    											p1b[z].count=50;
    									}
    
    								}
    								if (r==true)
    								{
    									int random=rand()%6;
    									int m=0;
    									if (random==1)
    										m=3;
    									else if (random==2)
    										m=4;
    									if (level[p1b[i].y][p1b[i].x+x]==2)
    										level[p1b[i].y][p1b[i].x+x]=m;
    									else
    										level[p1b[i].y][p1b[i].x+x]=0;
    
    									for (int z=0;z<4;z++)
    									{	
    										if ((p1b[z].x==p1b[i].x+x)&&(p1b[z].y==p1b[i].y)&&(p1b[z].count<50))
    											p1b[z].count=50;
    									}
    								}
    								if (u==true)
    								{
    									int random=rand()%6;
    									int m=0;
    									if (random==1)
    										m=3;
    									else if (random==2)
    										m=4;
    									if (level[p1b[i].y-x][p1b[i].x]==2)
    										level[p1b[i].y-x][p1b[i].x]=m;
    									else
    										level[p1b[i].y-x][p1b[i].x]=0;
    
    									for (int z=0;z<4;z++)
    									{	
    										if ((p1b[z].x==p1b[i].x)&&(p1b[z].y==p1b[i].y-x)&&(p1b[z].count<50))
    											p1b[z].count=50;
    									}
    								}								
    								if (d==true)
    								{
    									int random=rand()%6;
    									int m=0;
    									if (random==1)
    										m=3;
    									else if (random==2)
    										m=4;
    									if (level[p1b[i].y+x][p1b[i].x]==2)
    										level[p1b[i].y+x][p1b[i].x]=m;
    									else
    										level[p1b[i].y+x][p1b[i].x]=0;
    									for (int z=0;z<4;z++)
    									{	
    										if ((p1b[z].x==p1b[i].x-x)&&(p1b[z].y==p1b[i].y+x)&&(p1b[z].count<50))
    											p1b[z].count=50;
    									}
    								}
    
    								l=lf;
    								r=rf;
    								u=uf;
    								d=df;
    							}	
    						}
    						if (p1b[i].count==75)
    						{
    							for(int x=i+1;x<4;x++)
    							{
    								p1b[x-1].alive = p1b[x].alive;
    								p1b[x-1].count = p1b[x].count;
    								p1b[x-1].fire = p1b[x].fire;
    								p1b[x-1].x = p1b[x].x;
    								p1b[x-1].y= p1b[x].y;
    							}
    							p1b[3].alive=false;
    							p1b[3].count=0;
    						}
    					}
    				}
    				//Begin p2b************************************
    				for (i=0;i<4;i++)
    				{
    					if (p2b[i].alive)
    					{
    						p2b[i].count++;
    						if (p1b[i].count==60)
    							sndExplode();
    						if ((p2b[i].count>60)&&(p2b[i].count<75))
    						{
    							bool l = true,r = true,u = true,d =true;
    							bool lf = true,rf = true,uf = true,df =true;
    							for (int x=1;x<=p2b[i].fire;x++)
    							{
    								if (level[p2b[i].y][p2b[i].x-x]==1)
    									l=false,lf=false;
    								if (level[p2b[i].y][p2b[i].x-x]==2)
    									lf=false;
    
    								if (level[p2b[i].y][p2b[i].x+x]==1)
    									r=false,rf=false;
    								if (level[p2b[i].y][p2b[i].x+x]==2)
    									rf=false;
    
    								if (level[p2b[i].y-x][p2b[i].x]==1)
    									u=false,uf=false;
    								if (level[p2b[i].y-x][p2b[i].x]==2)
    									uf=false;
    
    								if (level[p2b[i].y+x][p2b[i].x]==1)
    									d=false,df=false;
    								if (level[p2b[i].y+x][p2b[i].x]==2)
    									df=false;
    
    								if (l==true)
    								{
    									for (int z=0;z<4;z++)
    									{	
    										if ((p2b[z].x==p2b[i].x-x)&&(p2b[z].y==p2b[i].y)&&(p2b[z].count<50))
    											p2b[z].count=60;
    									}
    									if ((player1.x==p2b[i].x-x)&&(player1.y==p2b[i].y)&&(player1.icount==0))
    									{
    										player1.hp--;
    										player1.icount=1;
    									}
    									if ((player2.x==p2b[i].x-x)&&(player2.y==p2b[i].y)&&(player2.icount==0))
    									{
    										player2.hp--;
    										player2.icount=1;
    									}
    								}
    								if (r==true)
    								{
    									for (int z=0;z<4;z++)
    									{	
    										if ((p2b[z].x==p2b[i].x+x)&&(p2b[z].y==p2b[i].y)&&(p2b[z].count<50))
    											p2b[z].count=60;
    									}
    
    									if ((player1.x==p2b[i].x+x)&&(player1.y==p2b[i].y)&&(player1.icount==0))
    									{
    										player1.hp--;
    										player1.icount=1;
    									}
    									if ((player2.x==p2b[i].x+x)&&(player2.y==p2b[i].y)&&(player2.icount==0))
    									{
    										player2.hp--;
    										player2.icount=1;
    									}
    								}
    								if (u==true)
    								{
    									for (int z=0;z<4;z++)
    									{	
    										if ((p2b[z].x==p2b[i].x)&&(p2b[z].y==p2b[i].y-x)&&(p2b[z].count<50))
    											p2b[z].count=60;
    									}
    
    									if ((player1.x==p2b[i].x)&&(player1.y==p2b[i].y-x)&&(player1.icount==0))
    									{
    										player1.hp--;
    										player1.icount=1;
    									}
    									if ((player1.x==p2b[i].x)&&(player1.y==p2b[i].y-x)&&(player1.icount==0))
    									{
    										player1.hp--;
    										player1.icount=1;
    									}
    								}								
    								if (d==true)
    								{
    									for (int z=0;z<4;z++)
    									{	
    										if ((p2b[z].x==p2b[i].x-x)&&(p2b[z].y==p2b[i].y+x)&&(p2b[z].count<50))
    											p2b[z].count=60;
    									}
    
    									if ((player1.x==p2b[i].x)&&(player1.y==p2b[i].y+x)&&(player1.icount==0))
    									{
    										player1.hp--;
    										player1.icount=1;
    									}
    									if ((player2.x==p2b[i].x)&&(player2.y==p2b[i].y+x)&&(player2.icount==0))
    									{
    										player2.hp--;
    										player2.icount=1;
    									}
    								}
    
    								l=lf;
    								r=rf;
    								u=uf;
    								d=df;
    							}	
    						}
    						if (p2b[i].count==75)
    						{
    							bool l = true,r = true,u = true,d =true;
    							bool lf = true,rf = true,uf = true,df =true;
    							for (int x=1;x<=p2b[i].fire;x++)
    							{
    								if (level[p2b[i].y][p2b[i].x-x]==1)
    									l=false,lf=false;
    								if (level[p2b[i].y][p2b[i].x-x]==2)
    									lf=false;
    
    								if (level[p2b[i].y][p2b[i].x+x]==1)
    									r=false,rf=false;
    								if (level[p2b[i].y][p2b[i].x+x]==2)
    									rf=false;
    
    								if (level[p2b[i].y-x][p2b[i].x]==1)
    									u=false,uf=false;
    								if (level[p2b[i].y-x][p2b[i].x]==2)
    									uf=false;
    
    								if (level[p2b[i].y+x][p2b[i].x]==1)
    									d=false,df=false;
    								if (level[p2b[i].y+x][p2b[i].x]==2)
    									df=false;
    
    								if (l==true)
    								{
    									int random=rand()%6;
    									int m=0;
    									if (random==1)
    										m=3;
    									else if (random==2)
    										m=4;
    									if (level[p2b[i].y][p2b[i].x-x]==2) 
    										level[p2b[i].y][p2b[i].x-x]=m;
    									else 
    										level[p2b[i].y][p2b[i].x-x]=0;
    									for (int z=0;z<4;z++)
    									{	
    										if ((p2b[z].x==p2b[i].x-x)&&(p2b[z].y==p2b[i].y)&&(p2b[z].count<50))
    											p2b[z].count=50;
    									}
    
    								}
    								if (r==true)
    								{
    									int random=rand()%6;
    									int m=0;
    									if (random==1)
    										m=3;
    									else if (random==2)
    										m=4;
    									if (level[p2b[i].y][p2b[i].x+x]==2)
    										level[p2b[i].y][p2b[i].x+x]=m;
    									else
    										level[p2b[i].y][p2b[i].x+x]=0;
    
    									for (int z=0;z<4;z++)
    									{	
    										if ((p2b[z].x==p2b[i].x+x)&&(p2b[z].y==p2b[i].y)&&(p2b[z].count<50))
    											p2b[z].count=50;
    									}
    								}
    								if (u==true)
    								{
    									int random=rand()%6;
    									int m=0;
    									if (random==1)
    										m=3;
    									else if (random==2)
    										m=4;
    									if (level[p2b[i].y-x][p2b[i].x]==2)
    										level[p2b[i].y-x][p2b[i].x]=m;
    									else
    										level[p2b[i].y-x][p2b[i].x]=0;
    
    									for (int z=0;z<4;z++)
    									{	
    										if ((p2b[z].x==p2b[i].x)&&(p2b[z].y==p2b[i].y-x)&&(p2b[z].count<50))
    											p2b[z].count=50;
    									}
    								}								
    								if (d==true)
    								{
    									int random=rand()%6;
    									int m=0;
    									if (random==1)
    										m=3;
    									else if (random==2)
    										m=4;
    									if (level[p2b[i].y+x][p2b[i].x]==2)
    										level[p2b[i].y+x][p2b[i].x]=m;
    									else
    										level[p2b[i].y+x][p2b[i].x]=0;
    									for (int z=0;z<4;z++)
    									{	
    										if ((p2b[z].x==p2b[i].x-x)&&(p2b[z].y==p2b[i].y+x)&&(p2b[z].count<50))
    											p2b[z].count=50;
    									}
    								}
    
    								l=lf;
    								r=rf;
    								u=uf;
    								d=df;
    							}	
    						}
    						if (p2b[i].count==75)
    						{
    							for(int x=i+1;x<4;x++)
    							{
    								p2b[x-1].alive = p2b[x].alive;
    								p2b[x-1].count = p2b[x].count;
    								p2b[x-1].fire = p2b[x].fire;
    								p2b[x-1].x = p2b[x].x;
    								p2b[x-1].y= p2b[x].y;
    							}
    							p2b[3].alive=false;
    							p2b[3].count=0;
    						}
    					}
    				}
    				//End p2b
    
    				if ((GetAsyncKeyState('A')!=0)&&(player1.x>0))
    					if ((level[player1.y][player1.x-1]!=2)&&(level[player1.y][player1.x-1]!=1))
    					{
    						bool r=true;
    						for (int m=0;m<4;m++)
    						{
    							if ((p1b[m].alive)&&(p1b[m].x+1==player1.x)&&(p1b[m].y==player1.y))
    								r=false;
    							if ((p2b[m].alive)&&(p2b[m].x+1==player1.x)&&(p2b[m].y==player1.y))
    								r=false;					
    						}
    						if (r==true)
    							player1.x--;
    					}
    				if ((GetAsyncKeyState('S')!=0)&&(player1.y<12))
    					if ((level[player1.y+1][player1.x]!=2)&&(level[player1.y+1][player1.x]!=1))
    					{
    						bool r=true;
    						for (int m=0;m<4;m++)
    						{
    							if ((p1b[m].alive)&&(p1b[m].x==player1.x)&&(p1b[m].y-1==player1.y))
    								r=false;
    							if ((p2b[m].alive)&&(p2b[m].x==player1.x)&&(p2b[m].y-1==player1.y))
    								r=false;					
    						}
    						if (r==true)
    							player1.y++;
    					}
    				if ((GetAsyncKeyState('D')!=0)&&(player1.x<12))
    					if ((level[player1.y][player1.x+1]!=2)&&(level[player1.y][player1.x+1]!=1))
    					{
    						bool r=true;
    						for (int m=0;m<4;m++)
    						{
    							if ((p1b[m].alive)&&(p1b[m].x-1==player1.x)&&(p1b[m].y==player1.y))
    								r=false;
    							if ((p2b[m].alive)&&(p2b[m].x-1==player1.x)&&(p2b[m].y==player1.y))
    								r=false;					
    						}
    						if (r==true)
    							player1.x++;
    					}
    				if ((GetAsyncKeyState('W')!=0)&&(player1.y>0))
    					if ((level[player1.y-1][player1.x]!=2)&&(level[player1.y-1][player1.x]!=1))
    					{
    						bool r=true;
    						for (int m=0;m<4;m++)
    						{
    							if ((p1b[m].alive)&&(p1b[m].x==player1.x)&&(p1b[m].y+1==player1.y))
    								r=false;
    							if ((p2b[m].alive)&&(p2b[m].x==player1.x)&&(p2b[m].y+1==player1.y))
    								r=false;					
    						}
    						if (r==true)
    							player1.y--;
    					}
    
    				if ((level[player1.y][player1.x]==3)&&(player1.bombs<4))
    					player1.bombs++,level[player1.y][player1.x]=0;
    				if ((level[player1.y][player1.x]==4)&&(player1.fire<4))
    					player1.fire++,level[player1.y][player1.x]=0;
    
    				if ((GetAsyncKeyState(VK_LEFT)!=0)&&(player2.x>0))
    					if ((level[player2.y][player2.x-1]!=2)&&(level[player2.y][player2.x-1]!=1))
    					{
    						bool r=true;
    						for (int m=0;m<4;m++)
    						{
    							if ((p1b[m].alive)&&(p1b[m].x+1==player2.x)&&(p1b[m].y==player2.y))
    								r=false;
    							if ((p2b[m].alive)&&(p2b[m].x+1==player2.x)&&(p2b[m].y==player2.y))
    								r=false;					
    						}
    						if (r==true)
    							player2.x--;
    					}
    				if ((GetAsyncKeyState(VK_DOWN)!=0)&&(player2.y<12))
    					if ((level[player2.y+1][player2.x]!=2)&&(level[player2.y+1][player2.x]!=1))
    					{
    						bool r=true;
    						for (int m=0;m<4;m++)
    						{
    							if ((p1b[m].alive)&&(p1b[m].x==player2.x)&&(p1b[m].y-1==player2.y))
    								r=false;
    							if ((p2b[m].alive)&&(p2b[m].x==player2.x)&&(p2b[m].y-1==player2.y))
    								r=false;					
    						}
    						if (r==true)
    							player2.y++;
    					}
    				if ((GetAsyncKeyState(VK_RIGHT)!=0)&&(player2.x<12))
    					if ((level[player2.y][player2.x+1]!=2)&&(level[player2.y][player2.x+1]!=1))
    					{
    						bool r=true;
    						for (int m=0;m<4;m++)
    						{
    							if ((p1b[m].alive)&&(p1b[m].x-1==player2.x)&&(p1b[m].y==player2.y))
    								r=false;
    							if ((p2b[m].alive)&&(p2b[m].x-1==player2.x)&&(p2b[m].y==player2.y))
    								r=false;					
    						}
    						if (r==true)
    							player2.x++;
    					}
    				if ((GetAsyncKeyState(VK_UP)!=0)&&(player2.y>0))
    					if ((level[player2.y-1][player2.x]!=2)&&(level[player2.y-1][player2.x]!=1))
    					{
    						bool r=true;
    						for (int m=0;m<4;m++)
    						{
    							if ((p1b[m].alive)&&(p1b[m].x==player2.x)&&(p1b[m].y+1==player2.y))
    								r=false;
    							if ((p2b[m].alive)&&(p2b[m].x==player2.x)&&(p2b[m].y+1==player2.y))
    								r=false;					
    						}
    						if (r==true)
    							player2.y--;
    					}
    
    				if ((level[player2.y][player2.x]==3)&&(player2.bombs<4))
    					player2.bombs++,level[player2.y][player2.x]=0;
    				if ((level[player2.y][player2.x]==4)&&(player2.fire<4))
    					player2.fire++,level[player2.y][player2.x]=0;
    
    				if (((player1.hp==0)||(player2.hp==0))&&(screennum==1))
    				{
    					screennum=2;
    					MidiAccess(1,"Game.mid");
    					MidiAccess(0,"End.mid");
    				}
    			}
    			else if ((screennum==1)&&(timedd<=50))
    			{
    				timedd++;
    			}
    			InvalidateRect(hwnd,NULL,FALSE);
    		}
    		break;
    		case WM_KEYDOWN:
    		{
    			if ((screennum==1)&&(timedd>50))
    			{
    				if (wParam=='F')
    				{
    					for (int i=0;i<player1.bombs;i++)
    					{
    						if (p1b[i].alive)
    							continue;
    						p1b[i].alive=true;
    						p1b[i].x=player1.x;
    						p1b[i].y=player1.y;
    						p1b[i].count=0;
    						p1b[i].fire=player1.fire;
    						break;
    					}
    				}
    				
    				if (wParam==VK_RETURN)
    				{
    					for (int i=0;i<player2.bombs;i++)
    					{
    						if (p2b[i].alive)
    							continue;
    						p2b[i].alive=true;
    						p2b[i].x=player2.x;
    						p2b[i].y=player2.y;
    						p2b[i].count=0;
    						p2b[i].fire=player2.fire;
    						break;
    					}
    				}
    			}
    			else if (screennum==0)
    			{
    				if (wParam==VK_RETURN)
    				{
    					MidiAccess(1,"Intro.mid");
    					MidiAccess(0,"Game.mid");
    					screennum=1;
    				}
    			}
    			InvalidateRect(hwnd,NULL,FALSE);
    		}
    		default:
    			return DefWindowProc(hwnd, msg, wParam, lParam);
    	}
    	return 0;
    }
    
    int WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    {
    		WNDCLASSEX wc;
    	HWND hwnd;
    	MSG Msg;
    
    	wc.cbSize		 = sizeof(WNDCLASSEX);
    	wc.style		 = 0;
    	wc.lpfnWndProc	 = WndProc;
    	wc.cbClsExtra	 = 0;
    	wc.cbWndExtra	 = 0;
    	wc.hInstance	 = hInstance;
    	wc.hIcon		 = LoadIcon(NULL, IDI_APPLICATION);
    	wc.hCursor		 = LoadCursor(NULL, IDC_ARROW);
    	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    	wc.lpszMenuName  = NULL;
    	wc.lpszClassName = g_szClassName;
    	wc.hIconSm		 = LoadIcon(NULL, IDI_APPLICATION);
    
    	if(!RegisterClassEx(&wc))
    	{
    		MessageBox(NULL, "Window Registration Failed!", "Error!",
    			MB_ICONEXCLAMATION | MB_OK);
    		return 0;
    	}
    
    	hwnd = CreateWindowEx(
    		WS_EX_CLIENTEDGE,
    		g_szClassName,
    		"Bomberman 2p",
    		WS_OVERLAPPED+ WS_CAPTION+ WS_SYSMENU+ WS_MINIMIZEBOX,
    		CW_USEDEFAULT, CW_USEDEFAULT, 13*48+10, 13*48+30+24,
    		NULL, NULL, hInstance, NULL);
    
    	if(hwnd == NULL)
    	{
    		MessageBox(NULL, "Window Creation Failed!", "Error!",
    			MB_ICONEXCLAMATION | MB_OK);
    		return 0;
    	}
    
    	ShowWindow(hwnd, nCmdShow);
    	UpdateWindow(hwnd);
    
    	while(GetMessage(&Msg, NULL, 0, 0) > 0)
    	{
    		TranslateMessage(&Msg);
    		DispatchMessage(&Msg);
    	}
    	return Msg.wParam;
    }

    Heres Basethead.h

    Code:
    /*++
    
    Copyright (c) 1997-1998  Microsoft Corporation
    
    Module Name:
    
        basetsd.h
    
    Abstract:
    
        Type definitions for the basic sized types.
    
    Author:
    
        Jeff Havens (jhavens)   23-Oct-1997
    
    Revision History:
    
    --*/
    
    #ifndef _BASETSD_H_
    #define _BASETSD_H_
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    //
    // The following types are guaranteed to be signed and 32 bits wide.
    //
    
    typedef int LONG32, *PLONG32;
    typedef int INT32, *PINT32;
    
    //
    // The following types are guaranteed to be unsigned and 32 bits wide.
    //
    
    typedef unsigned int ULONG32, *PULONG32;
    typedef unsigned int DWORD32, *PDWORD32;
    typedef unsigned int UINT32, *PUINT32;
    
    //
    // The INT_PTR is guaranteed to be the same size as a pointer.  Its
    // size with change with pointer size (32/64).  It should be used
    // anywhere that a pointer is cast to an integer type. UINT_PTR is
    // the unsigned variation.
    //
    // HALF_PTR is half the size of a pointer it intended for use with
    // within strcuture which contain a pointer and two small fields.
    // UHALF_PTR is the unsigned variation.
    //
    
    #ifdef _WIN64
    
    typedef __int64 INT_PTR, *PINT_PTR;
    typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
    
    #define MAXINT_PTR (0x7fffffffffffffffI64)
    #define MININT_PTR (0x8000000000000000I64)
    #define MAXUINT_PTR (0xffffffffffffffffUI64)
    
    typedef unsigned int UHALF_PTR, *PUHALF_PTR;
    typedef int HALF_PTR, *PHALF_PTR;
    
    #define MAXUHALF_PTR (0xffffffffUL)
    #define MAXHALF_PTR (0x7fffffffL)
    #define MINHALF_PTR (0x80000000L)
    
    #pragma warning(disable:4311)   // type cast truncation
    
    #if !defined(__midl)
    __inline
    unsigned long
    HandleToUlong(
        void *h
        )
    {
        return((unsigned long) h );
    }
    
    __inline
    unsigned long
    PtrToUlong(
        void  *p
        )
    {
        return((unsigned long) p );
    }
    
    __inline
    unsigned short
    PtrToUshort(
        void  *p
        )
    {
        return((unsigned short) p );
    }
    
    __inline
    long
    PtrToLong(
        void  *p
        )
    {
        return((long) p );
    }
    
    __inline
    short
    PtrToShort(
        void  *p
        )
    {
        return((short) p );
    }
    #endif
    #pragma warning(3:4311)   // type cast truncation
    
    #else
    
    
    typedef long INT_PTR, *PINT_PTR;
    typedef unsigned long UINT_PTR, *PUINT_PTR;
    
    #define MAXINT_PTR (0x7fffffffL)
    #define MININT_PTR (0x80000000L)
    #define MAXUINT_PTR (0xffffffffUL)
    
    typedef unsigned short UHALF_PTR, *PUHALF_PTR;
    typedef short HALF_PTR, *PHALF_PTR;
    
    #define MAXUHALF_PTR 0xffff
    #define MAXHALF_PTR 0x7fff
    #define MINHALF_PTR 0x8000
    
    #define HandleToUlong( h ) ((ULONG) (h) )
    #define PtrToUlong( p ) ((ULONG) (p) )
    #define PtrToLong( p ) ((LONG) (p) )
    #define PtrToUshort( p ) ((unsigned short) (p) )
    #define PtrToShort( p ) ((short) (p) )
    
    #endif
    
    //
    // SIZE_T used for counts or ranges which need to span the range of
    // of a pointer.  SSIZE_T is the signed variation.
    //
    
    typedef UINT_PTR SIZE_T, *PSIZE_T;
    typedef INT_PTR SSIZE_T, *PSSIZE_T;
    
    //
    // The following types are guaranteed to be signed and 64 bits wide.
    //
    
    typedef __int64 LONG64, *PLONG64;
    typedef __int64 INT64, *PINT64;
    
    
    //
    // The following types are guaranteed to be unsigned and 64 bits wide.
    //
    
    typedef unsigned __int64 ULONG64, *PULONG64;
    typedef unsigned __int64 DWORD64, *PDWORD64;
    typedef unsigned __int64 UINT64, *PUINT64;
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif // _BASETSD_H_

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    380

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 09-09-2007, 09:08 AM
  2. i cant get my code to work! (hawknl)
    By Guido in forum Networking/Device Communication
    Replies: 3
    Last Post: 05-23-2004, 02:20 AM
  3. << !! Posting Code? Read this First !! >>
    By kermi3 in forum Linux Programming
    Replies: 0
    Last Post: 10-14-2002, 02:30 PM
  4. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 12:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21