[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Webbrowser refresh issue

Posted on 2004-09-08
7
Medium Priority
?
413 Views
Last Modified: 2013-12-25
Dear Experts,

I am using VB6 to add a webbrower control (zorder is 1) to a form.  In the form, there is a picture box and its zorder is 0.  After loading the webbrowser control with a html file (verified by the progressChange event of the webbrowser control), I change the visibility of the picture box to false.  The screen shows a blank page of the webbrowser control and then the content of the html.  How do I prevent the blank page ?

It is my first time to ask question here.  If my question is not clear, please feel free to clarify.  Thanks.
0
Comment
Question by:waycal
[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
  • 4
  • 3
7 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 12004663
Try use DownloadComplete Event instead?

Private Sub WebBrowser_DownloadComplete()
  .... show your web browser visible here..
End Sub
0
 

Author Comment

by:waycal
ID: 12004695
Dear ryancys,

Thanks.  I have tried that before but it cannot help.

Whenever I show a picturebox on top of the webbrowser control and then turn the picturebox off.  The area of the webbrowser control overlapped by the picturebox will become blank and then redraw.  It generates a flickering and I want to prevent it.
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 12004715
>>The screen shows a blank page of the webbrowser control and then the content of the html
Maybe you can pause your application for a while using sleep api, like:

Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

Private Sub WebBrowser_DownloadComplete()

doevents
Sleep 1000 'pause 1 second
Picture1.visible = false
doevents

End Sub

?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:waycal
ID: 12004776
Dear ryancys,

It helps to prevent the blank page but the screen flickers when the picture1.visible = false.  How to avoid the flickering ?
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 12007099
Try apply LockWindowUpdate API to lock the window's update, to eliminate the flickering..

Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long
Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

Private Sub WebBrowser_DownloadComplete()

doevents
LockWindowUpdate Me.hwnd
Sleep 1000 'pause 1 second
Picture1.visible = false
doevents
LockWindowUpdate 0

End Sub

If still facing flickering problem, try send a copy of your code to me, my email can be found in my profile.

regards
0
 

Author Comment

by:waycal
ID: 12012641
Dear ryancys,

Thanks.  By the way, just for my better understanding, what is the meaning of putting two "doevents" in the solution ?  What is the difference if I put them in different location (like after the LockWindowUpdate 0) ?
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 12012726
Hi waycal,

The DoEvents function surrenders execution of the macro so that the operating system can process other events. The DoEvents function passes control from the application to the operating system. Some instances in which DoEvents may be useful include the following:
* Hardware I/O
* Delay Loops
* Operating System Calls
* DDE Deadlocking
http://support.microsoft.com/default.aspx?scid=kb;en-us;118468

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconusingdoevents.asp

Rule on DoEvents
http:Q_21051743.html

>>What is the difference if I put them in different location (like after the LockWindowUpdate 0) ?
If you put doevents after LockWindowUpdate 0, the request (normally form redraw, etc) will be process only after the LockWindowUpdate 0, so depends on when you want the request to be processed first, then you put a line of doevents there. Hope this is clear ;-)
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

649 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