IE ActiveX problem

IE ActiveX problem

Postby James Bott » Sat Jan 27, 2007 1: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

Code: Select all  Expand view
#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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Taiwan » Sat Jan 27, 2007 2:25 am

Hello

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

Regards,

Richard
User avatar
Taiwan
 
Posts: 218
Joined: Fri Oct 07, 2005 1:55 am
Location: Taipei, Taiwan

Postby Jeff Barnes » Sat Jan 27, 2007 3: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
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby areang » Sat Jan 27, 2007 6: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
areang
 
Posts: 128
Joined: Mon Jul 31, 2006 3:23 pm

Postby James Bott » Sat Jan 27, 2007 1: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Sat Jan 27, 2007 2: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
User avatar
Enrico Maria Giordano
 
Posts: 8378
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Sat Jan 27, 2007 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Sat Jan 27, 2007 3: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
User avatar
Enrico Maria Giordano
 
Posts: 8378
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Sat Jan 27, 2007 3:16 pm

Enrico,

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

That would be a good reason.

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

Postby Antonio Linares » Sat Jan 27, 2007 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby cdmmaui » Tue Jul 17, 2007 2: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby James Bott » Tue Jul 17, 2007 5:54 am

You could try:

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

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

Postby cdmmaui » Tue Jul 17, 2007 1: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby James Bott » Tue Jul 17, 2007 3:32 pm

Darrell,

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

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

Postby cdmmaui » Tue Jul 17, 2007 4: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: richard-service and 39 guests