Solved

Cursor Twebbrowser

Posted on 2006-07-12
7
1,020 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
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 28

Expert Comment

by:ciuly
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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:ciuly
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
APK file name 7 63
proper way to parse url in delphi 2 131
delphi prevent click fast 2 165
find a node in VST 2 46
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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 tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now