//*****************************************************************************
//* Function : ReadIconFile() *
//*****************************************************************************
//* Function : ReadIconFile() *
//* be created for any reason. *
//*****************************************************************************
//* be created for any reason. *
//*****************************************************************************
-HICON ReadIconFile( char *szFileName, HINSTANCE hInst, int *W, int *H)
+HICON ReadIconFile( wxChar *szFileName, HINSTANCE hInst, int *W, int *H)
-HICON CursorToIcon( char *szFileName, HINSTANCE hInst, int *W, int *H)
+HICON CursorToIcon( wxChar *szFileName, HINSTANCE hInst, int *W, int *H)
- if( (hDIB = ReadCur( szFileName, NULL, W, H)) == NULL)
+ if( (hDIB = ReadCur( szFileName, NULL, W, H)) == (HANDLE) NULL)
//* is corrupt or if memory cannot be allocated for the DIB info. *
//*****************************************************************************
//* is corrupt or if memory cannot be allocated for the DIB info. *
//*****************************************************************************
{ ICONFILEHEADER iconFileHead; // ICON file header structure
ICONFILERES iconFileRes; // ICON file resource
{ ICONFILEHEADER iconFileHead; // ICON file header structure
ICONFILERES iconFileRes; // ICON file resource
cbHead = _lread( hFile, (LPSTR)&iconFileHead, sizeof(ICONFILEHEADER));
cbRes = _lread( hFile, (LPSTR)&iconFileRes, sizeof(ICONFILERES));
++nDirEntries;
if((cbHead != sizeof( ICONFILEHEADER)) || (cbRes != sizeof( ICONFILERES)))
cbHead = _lread( hFile, (LPSTR)&iconFileHead, sizeof(ICONFILEHEADER));
cbRes = _lread( hFile, (LPSTR)&iconFileRes, sizeof(ICONFILERES));
++nDirEntries;
if((cbHead != sizeof( ICONFILEHEADER)) || (cbRes != sizeof( ICONFILERES)))
{
cbRes = _lread( hFile, (LPSTR )&iconFileRes, sizeof( ICONFILERES));
if(cbRes != sizeof( ICONFILERES))
{
cbRes = _lread( hFile, (LPSTR )&iconFileRes, sizeof( ICONFILERES));
if(cbRes != sizeof( ICONFILERES))
// Allocate and lock memory to read in the DIB
hDIB = GlobalAlloc(GHND, iconFileRes.dwDIBSize);
// Allocate and lock memory to read in the DIB
hDIB = GlobalAlloc(GHND, iconFileRes.dwDIBSize);
//* bitmaps. So, no need to convert the AND bitmask. *
//* 7) Since a DIB is stored upside down, flip the monochrome AND bits*
//* by scanlines. *
//* bitmaps. So, no need to convert the AND bitmask. *
//* 7) Since a DIB is stored upside down, flip the monochrome AND bits*
//* by scanlines. *
//*****************************************************************************
HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst)
//*****************************************************************************
HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst)
- hDC = CreateDC( "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),
// 5) Create a device dependent bitmap with the XOR bits.
hbmXor = CreateDIBitmap( hDC, (LPBITMAPINFOHEADER)&(lpDIB->bmiHeader),
dwBmpSize = (DWORD )(bmpXor.bmWidthBytes * bmpXor.bmHeight * bmpXor.bmPlanes);
hXorDDB = GlobalAlloc( GHND, dwBmpSize);
dwBmpSize = (DWORD )(bmpXor.bmWidthBytes * bmpXor.bmHeight * bmpXor.bmPlanes);
hXorDDB = GlobalAlloc( GHND, dwBmpSize);
szFlip[(k - 1) - j] = *(DWORD FAR *)lpANDbits;
// 8) Use the XOR and AND bits and create an icon with CreateIcon.
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);
//* be created for any reason. *
//*****************************************************************************
//* be created for any reason. *
//*****************************************************************************
-HCURSOR ReadCursorFile( char *szFileName, HINSTANCE hInst, int *W, int *H,
+HCURSOR ReadCursorFile( wxChar *szFileName, HINSTANCE hInst, int *W, int *H,
- if( (hDIB = ReadCur( szFileName, (LPPOINT )&ptHotSpot, W, H)) == NULL)
- return NULL;
+ if( (hDIB = ReadCur( szFileName, (LPPOINT )&ptHotSpot, W, H)) == (HANDLE) NULL)
+ return (HCURSOR) NULL;
-HCURSOR IconToCursor( char *szFileName, HINSTANCE hInst, int XHot, int YHot,
+HCURSOR IconToCursor( wxChar *szFileName, HINSTANCE hInst, int XHot, int YHot,
//* is corrupt or if memory cannot be allocated for the DIB info. *
//*****************************************************************************
//* is corrupt or if memory cannot be allocated for the DIB info. *
//*****************************************************************************
-HANDLE ReadCur( char *szFileName, LPPOINT lpptHotSpot, int *W, int *H)
+HANDLE ReadCur( wxChar *szFileName, LPPOINT lpptHotSpot, int *W, int *H)
{ CURFILEHEADER curFileHead; // CURSOR file header structure
CURFILERES curFileRes; // CURSOR file resource
{ CURFILEHEADER curFileHead; // CURSOR file header structure
CURFILERES curFileRes; // CURSOR file resource
cbHead = _lread( hFile, (LPSTR )&curFileHead, sizeof( CURFILEHEADER));
cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES));
++nDirEntries;
if((cbHead != sizeof( CURFILEHEADER)) || (cbRes != sizeof( CURFILERES)))
cbHead = _lread( hFile, (LPSTR )&curFileHead, sizeof( CURFILEHEADER));
cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES));
++nDirEntries;
if((cbHead != sizeof( CURFILEHEADER)) || (cbRes != sizeof( CURFILERES)))
// Verify that it's an .CUR file
if ((curFileRes.bReserved1 != 0) || (curFileHead.wResourceType != 2))
// Verify that it's an .CUR file
if ((curFileRes.bReserved1 != 0) || (curFileHead.wResourceType != 2))
{
cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES));
if(cbRes != sizeof( CURFILERES))
{
cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES));
if(cbRes != sizeof( CURFILERES))
// Allocate & lock memory to read in the DIB
hDIB = GlobalAlloc(GHND, curFileRes.dwDIBSize);
// Allocate & lock memory to read in the DIB
hDIB = GlobalAlloc(GHND, curFileRes.dwDIBSize);
- hDC = CreateDC( "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,
// 5) Create a device dependent bitmap with the XOR bits.
hbmXor = CreateBitmap( (int )lpDIB->bmiHeader.biWidth,
dwBmpSize = (DWORD )(bmpXor.bmWidthBytes * bmpXor.bmHeight * bmpXor.bmPlanes);
hXorDDB = GlobalAlloc( GHND, dwBmpSize);
dwBmpSize = (DWORD )(bmpXor.bmWidthBytes * bmpXor.bmHeight * bmpXor.bmPlanes);
hXorDDB = GlobalAlloc( GHND, dwBmpSize);
NumColors = DIBNumColors((LPSTR )lpbi);
if(lpbi->biSize == sizeof( BITMAPCOREHEADER)) // OS/2 style DIBs
NumColors = DIBNumColors((LPSTR )lpbi);
if(lpbi->biSize == sizeof( BITMAPCOREHEADER)) // OS/2 style DIBs
// 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).
// 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).
-BOOL fGetXPixmap( BOOL fIsIcon, char *szFileName, HINSTANCE hInst,
+BOOL fGetXPixmap( BOOL fIsIcon, wxChar *szFileName, HINSTANCE hInst,
hDCColor = CreateCompatibleDC(hDC);
hDCMono = CreateCompatibleDC(hDC);
hAndBmp = CreateCompatibleBitmap(hDCMono, 32, 32);
hDCColor = CreateCompatibleDC(hDC);
hDCMono = CreateCompatibleDC(hDC);
hAndBmp = CreateCompatibleBitmap(hDCMono, 32, 32);
LocalUnlock(LocalHandle((WORD) andBits));
LocalUnlock(LocalHandle((WORD) xorBits));
LocalFree(LocalHandle((WORD) andBits));
LocalFree(LocalHandle((WORD) xorBits));
LocalUnlock(LocalHandle((WORD) andBits));
LocalUnlock(LocalHandle((WORD) xorBits));
LocalFree(LocalHandle((WORD) andBits));
LocalFree(LocalHandle((WORD) xorBits));
hDCColor = CreateCompatibleDC(hDC);
hDCMono = CreateCompatibleDC(hDC);
hAndBmp = CreateCompatibleBitmap(hDCMono, 32, 32);
hDCColor = CreateCompatibleDC(hDC);
hDCMono = CreateCompatibleDC(hDC);
hAndBmp = CreateCompatibleBitmap(hDCMono, 32, 32);
LocalUnlock(LocalHandle((WORD) andBits));
LocalUnlock(LocalHandle((WORD) xorBits));
LocalFree(LocalHandle((WORD) andBits));
LocalFree(LocalHandle((WORD) xorBits));
LocalUnlock(LocalHandle((WORD) andBits));
LocalUnlock(LocalHandle((WORD) xorBits));
LocalFree(LocalHandle((WORD) andBits));
LocalFree(LocalHandle((WORD) xorBits));