using System;
using System.Runtime.InteropServices;
namespace WindowsApplication2
{
/// <summary>
/// Summary description for clsSetCursor.
/// </summary>
public class clsSetCursor
{
#region Const
const int OCR_WAIT = 32514;
const int OCR_NORMAL = 32512 ;
const int OCR_APPSTARTING =32650;
#endregion
#region API
[DllImport("user32.dll")] public static extern IntPtr LoadCursorFromFile( string fileName );
[DllImport("user32")] public static extern int SetSystemCursor(IntPtr hcur, int id) ;
[DllImport("user32.dll")] static extern IntPtr LoadCursor(int hInstance, int lpCunrsorName);
#endregion
public clsSetCursor()
{
//
// TODO: Add constructor logic here
//
// Private Const OCR_NORMAL = 32512
// Private Const IDC_SIZEALL = 32646&
// Private Declare Function SetSystemCursor Lib "user32" (ByVal hcur As Long, ByVal id As Long) As Long
// Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
// Private Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Long) As Long
// Private Sub Form_Load()
// 'KPD-Team 2001
// 'URL: http://www.allapi.net/
// 'E-Mail: KPDTeam@Allapi.net
// Dim hCursor As Long
// 'load the 'Size-All' cursos
// hCursor = LoadCursor(ByVal 0&, IDC_SIZEALL)
// 'replaces the contents of the system cursor specified by OCR_NORMAL with the contents of the 'size-all' cursor
// SetSystemCursor hCursor, OCR_NORMAL
// 'clean up
// DestroyCursor hCursor
// End Sub
}
public static void setToAppStarting()
{
IntPtr iP=LoadCursorFromFile(@"C:\Documents and Settings\Felix Lau\Desktop\appstart.ani");
// int i=0;
IntPtr ii=LoadCursor(0,OCR_APPSTARTING);
SetSystemCursor(iP,OCR_NORMAL);
}
public static void setToNormal()
{
//IntPtr ii=LoadCursor(0,OCR_NORMAL);
IntPtr iP=LoadCursorFromFile(@"C:\Documents and Settings\Felix Lau\Desktop\fillitup.ani");
SetSystemCursor(iP,OCR_NORMAL);
}
public static IntPtr getNormal()
{
//return LoadCursor(0,OCR_NORMAL);
return new IntPtr(0);
}
}
}