#include <io.h>
#include <windows.h>
+#if defined(__MWERKS__)
+#include <wingdi.h>
+#include <winuser.h>
+#endif
+
+#ifndef __TWIN32__
#ifdef __GNUWIN32__
#include "wx/msw/gnuwin32/extra.h"
#endif
+#endif
#include "wx/msw/curicop.h"
#include "wx/msw/curico.h"
{ HICON hIcon;
HANDLE hDIB;
- if( (hDIB = ReadIcon(szFileName, W, H)) == NULL)
+ if( (hDIB = ReadIcon(szFileName, W, H)) == (HANDLE) NULL)
// read the icon DIB from file
- return NULL;
+ return (HICON) NULL;
hIcon = MakeIcon( hDIB, hInst); // create an icon from DIB
GlobalFree( hDIB);
return hIcon;
{ HANDLE hDIB; // Handle to DIB memory
HICON hIcon; // Handle to Icon
- if( (hDIB = ReadCur( szFileName, NULL, W, H)) == NULL)
+ if( (hDIB = ReadCur( szFileName, NULL, W, H)) == (HANDLE) NULL)
// Read cursor DIB
- return NULL;
+ return (HICON) NULL;
hIcon = MakeIcon( hDIB, hInst); // make icon from cursor DIB
GlobalFree( hDIB);
return hIcon;
++nDirEntries;
if((cbHead != sizeof( ICONFILEHEADER)) || (cbRes != sizeof( ICONFILERES)))
- return NULL;
-
+ return (HANDLE) NULL;
// Verify that it's an .ICON file
if( iconFileHead.wResourceType != 1)
- return NULL;
+ return (HANDLE) NULL;
// inserted by P.S.
while( (nDirEntries < iconFileHead.wResourceCount) &&
{
cbRes = _lread( hFile, (LPSTR )&iconFileRes, sizeof( ICONFILERES));
if(cbRes != sizeof( ICONFILERES))
- return NULL;
+ return (HANDLE) NULL;
else
++nDirEntries;
}
// Allocate and lock memory to read in the DIB
hDIB = GlobalAlloc(GHND, iconFileRes.dwDIBSize);
- if(hDIB == NULL)
- return NULL;
+ if(hDIB == (HANDLE) NULL)
+ return (HANDLE) NULL;
+
#ifdef __WINDOWS_386__
lpDIB = (LPBITMAPINFO)MK_FP32(GlobalLock(hDIB));
#else
if( (DWORD )cbBits != iconFileRes.dwDIBSize)
{
GlobalFree( hDIB);
- return NULL;
+ return (HANDLE) NULL;
}
return hDIB;
}
dwBmpSize = (DWORD )(bmpXor.bmWidthBytes * bmpXor.bmHeight * bmpXor.bmPlanes);
hXorDDB = GlobalAlloc( GHND, dwBmpSize);
- if(hXorDDB == NULL)
+ if(hXorDDB == (HANDLE) NULL)
{
// clean up before quitting
DeleteObject( hbmXor);
DeleteDC( hDC);
GlobalUnlock( hDIB);
- return NULL;
+ return (HICON) NULL;
}
#ifdef __WINDOWS_386__
POINT ptHotSpot;
// read cur DIB from file
- 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 = MakeCursor( hDIB, (LPPOINT )&ptHotSpot, hInst);//create cur from DIB
if(XHot != 0)
*XHot = ptHotSpot.x;
HANDLE hDIB;
POINT ptHotSpot;
- if( (hDIB = ReadIcon( szFileName, W, H)) == NULL)
+ if( (hDIB = ReadIcon( szFileName, W, H)) == (HANDLE) NULL)
//read icon file to get icon DIB
- return NULL;
+ return (HCURSOR) NULL;
// Set the hot spot of the cursor
ptHotSpot.x = XHot;
ptHotSpot.y = YHot;
++nDirEntries;
if((cbHead != sizeof( CURFILEHEADER)) || (cbRes != sizeof( CURFILERES)))
- return NULL;
+ return (HANDLE) NULL;
// Verify that it's an .CUR file
if ((curFileRes.bReserved1 != 0) || (curFileHead.wResourceType != 2))
- return NULL;
+ return (HANDLE) NULL;
// following added by P.S.
while( (nDirEntries < curFileHead.wResourceCount) &&
{
cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES));
if(cbRes != sizeof( CURFILERES))
- return NULL;
+ return (HANDLE) NULL;
else
++nDirEntries;
}
// Allocate & lock memory to read in the DIB
hDIB = GlobalAlloc(GHND, curFileRes.dwDIBSize);
- if(hDIB == NULL)
- return NULL;
+ if(hDIB == (HANDLE) NULL)
+ return (HANDLE) NULL;
#ifdef __WINDOWS_386__
lpDIB = (LPBITMAPINFO )MK_FP32(GlobalLock(hDIB));
{
GlobalUnlock( hDIB);
GlobalFree( hDIB);
- return NULL;
+ return (HANDLE) NULL;
}
- if(lpptHotSpot != NULL) // If it is necessary to know the hot spot
+ if(lpptHotSpot != (LPPOINT) NULL) // If it is necessary to know the hot spot
{
lpptHotSpot->x = (int )curFileRes.wXHotspot;
lpptHotSpot->y = (int )curFileRes.wYHotspot;
dwLen = bi.biSize + PaletteSize((LPSTR)&bi);
- hdc = GetDC( NULL);
+ hdc = GetDC( (HWND) NULL);
hdib = GlobalAlloc( GHND, dwLen);
- if (hdib == NULL)
+ if (hdib == (HANDLE) NULL)
{
- ReleaseDC( NULL, hdc);
- return NULL;
+ ReleaseDC( (HWND) NULL, hdc);
+ return (HBITMAP) NULL;
}
#ifdef __WINDOWS_386__
else
{
GlobalFree( hdib);
- ReleaseDC( NULL, hdc);
- return NULL;
+ ReleaseDC( (HWND) NULL, hdc);
+ return (HBITMAP) NULL;
}
// Call GetDIBits with a NON-NULL lpBits parameter, to actually
(LPBITMAPINFO)lpbi, DIB_RGB_COLORS) == 0)
{
GlobalUnlock( hdib);
- hdib = NULL;
- ReleaseDC( NULL, hdc);
- return NULL;
+ hdib = (HANDLE) NULL;
+ ReleaseDC( (HWND) NULL, hdc);
+ return (HBITMAP) NULL;
}
// Finally, create a monochrome DDB, and put the DIB into
GlobalUnlock( hdib);
GlobalFree( hdib);
- ReleaseDC(NULL, hdc);
+ ReleaseDC((HWND) NULL, hdc);
return hbmMono;
}
dwBmpSize = (DWORD )(bmpXor.bmWidthBytes * bmpXor.bmHeight * bmpXor.bmPlanes);
hXorDDB = GlobalAlloc( GHND, dwBmpSize);
- if(hXorDDB == NULL)
+ if(hXorDDB == (HANDLE) NULL)
{ // clean up before quitting
DeleteObject( hbmXor);
DeleteDC( hDC);
GlobalUnlock( hDIB);
- return NULL;
+ return (HCURSOR) NULL;
}
#ifdef __WINDOWS_386__
lpXorDDB = (LPSTR)MK_FP32(GlobalLock( hXorDDB));
NPSTR andBits;
NPSTR xorBits;
- hDC = GetDC(NULL);
+ hDC = GetDC((HWND) NULL);
hDCColor = CreateCompatibleDC(hDC);
hDCMono = CreateCompatibleDC(hDC);
hAndBmp = CreateCompatibleBitmap(hDCMono, 32, 32);
NPSTR andBits;
NPSTR xorBits;
- hDC = GetDC(NULL);
+ hDC = GetDC((HWND) NULL);
hDCColor = CreateCompatibleDC(hDC);
hDCMono = CreateCompatibleDC(hDC);
hAndBmp = CreateCompatibleBitmap(hDCMono, 32, 32);
DeleteDC(hDCMono);
DeleteObject(hAndBmp);
DeleteObject(hXorBmp);
- ReleaseDC(NULL, hDC);
+ ReleaseDC((HWND) NULL, hDC);
#ifndef __WIN32__
LocalUnlock(LocalHandle((WORD) andBits));
LocalUnlock(LocalHandle((WORD) xorBits));