Solved

Cursor Twebbrowser

Posted on 2006-07-12
7
1,054 Views
Last Modified: 2008-03-10
I am using Twebbrowser in my aplication it is not visible. Then Twebbrowser loads page cursor changes to hour glass i donot need that.

How to get rid of Hour glass cursor?
0
Comment
Question by:tadoox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 28

Expert Comment

by:2266180
ID: 17095270
click on the twebbrowser component and from the object inspector modify the modify the cursor property from default to arrow.
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 17095486

If only it were that easy.. ;-)
0
 

Author Comment

by:tadoox
ID: 17097082
Yes, selecting arrow is not that much help :)
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 17097560
What the others are saying is that you can't prevent the cursor from changing because it's not your application that is controlling it at that moment. The TWebBrowser component is an ActiveX control and it's this control which determines what the cursor will look like. Basically, with TWebBrowser you're just linking your Internet Explorer into your application. And Microsoft determined that while loading a page, the cursor should be set to an hourglass.

There might be a fix for this, though. But expect it to be very complex and time-consuming and also wonder if it's really such a big issue.
0
 
LVL 28

Expert Comment

by:2266180
ID: 17097648
well, that was the best I could think of right before going to bed at 1:22 am :D sorry for not testing it out first.

I spent more than half an hour today searching the web for different things, and mainly as Workshop_Alex suggested, to somehow control the webbrowser activex control, but couldn't find anything. I also tried out some "hacks" I thought of, but still nothing.

Of course, the "shoot a fly with a cannon" approach should work: hooking some api calls and filter for the specific IE instance but I am not sure which api's need to be hooked. (setcursor maybe)

0
 
LVL 26

Accepted Solution

by:
Russell Libby earned 125 total points
ID: 17102427

Hooking will do the trick, if its *THAT* important to you. If it is, the following example shows how to stop the cursor setting when the broswer control is downloading. The Win32Hook can be downloaded from my site @:

http://users.adelphia.net/~rllibby/downloads/win32hook.zip

which requires the disassembler:

http://users.adelphia.net/~rllibby/downloads/disasm32.zip


Regards,
Russell

---

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, OleCtrls, SHDocVw, ComCtrls, Win32Hook;

type
  TForm1            =  class(TForm)
     ProgressBar1:  TProgressBar;
     WebBrowser1:   TWebBrowser;
     Button1:       TButton;
     Edit1:         TEdit;
     procedure      Button1Click(Sender: TObject);
     procedure      FormCreate(Sender: TObject);
  private
     // Private declarations
     FHook:         TCodeRewrite;
  protected
     // Protected declarations
  public
     // Public declarations
  end;

type
  TSetCursor        =  function(hCur: HCURSOR): HCURSOR; stdcall;

var
  Form1:            TForm1;
  DownCount:        Integer;
  OldSetCursor:     TSetCursor;

implementation
{$R *.DFM}

function HookSetCursor(hCur: HCURSOR): HCURSOR; stdcall;
begin

  // Check downloading
  if (Form1.WebBrowser1.ReadyState in [0, 4]) then
     // Call old function
     result:=OldSetCursor(hCur)
  else
     // Nothing
     result:=0;

end;

procedure TForm1.Button1Click(Sender: TObject);
begin

  WebBrowser1.Navigate(Edit1.Text);

end;

procedure TForm1.FormCreate(Sender: TObject);
begin

  FHook:=TCodeRewrite.Create;
  FHook.Link(GetProcAddress(GetModuleHandle('user32'), 'SetCursor'), @HookSetCursor, @OldSetCursor);

end;

end.
0
 

Author Comment

by:tadoox
ID: 17106321
Very complicated solution, rllibby. But works perfect. Thank you.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question