FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour IE ActiveX problem
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
IE ActiveX problem
Posted: Sat Jan 27, 2007 01:30 AM
I am trying to view an XML file using IE and activeX. When I call the function using the ON INIT clause of ACTIVATE WINDOW it works fine. But when I call the same function from a button all I get is a blank screen. See my code below.

I have tried putting sysfresh() in several places but that didn't help.

Any ideas?

I am using FWH Sept 2006 build/ xHarbour. You can use any HTML or XML file to test the code.

James

#include "fivewin.ch"

function main()
   local oWnd, oBar
   define window oWnd
   define buttonbar oBar of oWnd
   define button of oBar action viewXML()  // Doesn't work
   activate window oWnd on init viewXML()  // Does work
return nil

function viewXML(cFile, cPath)

   local oWnd, oActiveX, oBar

   default cPath := (cFilePath( GetModuleFileName( GetInstance() ) ))
   default cFile:= "test.xml"

   DEFINE WINDOW oWnd TITLE "Test XML Report"

   oActiveX = TActiveX():New( oWnd, "Shell.Explorer" )

   oWnd:oClient = oActiveX

   oActiveX:Do( "Navigate", cPath+cFile )

   ACTIVATE WINDOW oWnd

   oActiveX:end()

return nil
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 218
Joined: Fri Oct 07, 2005 01:55 AM
IE ActiveX problem
Posted: Sat Jan 27, 2007 02:25 AM

Hello

Same as me.
I don't know FWH's ActiveX problem or Compatible problem as code.

Regards,

Richard

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
IE ActiveX problem
Posted: Sat Jan 27, 2007 03:59 AM

Hi James,

I have not yet played with ActiveX but I tried messing aroud with your sample.

Strange but if you REMOVE the:

oActiveX:End()

It will work via the button.

Hope this helps.

Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 128
Joined: Mon Jul 31, 2006 03:23 PM
IE ActiveX problem
Posted: Sat Jan 27, 2007 06:17 AM

Hi All !

For any window dialog, please do not put anything after this :

ACTIVATE WINDOW oWnd

>>> oActiveX:end() <<<<
Sometimes get error.

Change to :
ACTIVATE WINDOW oWnd valid ( oActiveX:End(), .t. )

Regards
Areang

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
IE ActiveX problem
Posted: Sat Jan 27, 2007 01:40 PM

Jeff and Areang,

Thanks a lot guys! It works great now. I was pulling my hair out all day trying to solve that. I would have never guessed that the End() call was the problem. It doesn't seem logical.

Antonio, any idea why that is happening?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
IE ActiveX problem
Posted: Sat Jan 27, 2007 02:33 PM
James Bott wrote:I would have never guessed that the End() call was the problem. It doesn't seem logical.


No, it is logical. Your secondary window is modeless and oActiveX:End() method is therefore called immediatly.

EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
IE ActiveX problem
Posted: Sat Jan 27, 2007 02:48 PM

>No, it is logical. Your secondary window is modeless and oActiveX:End() method is therefore called immediatly.

Duh, I was thinking it was a dialog. I need some sleep--I only had three hours last night...

Hmm, then why doesn't the activeX object get closed when called from the ON INIT clause?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
IE ActiveX problem
Posted: Sat Jan 27, 2007 03:11 PM
James Bott wrote:Hmm, then why doesn't the activeX object get closed when called from the ON INIT clause?


Probably because the second window is modal if created in the ON INIT clause?

EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
IE ActiveX problem
Posted: Sat Jan 27, 2007 03:16 PM

Enrico,

>Probably because the second window is modal if created in the ON INIT clause?

That would be a good reason.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
IE ActiveX problem
Posted: Sat Jan 27, 2007 05:10 PM

Enrico is right, the main window is modal and others windows are non modal. If ON INIT clause used then the second window is activated as the main one, thus it becomes modal.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
IE ActiveX problem
Posted: Tue Jul 17, 2007 02:16 AM

Hello,

How can I make the window visible? When activate the window, it runs minimized and I have to click on application on taskbar for window to appear and allow user to continue.

DEFINE WINDOW oWnd2 FROM 0, 0 TO 40, 85 MENU oMenu
oActiveX = TActiveX():New( oWnd2, "Shell.Explorer" )
oWnd2:oClient = oActiveX
oActiveX:Do( "Navigate2", cAesdd + cHan )
ACTIVATE WINDOW oWnd2 VALID ( oActiveX:End(), .T. )

Thank You,

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
IE ActiveX problem
Posted: Tue Jul 17, 2007 05:54 AM

You could try:

ACTIVATE WINDOW oWnd2 VALID ( oActiveX:End(), .T. ) ;
on init BringWindowToTop( oWnd2:hWnd )

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
IE ActiveX problem
Posted: Tue Jul 17, 2007 01:53 PM

Hi James,

Thank you for your response. Unfortunately that did not work. Can I try something else?

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
IE ActiveX problem
Posted: Tue Jul 17, 2007 03:32 PM

Darrell,

Can you provide us with a working example that we can test?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
IE ActiveX problem
Posted: Tue Jul 17, 2007 04:10 PM

Hi James,

Here is my source. Thanks for your help.

// Write HTML...
cText := '<FORM ACTION="https://www.aesdirect.gov/weblink/weblink.cgi" METHOD="POST">' + cEol

cText += '<INPUT TYPE="HIDDEN" NAME="wl_app_ident" VALUE="wlcdm01">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="wl_nologin_url" VALUE="window.close()">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="wl_nosed_url" VALUE="window.close()">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="wl_success_url" VALUE="window.close()">' + cEol

cText += '<input type="submit" name="B1" value="Send to AES" style="background-color: #B8092C; font-weight: normal; font-size: 10px; font-face: tahoma; color: #ffffff; border-style: solid; border-width: 4px; border-color: #B8092C;">'

cText += '</FORM>'

// Create file
hHan = FCREATE( cAesdd + cHan, 0)
IF (hHan == -1)
MsgAlert( "CDM WinFrt cannot create "+ cAesdd + cHan, "Process Aborted" )
RETURN nil
ENDIF
FWRITE( hHan, cText )
FCLOSE( hHan )

DEFINE WINDOW oWnd2 FROM 0, 0 TO 40, 85 ;
MENU oMenu TITLE PA[04] + " - AES Direct Submission - " + ALLTRIM( cFile ) ICON oIcon

oActiveX = TActiveX():New( oWnd2, "Shell.Explorer" )

oWnd2:oClient = oActiveX // To fill the entire window surface

oActiveX:Do( "Navigate2", cAesdd + cHan )

ACTIVATE WINDOW oWnd2 ON INIT BringWindowToTop( oWnd2:hWnd )

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com