Solved

Cursor Twebbrowser

Posted on 2006-07-12
7
1,034 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: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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FMX StringGrid1->Canvas->FillRect Problem 3 153
LAN or WAN ? 11 92
how to resize animated Gif image in delphi ? 1 31
Twebbrowser add css to the header 3 25
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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