#include <winuser.h>
#endif
-#ifndef __TWIN32__
-#if defined (__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS)
-#include "wx/msw/gnuwin32/extra.h"
-#endif
+#ifdef __GNUWIN32_OLD__
+ #include "wx/msw/gnuwin32/extra.h"
#endif
#include "wx/wxchar.h"
HANDLE ReadIcon( wxChar *szFileName, int *W, int *H)
{ ICONFILEHEADER iconFileHead; // ICON file header structure
ICONFILERES iconFileRes; // ICON file resource
- WORD cbHead,
+ UINT cbHead,
cbRes,
cbBits; // Used for reading in file
int hFile; // File handle
nDirEntries = 0;
// Open and read the .ICO file header and the first ICONFILERES
- hFile = _lopen( wxFNCONV(szFileName), OF_READ);
+ hFile = _lopen( wxConvertWX2MB(szFileName), OF_READ);
cbHead = _lread( hFile, (LPSTR)&iconFileHead, sizeof(ICONFILEHEADER));
cbRes = _lread( hFile, (LPSTR)&iconFileRes, sizeof(ICONFILERES));
++nDirEntries;
return (HANDLE) NULL;
// inserted by P.S.
- while( ((unsigned)nDirEntries < iconFileHead.wResourceCount) &&
+ while( (nDirEntries < iconFileHead.wResourceCount) &&
((iconFileRes.bWidth != nWidth) || (iconFileRes.bHeight != nHeight)))
{
cbRes = _lread( hFile, (LPSTR )&iconFileRes, sizeof( ICONFILERES));
//* bitmaps. So, no need to convert the AND bitmask. *
//* 7) Since a DIB is stored upside down, flip the monochrome AND bits*
//* by scanlines. *
-//* 8) Use the XOR and AND bits and create an icon with CreateIcon. *
+//* 8) Use the XOR and AND bits and create an icon with CreateIcon. *
//*****************************************************************************
HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst)
lpDIB->bmiHeader.biBitCount)));
// Get a hDC so we can create a bitmap compatible with it
- hDC = CreateDC( T("DISPLAY"), NULL, NULL, NULL);
+ hDC = CreateDC( wxT("DISPLAY"), NULL, NULL, NULL);
// 5) Create a device dependent bitmap with the XOR bits.
hbmXor = CreateDIBitmap( hDC, (LPBITMAPINFOHEADER)&(lpDIB->bmiHeader),
szFlip[(k - 1) - j] = *(DWORD FAR *)lpANDbits;
// 8) Use the XOR and AND bits and create an icon with CreateIcon.
- hIcon = CreateIcon( hInst, bmpXor.bmWidth, bmpXor.bmHeight, bmpXor.bmPlanes,
- bmpXor.bmBitsPixel, (const BYTE *)szFlip, (const BYTE *)lpXorDDB);
+ hIcon = CreateIcon( hInst, bmpXor.bmWidth, bmpXor.bmHeight, (BYTE)bmpXor.bmPlanes,
+ (BYTE)bmpXor.bmBitsPixel, (const BYTE *)szFlip, (const BYTE *)lpXorDDB);
// Clean up before exiting.
DeleteObject( hbmXor);
HANDLE ReadCur( wxChar *szFileName, LPPOINT lpptHotSpot, int *W, int *H)
{ CURFILEHEADER curFileHead; // CURSOR file header structure
CURFILERES curFileRes; // CURSOR file resource
- WORD cbHead,
+ UINT cbHead,
cbRes,
cbBits; // Used for reading in file
LPBITMAPINFO lpDIB; // Pointer to DIB memory
nDirEntries = 0;
// Open and read the .ICO file header and the first ICONFILERES
- hFile = _lopen( wxFNCONV(szFileName), OF_READ);
+ hFile = _lopen( wxConvertWX2MB(szFileName), OF_READ);
cbHead = _lread( hFile, (LPSTR )&curFileHead, sizeof( CURFILEHEADER));
cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES));
++nDirEntries;
return (HANDLE) NULL;
// following added by P.S.
- while( ((unsigned)nDirEntries < curFileHead.wResourceCount) &&
+ while( (nDirEntries < curFileHead.wResourceCount) &&
((curFileRes.bWidth != nWidth) || (curFileRes.bHeight != nHeight)))
{
cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES));
lpDIB->bmiHeader.biBitCount)));
// Get a hDC so we can create a bitmap compatible with it
- hDC = CreateDC( T("DISPLAY"), NULL, NULL, NULL);
+ hDC = CreateDC( wxT("DISPLAY"), NULL, NULL, NULL);
// 5) Create a device dependent bitmap with the XOR bits.
hbmXor = CreateBitmap( (int )lpDIB->bmiHeader.biWidth,
NumColors = DIBNumColors((LPSTR )lpbi);
if(lpbi->biSize == sizeof( BITMAPCOREHEADER)) // OS/2 style DIBs
- return NumColors * sizeof( RGBTRIPLE);
+ return (WORD)(NumColors * sizeof( RGBTRIPLE));
else
- return NumColors * sizeof( RGBQUAD);
+ return (WORD)(NumColors * sizeof( RGBQUAD));
}
//*****************************************************************************
// is in biClrUsed, whereas in the BITMAPCORE - style headers, it
// is dependent on the bits per pixel ( = 2 raised to the power of
// bits/pixel).
-
+
if(lpbi->biSize != sizeof( BITMAPCOREHEADER))
{
if(lpbi->biClrUsed != 0)
/*
* This doesn't work: just gives us a grey square. Ideas, anyone?
*/
-
+
HICON MakeIconFromBitmap(HINSTANCE hInst, HBITMAP hBitmap)
{
HDC hDCColor, hDCMono;