using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace YariSoft.Utils{
public enum WinMessages {
WM_APP = 0x8000,
WM_AGENT_ACTION
};
public class YMessages
{
#region Constructor/Destructor
public YMessages()
{
}
#endregion
#region Public functions
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern bool SendMessage(IntPtr hWnd, WinMessages msg, int wParam, int lParam);
static public DialogResult Show ( string Text, string Caption, MessageBoxButtons Buttons, MessageBoxIcon Icon )
{
try{
Utils.AgentPlayer.MovieTypeEnum MovieType = Utils.AgentPlayer.MovieTypeEnum.Error;
switch( Icon ){
case MessageBoxIcon.Question:
MovieType = Utils.AgentPlayer.MovieTypeEnum.Question;
break;
case MessageBoxIcon.Error:
MovieType = Utils.AgentPlayer.MovieTypeEnum.Error;
break;
default:
YariSoft.Utils.YMessages.Show( "Undefined type of dialog message!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop );
break;
}
System.Diagnostics.Process Process = System.Diagnostics.Process.GetCurrentProcess();
SendMessage( Process.MainWindowHandle, WinMessages.WM_AGENT_ACTION, 0, (int)MovieType );
} catch {
}
return MessageBox.Show( Text, Caption, Buttons, Icon );
}
static public void ChangeCursor ( Cursor Cursor )
{
System.Diagnostics.Process Process = System.Diagnostics.Process.GetCurrentProcess();
if( Cursor == Cursors.WaitCursor ){
SendMessage( Process.MainWindowHandle, WinMessages.WM_AGENT_ACTION, 0, (int)Utils.AgentPlayer.MovieTypeEnum.Busy );
}
if( Cursor == Cursors.Default ){
SendMessage( Process.MainWindowHandle, WinMessages.WM_AGENT_ACTION, 0, (int)Utils.AgentPlayer.MovieTypeEnum.DefPosition );
}
}
#endregion
}
}
|