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
Solved

Cursor Twebbrowser

Posted on 2006-07-12
7
1,037 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

840 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