Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetParent() API with IE automation causing bleeding

Status
Not open for further replies.

EzLogic

Programmer
Aug 21, 2001
1,230
US
VFP 9 SP2
WINDOWS 7 ULTIMATE
AERO THEME

Simple IE automation form.
When i do automation with IE, basically crateobject('InternetExplorer.Application')
set it to visible, load a URL,

then, I am using SetParent() to position the IE inside the VFP form. Works well, except the VFP IDE menu will turn like its bleeding white and transparent.

I turned windows 7 aero them, and it stopped bleeding.

However, on the client side, i cannot control their themes.

I tried, _screen.themes = .f. and for the form as well, and it bleeds

I noticed, if i do excel automation inside the form, it does NOT bleed. Just the IE, as its titlebar already looks bit transparent, so, when it moves inside the vfp, it almost like leaves a mark where it was.

a5272770-14c5-4675-b1a4-c9decb2af1f9.gif


48d9df2b-12a8-48ba-83ea-778f64174753.gif



Ez Logic
Michigan
 
I'm not sure if this will help, but you might want to try using the Web Browser ActiveX control rather than instantiating Internet Explorer. Most of your coding will be the same, but it might well avoid the sort of problem you are seeing.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
We have been using the web browser before, however, we were running issues with URL as it now requires a Certificate. So, it loads well, yet, some of the links inside, will make a pop up and the popup is Blank (will ask for certificate again for some reason)

So, we have been having issue with the browser, and we are trying to make it use the full blown IE.

Also, the web browser control active x is not the full IE, its stuck on IE 8 or something, no?


Ez Logic
Michigan
 
webbrowser control will always host the latest IE, just the rendering mode might not be what you expect. Less of a problem.

Set WebBrowser.Silent = .T. and you might solve your popup problem.

Bye, Olaf.
 
That's interesting. I would have thought that the ActiveX control works in exactly the same was as the full IE in regard to prompting for certificates. But I've got no direct experience of this. You have obviously gone further with this than I have.

Also, my understanding is that the control is, in effect, the same instance of IE that is installed on the user's system. So if they have a current version, the control will give them the same facilities as that version. At least, that's what I've always supposed.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Intresting, I didnt know that the _webbrowser control uses the lastest IE.

Here what happens:
-User clicks on the button to invoke the 'web form'
-web form loads,
-loads url
-Pop up of Cert appears.
-System auto logs in

All is well.

In one the pages of the website, there is a link that the user can click on to see 'Account History'
It seems that the link opens up a Pop up IE window to display the history of the account.
So, from within the web form (webbrowser control), it Pops up and asks for the certificate again.

If we do the same thing manually using IE (normal browser), the Pop up works and will display the history.

Olaf: I tried silent = .f.

didn't seem to have affect

ps: we do not control the website. its a vendor we interact with and its https and certificate based.


Ez Logic
Michigan
 
Sorry,

I meant Silent = .t.

Code:
TRY 
	lcHTML = oWeb.Document.Body.InnerHTML
	IF EMPTY(lcHTML)
		EXIT
	ENDIF 
	
	lcStr = "userid"
	IF NOT (UPPER(lcStr) $ UPPER(lcHTML))
		MESSAGEBOX("Please exit this form and try again.",16,thisform.Caption)
		EXIT
	ENDIF 
	
	IF EMPTY(goApp.cUserFullName)
		lcFirst = goApp.cUserName
		lcLast = goApp.cUserName
	ELSE
		lcFullName = ALLTRIM(UPPER(goApp.cUserFullName))
		lcFirst = ALLTRIM(SUBSTR(lcFullname,1,AT(' ',lcFullname)-1))
		lcLast = ALLTRIM(SUBSTR(lcFullName,AT(' ',lcFullName)+1))
		IF EMPTY(lcFirst)
			lcFirst = goapp.cUsername
		ENDIF
		IF EMPTY(lcLast)
			lcLast = goapp.cUserName
		ENDIF 
		
 	ENDIF 
	
	oWeb.DOCUMENT.all.item("firstname").value = lcFirst
	oWeb.DOCUMENT.all.item("lastname").value = lcLast
	oWeb.DOCUMENT.all.item("userid").value = lcUserID
	oWeb.DOCUMENT.all.item("password").value = lcPassword
	
	oWeb.Silent = .t.
			
	
CATCH TO loExp 

ENDTRY

This code is great. Works, logs me in, we can do alot of things.

Its just on page of the site, has a hyperlink "Account History"
User clicks on it, and it pops up a new window "IE" outside of the VFP app.


Ez Logic
Michigan
 
EZ Logic said:
I didnt know that the _webbrowser control uses the lastest IE.

My understanding is that Internet Explorer is the web browser control, wrapped up into an executable. So whatever version of IE is installed, that's the version that the control will give you.

Apart from that, I'm sorry I can't suggest anything else to help you with the original problem. But, as always, it looks like Olaf is on the case.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanks Mike and Olaf.

I am wondering if the SetParent() and SetWindowPOS() API are causing the "left over" bleeding of IE's titlebar on top of the VFP IDE.

Is there a way i can 'repaint' the menu of vfp?

i tried, refresh(), lockscreen, etc..



Ez Logic
Michigan
 
I set the oIE.Fullscreen = .t. and the oIE.Titlebar = .f.
then, I positioned it inside the form and that did the trick.



Ez Logic
Michigan
 
How about setting Silent = .T. at first?
You want it to be silent, don't you?

Bye, Olaf.
 
Hi Olaf,

the Silent = .t. didn't fix it.

However, we do need the Certificate prompt when we first launch the site. Its needed for authentication.

Ez Logic
Michigan
 
>However, we do need the Certificate prompt
And that's why you put it after setting password, I see.

>Its just on page of the site, has a hyperlink "Account History"
And if you embed the IE it's a new tab? I bet it will rather be a popup window. Even Silent=.T. does prevent these, it only prevents error prompts, not popups. And even if you get your SetPArent idea working account history will still generate a window.

What you could control is navigating at all. If you put Cancel=.T. into the BeforeNavigate2 event, that'll prevent any link from working. The cancel parameter is coming in by reference and setting it .T. is signaled back to the webbrowser control, so it doesn't navigate to a new url or in this case most probably a call of a javascript function.

Bye, Olaf.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top