IE ActiveX problem

User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

IE ActiveX problem

Post by James Bott »

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

Code: Select all

#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
User avatar
Taiwan
Posts: 218
Joined: Fri Oct 07, 2005 1:55 am
Location: Taipei, Taiwan
Contact:

Post by Taiwan »

Hello

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

Regards,

Richard
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

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
areang
Posts: 128
Joined: Mon Jul 31, 2006 3:23 pm

Post by areang »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

>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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Enrico,

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

That would be a good reason.

James
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Post by cdmmaui »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

You could try:

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

James
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Post by cdmmaui »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Darrell,

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

James
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Post by cdmmaui »

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
Post Reply