Mouse cursor, and also DefaultAxCode...

.NET Edition of the F-IN-BOX
picklefrog
Posts: 3
Joined: Thu May 17, 2007 8:23 am

Mouse cursor, and also DefaultAxCode...

Postby picklefrog » Wed Jul 04, 2007 5:18 am

Hi Artem,

Just wondering if you ever got around to implementing a feature whereby someone can choose to use the windows cursor instead of the Flash-rendered cursor that by default is used. I saw it mentioned in a post last year, but haven't found anything on the topic since.

I need to be able to use the Windows cursor, but at the moment, whenever I move over an f_in_box__control, the windows cursor is replaced by the Flash-controlled cursor.

Also, did you manage to create a mechanism whereby I can load a chosen version of flash OCX from an embedded resource *once* and then have all f_in_box__control objects that are subsequently created automatically use the DefaultAxCode if one is provided? This would be a good feature when f_in_box is used on many forms in an application, where the f_in_box control is placed using the Forms designer.

Cheers,

Dave.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Re: Mouse cursor, and also DefaultAxCode...

Postby Softanics » Wed Jul 04, 2007 7:36 pm

Thank you for your questions.

picklefrog wrote:Just wondering if you ever got around to implementing a feature whereby someone can choose to use the windows cursor instead of the Flash-rendered cursor that by default is used. I saw it mentioned in a post last year, but haven't found anything on the topic since.

I need to be able to use the Windows cursor, but at the moment, whenever I move over an f_in_box__control, the windows cursor is replaced by the Flash-controlled cursor.


I've found the following solution (unfortunaly, only using winapi):

Code: Select all

using System.Runtime.InteropServices;
...
delegate IntPtr WndProcDelegate(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);

private const int GWL_WNDPROC = -4;
private const int GW_CHILD = 5;
private const int WM_SETCURSOR = 0x0020;

[DllImport("user32.dll")]
private static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, [MarshalAs(UnmanagedType.FunctionPtr)] WndProcDelegate newWndProc);
[DllImport("user32.dll")]
static extern IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
[DllImport("user32.dll")]
static extern IntPtr SetCursor(IntPtr hCursor);

private static IntPtr oldWndProc = IntPtr.Zero;
private static WndProcDelegate newWndProc;

private void MainForm_Load(object sender, System.EventArgs e)
{
...
   IntPtr AxHandle = GetWindow(f_in_box__control1.Handle, GW_CHILD);
   newWndProc = new WndProcDelegate(WndProc);
   oldWndProc = GetWindowLong(AxHandle, GWL_WNDPROC);
   SetWindowLong(AxHandle, GWL_WNDPROC, newWndProc);
}

public IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
{
   if (WM_SETCURSOR == msg)
   {
      SetCursor(System.Windows.Forms.Cursors.SizeAll.Handle);
         
      return new IntPtr(1);
   }

   return CallWindowProc(oldWndProc, this.Handle, msg, wParam, lParam);
}      



picklefrog wrote:Also, did you manage to create a mechanism whereby I can load a chosen version of flash OCX from an embedded resource *once* and then have all f_in_box__control objects that are subsequently created automatically use the DefaultAxCode if one is provided? This would be a good feature when f_in_box is used on many forms in an application, where the f_in_box control is placed using the Forms designer.


We will implement it soon.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html


Return to “.NET Edition”

Who is online

Users browsing this forum: No registered users and 9 guests

cron