Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Cursor Twebbrowser

Posted on 2006-07-12
7
Medium Priority
?
1,075 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
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.

 
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 500 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Screencast - Getting to Know the Pipeline

885 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