IE ActiveX problem

Postby James Bott » Tue Jul 17, 2007 4:30 pm

This does not seem to be a complete example. Just from looking at it, there is no function main() and the vars cAesdd and cHan are not defined. Please provide a complete, compilable example.

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:32 pm

Hi James,

Here is complete source.

#include "fivewin.ch"

//-----------------------------------------------------------------------------
function _AesSend( cDb, cMode, cFile )

local hHan , ;
oWnd2 , ;
oIcon , ;
cAesdd := ALLTRIM( frsys( "aesout" ) ) , ;
cHan := ALLTRIM( _Strip( cFile, .F., .F., .T. ) ) + ".HTM" , ;
cAesem := ALLTRIM( frsys( "aesemail" ) ) , ;
cText := "" , ;
cSRN := ALLTRIM( cFile ) , ;
cBN := "" , ;
cST := "" , ;
cPOE := "" , ;
cCOD := "" , ;
cEDA := "" , ;
cPOU := "" , ;
cMOT := "" , ;
cSCAC := "" , ;
cVN := "" , ;
cRCC := "" , ;
cHAZ := "" , ;
cRT := "" , ;
cAD0_1 := "" , ;
cAD0_2 := "" , ;
cAD0_3 := "" , ;
cAD0_4 := "" , ;
cAD0_5 := "" , ;
cAD0_6 := "" , ;
cAD0_7 := "" , ;
cAD0_8 := "" , ;
cAD0_9 := "" , ;
cAD0_11 := "" , ;
cAD0_12 := "" , ;
cAD1_3 := "" , ;
cAD1_8 := "" , ;
cAD1_9 := "" , ;
cAD1_10 := "" , ;
cAD1_12 := "" , ;
cAD3_2 := "E" , ;
cAD3_3 := ALLTRIM( PA[11] ) , ;
cAD3_4 := ALLTRIM( frsys( "ein" ) ) , ;
cAD3_5 := ALLTRIM( _UserId( "N" ) ) , ;
cAD3_7 := ALLTRIM( PA[16] ) , ;
cAD3_8 := ALLTRIM( PA[12] ) , ;
cAD3_9 := ALLTRIM( PA[13] ) , ;
cAD3_10 := ALLTRIM( PA[15] ) , ;
cAD3_11 := ALLTRIM( frsys( "state" ) ) , ;
cAD3_12 := ALLTRIM( PA[22] ) , ;
cAD3_13 := ALLTRIM( frsys( "zip" ) ) , ;
cTmp := "" , ;
lTmp := .F. , ;
cChar := "" , ;
cFirst := "" , ;
cLast := "" , ;
nLine := 0

// Validate...
IF EMPTY( cAesdd )
MsgAlert( "Cannot continue, Please configure AES folder", PA[04] )
RETURN nil
ENDIF
IF EMPTY( cAesem )
MsgAlert( "Cannot continue, Please configure AES email", PA[04] )
RETURN nil
ENDIF

// Init...
DO CASE
CASE cMode="O"
cTmp := ALLTRIM( cShipcont )
FOR nX=1 TO LEN( cTmp )
cChar := SUBSTR( cTmp, nX, 1 )
IF cChar=' '
lTmp := .T.
ENDIF
IF lTmp
cFirst += cChar
ELSE
cLast += cChar
ENDIF
NEXT nX

cBN := ALLTRIM( cBooking )
cST := ALLTRIM( cAesOrigin )
cPOE := ALLTRIM( cPol )
cCOD := ALLTRIM( cUlcode )
cEDA := RIGHT( DTOS( dDepart ), 6 )
cPOU := ALLTRIM( cPoul )
cMOT := "11"
cSCAC := ALLTRIM( cCarrier )
cVN := ALLTRIM( cVessel )
cRCC := IF( lRelated, 'Y', 'N' )
cHAZ := 'N'
cRT := IF( lRouted , 'Y', 'N' )
cAD0_1 := ALLTRIM( LEFT( cShipname, 30 ) )
cAD0_2 := ALLTRIM( _Strip( cEin ) )
cAD0_3 := 'E'
cAD0_4 := ALLTRIM( LEFT( cShipadd1, 32 ) )
cAD0_5 := ALLTRIM( LEFT( cShipadd2, 32 ) )
cAD0_6 := ALLTRIM( LEFT( cShipcity, 25 ) )
cAD0_7 := ALLTRIM( cShipst )
cAD0_8 := ALLTRIM( LEFT( cShipzip, 9 ) )
cAD0_9 := ALLTRIM( LEFT( cFirst, 13 ) )
cAD0_11 := ALLTRIM( LEFT( cLast, 20 ) )
cAD0_12 := ALLTRIM( _Strip( LEFT( cShipph, 11 ) ) )
cAD1_3 := ALLTRIM( LEFT( cConsname, 30 ) )
cAD1_8 := ALLTRIM( LEFT( cConsadd1, 32 ) )
cAD1_9 := ALLTRIM( LEFT( cConsadd2, 32 ) )
cAD1_10 := ALLTRIM( LEFT( cConscity, 25 ) )
cAD1_12 := ALLTRIM( cConsiso )

CASE cMode="A"
cTmp := ALLTRIM( cShipcont )
FOR nX=1 TO LEN( cTmp )
cChar := SUBSTR( cTmp, nX, 1 )
IF cChar=' '
lTmp := .T.
ENDIF
IF lTmp
cFirst += cChar
ELSE
cLast += cChar
ENDIF
NEXT nX

cST := ALLTRIM( cAesOrigin )
cPOE := ALLTRIM( cPol )
cCOD := ALLTRIM( cUlcode )
cEDA := RIGHT( DTOS( dDte01 ), 6 )
cPOU := ''
cMOT := "40"
cSCAC := ALLTRIM( cPfx )
cVN := ''
cRCC := IF( lRelated, 'Y', 'N' )
cHAZ := 'N'
cRT := IF( lRouted , 'Y', 'N' )
cAD0_1 := ALLTRIM( LEFT( cShipname, 30 ) )
cAD0_2 := ALLTRIM( _Strip( cEin ) )
cAD0_3 := 'E'
cAD0_4 := ALLTRIM( LEFT( cShipadd1, 32 ) )
cAD0_5 := ALLTRIM( LEFT( cShipadd2, 32 ) )
cAD0_6 := ALLTRIM( LEFT( cShipcity, 25 ) )
cAD0_7 := ALLTRIM( cShipst )
cAD0_8 := ALLTRIM( LEFT( cShipzip, 9 ) )
cAD0_9 := ALLTRIM( LEFT( cFirst, 13 ) )
cAD0_11 := ALLTRIM( LEFT( cLast, 20 ) )
cAD0_12 := ALLTRIM( _Strip( LEFT( cShipph, 11 ) ) )
cAD1_3 := ALLTRIM( LEFT( cConsname, 30 ) )
cAD1_8 := ALLTRIM( LEFT( cConsadd1, 32 ) )
cAD1_9 := ALLTRIM( LEFT( cConsadd2, 32 ) )
cAD1_10 := ALLTRIM( LEFT( cConscity, 25 ) )
cAD1_12 := ALLTRIM( cConsiso )

// Carrier...
_db( PA[03], "contacts" )
SET ORDER TO TAG S7
SEEK cSCAC
IF FOUND()
cSCAC := ALLTRIM( contacts->custid )
cVN := ALLTRIM( LEFT( contacts->custname, 23 ) )
ENDIF
_dbClose( "contacts" )

ENDCASE

// AES codes...
IF ! EMPTY( cPOE )
_dbExpand( "ports", cPOE, @cPOE, "SCHD" )
ENDIF
IF ! EMPTY( cPOU )
_dbExpand( "ports", cPOU, @cPOU, "SCHK" )
ENDIF

// 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="HIDDEN" NAME="EMAIL" VALUE="' + cAesEm + '">' + cEol

cText += '<INPUT TYPE="HIDDEN" NAME="SRN" VALUE="' + cSRN + '">' + cEol
IF ! EMPTY( cBN )
cText += '<INPUT TYPE="HIDDEN" NAME="BN" VALUE="' + cBN + '">' + cEol
ENDIF
cText += '<INPUT TYPE="HIDDEN" NAME="ST" VALUE="' + cST + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="POE" VALUE="' + cPOE + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="COD" VALUE="' + cCOD + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="EDA" VALUE="' + cEDA + '">' + cEol
IF ! EMPTY( cPOU )
cText += '<INPUT TYPE="HIDDEN" NAME="POU" VALUE="' + cPOU + '">' + cEol
ENDIF
cText += '<INPUT TYPE="HIDDEN" NAME="MOT" VALUE="' + cMOT + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="SCAC" VALUE="' + cSCAC + '">' + cEol

IF ! EMPTY( cVN )
cText += '<INPUT TYPE="HIDDEN" NAME="VN" VALUE="' + cVN + '">' + cEol
ENDIF

cText += '<INPUT TYPE="HIDDEN" NAME="RCC" VALUE="' + cRCC + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="HAZ" VALUE="' + cHAZ + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="RT" VALUE="' + cRT + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD0_1" VALUE="' + cAD0_1 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD0_2" VALUE="' + cAD0_2 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD0_3" VALUE="' + cAD0_3 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD0_4" VALUE="' + cAD0_4 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD0_5" VALUE="' + cAD0_5 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD0_6" VALUE="' + cAD0_6 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD0_7" VALUE="' + cAD0_7 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD0_8" VALUE="' + cAD0_8 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD0_9" VALUE="' + cAD0_9 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD0_11" VALUE="' + cAD0_11 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD0_12" VALUE="' + cAD0_12 + '">' + cEol

cText += '<INPUT TYPE="HIDDEN" NAME="AD1_3" VALUE="' + cAD1_3 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD1_8" VALUE="' + cAD1_8 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD1_9" VALUE="' + cAD1_9 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD1_10" VALUE="' + cAD1_10 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD1_12" VALUE="' + cAD1_12 + '">' + cEol

cText += '<INPUT TYPE="HIDDEN" NAME="AD3_2" VALUE="' + cAD3_2 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD3_3" VALUE="' + cAD3_3 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD3_4" VALUE="' + cAD3_4 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD3_5" VALUE="' + cAD3_5 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD3_7" VALUE="' + cAD3_7 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD3_8" VALUE="' + cAD3_8 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD3_9" VALUE="' + cAD3_9 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD3_10" VALUE="' + cAD3_10 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD3_11" VALUE="' + cAD3_11 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD3_12" VALUE="' + cAD3_12 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="AD3_13" VALUE="' + cAD3_13 + '">' + cEol

// AES detail...
SELECT seddet
SET ORDER TO TAG S1
GO TOP
SEEK cAesserial
IF FOUND()
DO WHILE ! EOF() .AND. ( cAesserial == seddet->serial )

// Init...
IF ! EMPTY( seddet->code )
nLine++
cLine := LTRIM( STR( nLine, 9 ) )
cIT1 := ALLTRIM( seddet->eic )
cIT2 := LTRIM( STR( seddet->value, 10 ) )
cIT3 := ALLTRIM( seddet->unit )
cIT4 := LTRIM( STR( seddet->qty, 10 ) )
cIT5 := ALLTRIM( seddet->unit2 )
cIT6 := LTRIM( STR( seddet->qty2, 10 ) )
cIT7 := LTRIM( STR( seddet->wt, 10 ) )
cIT8 := ALLTRIM( seddet->liccode )
cIT9 := ALLTRIM( seddet->license )
cIT12 := ALLTRIM( LEFT( seddet->comm, 45 ) )
cIT13 := ALLTRIM( seddet->code )
cIT14 := ''
cIT15 := IF( seddet->veh, 'Y', 'N' )
cIT16 := 'V'
cIT17 := ALLTRIM( seddet->vin )
cIT18 := ALLTRIM( seddet->title )
cIT19 := ALLTRIM( seddet->state )
cIT20 := ALLTRIM( seddet->eccn )
cIT21 := ALLTRIM( seddet->df )
cOD1 := ''
cOD2 := ''
cOD3 := ''
cOD4 := ''
cOD5 := ''
cOD6 := ''
cOD7 := ''

// AES...
cText += '<INPUT TYPE="HIDDEN" NAME="isLine' + cLine + '" VALUE="Y">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_1" VALUE="' + cIT1 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_2" VALUE="' + cIT2 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_3" VALUE="' + cIT3 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_4" VALUE="' + cIT4 + '">' + cEol

IF ! EMPTY( cIT5 ) .AND. ( VAL( cIT6 ) > 0 )
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_5" VALUE="' + cIT5 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_6" VALUE="' + cIT6 + '">' + cEol
ENDIF

cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_7" VALUE="' + cIT7 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_8" VALUE="' + cIT8 + '">' + cEol

IF ! EMPTY( cIT9 )
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_9" VALUE="' + cIT9 + '">' + cEol
ENDIF

cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_12" VALUE="' + cIT12 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_13" VALUE="' + cIT13 + '">' + cEol
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_15" VALUE="' + cIT15 + '">' + cEol

IF ( cIT15='Y' ) .AND. ( ! EMPTY( cIT16 ) )
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_16" VALUE="' + cIT16 + '">' + cEol
ENDIF
IF ( cIT15='Y' ) .AND. ( ! EMPTY( cIT17 ) )
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_17" VALUE="' + cIT17 + '">' + cEol
ENDIF
IF ( cIT15='Y' ) .AND. ( ! EMPTY( cIT18 ) )
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_18" VALUE="' + cIT18 + '">' + cEol
ENDIF
IF ( cIT15='Y' ) .AND. ( ! EMPTY( cIT19 ) )
cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_19" VALUE="' + cIT19 + '">' + cEol
ENDIF

cText += '<INPUT TYPE="HIDDEN" NAME="IT' + cLine + '_21" VALUE="' + cIT21 + '">' + cEol

// DDTC vars here -----------------------------------------------------

ENDIF


SELECT seddet
SKIP

ENDDO
ENDIF

// Validation...
IF EMPTY( cSRN )
MsgAlert( "Process cannot be completed" + cEol + "File Number is not valid", PA[04] )
RETURN nil
ENDIF
IF EMPTY( cBN ) .AND. ( cMode='O' )
MsgAlert( "Process cannot be completed" + cEol + "Booking Number is not valid", PA[04] )
RETURN nil
ENDIF
IF EMPTY( cST )
MsgAlert( "Process cannot be completed" + cEol + "State of Origin is not valid", PA[04] )
RETURN nil
ENDIF
IF ( LEN( ALLTRIM( cPOE ) ) < 4 )
MsgAlert( "Process cannot be completed" + cEol + "Port of Export " + ALLTRIM( cPOE ) + " is not valid", PA[04] )
RETURN nil
ENDIF
IF ( LEN( ALLTRIM( cCOD ) ) != 2 )
MsgAlert( "Process cannot be completed" + cEol + "Country of Destination " + ALLTRIM( cCOD ) + " is not valid", PA[04] )
RETURN nil
ENDIF
IF ( LEN( ALLTRIM( cPOU ) ) < 4 ) .AND. ( cMode='O' )
MsgAlert( "Process cannot be completed" + cEol + "Port of Unloading " + ALLTRIM( cPOU ) + " is not valid", PA[04] )
RETURN nil
ENDIF
IF ( LEN( ALLTRIM( cEDA ) ) != 6 )
MsgAlert( "Process cannot be completed" + cEol + "E.T.D. " + ALLTRIM( cEDA ) + " is not valid", PA[04] )
RETURN nil
ENDIF
IF ( ( LEN( ALLTRIM( cSCAC ) ) != 2 ) .AND. ( cMode='A' ) ) .OR. ( ( LEN( ALLTRIM( cSCAC ) ) != 4 ) .AND. ( cMode='O' ) )
MsgAlert( "Process cannot be completed" + cEol + "Carrier " + ALLTRIM( cSCAC ) + " is not valid", PA[04] )
RETURN nil
ENDIF
IF EMPTY( cVN ) .AND. ( cMode='O' )
MsgAlert( "Process cannot be completed" + cEol + "Vessel Name " + ALLTRIM( cVN ) + " is not valid", PA[04] )
RETURN nil
ENDIF

IF EMPTY( cAD0_1 )
MsgAlert( "Process cannot be completed" + cEol + "Shipper Name is not valid", PA[04] )
RETURN nil
ENDIF
IF EMPTY( cAD0_2 )
MsgAlert( "Process cannot be completed" + cEol + "Shipper EIN is not valid", PA[04] )
RETURN nil
ENDIF
IF EMPTY( cAD0_4 + cAD0_5 + cAD0_6 + cAD0_7 + cAD0_8 )
MsgAlert( "Process cannot be completed" + cEol + "Shipper Address is not valid", PA[04] )
RETURN nil
ENDIF
IF EMPTY( cAD0_9 + cAD0_11 )
MsgAlert( "Process cannot be completed" + cEol + "Shipper Contact is not valid", PA[04] )
RETURN nil
ENDIF
IF EMPTY( cAD0_12 )
MsgAlert( "Process cannot be completed" + cEol + "Shipper Telephone is not valid", PA[04] )
RETURN nil
ENDIF

IF EMPTY( cAD1_3 )
MsgAlert( "Process cannot be completed" + cEol + "Consignee Name is not valid", PA[04] )
RETURN nil
ENDIF
IF EMPTY( cAD1_8 + cAD1_9 + cAD1_10 + cAD1_12 )
MsgAlert( "Process cannot be completed" + cEol + "Consignee Address is not valid", PA[04] )
RETURN nil
ENDIF

IF ( nLine < 1 )
MsgAlert( "Process cannot be completed" + cEol + "Please enter AES Schedule B details", PA[04] )
RETURN nil
ENDIF

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 )

// Log...
CdmLog( cFile, 'AESDIRECT', cText )

DEFINE ICON oIcon RESOURCE "CDMLOGO"

MENU oMenu
MENUITEM "&Close" ACTION ( oWnd2:End() )
ENDMENU

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 )

// Init...
dProcdate := DATE()
cProctime := TIME()
cProcuser := _UserId( "N" )

RETURN nil
*~*~*~*~*~*~*~*~*~*
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 4:48 pm

Darrell,

The last source you provided errors out with a bunch of undefined functions.

I was hoping to get a very small example that shows the problem. You should be able to do this in ten lines or less. It appears that your problem has something to do with the activeX so you just need to define the window and provide the data to navigate the activex.

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

Postby James Bott » Tue Jul 17, 2007 4:51 pm

Darrell,

Here is a simple example. All we need is the vars defined.

#include "fivewin.ch"
function main()

cAesdd := ...
cHan := ...

DEFINE WINDOW oWnd2

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

oWnd2:oClient = oActiveX

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

ACTIVATE WINDOW oWnd2 ON INIT BringWindowToTop( oWnd2:hWnd )

return nil

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

Postby James Bott » Tue Jul 17, 2007 5:03 pm

Darrell,

This works for me with or without the ON INIT. The screen is displayed. So something else in your code is causing the problem. Or maybe you are using a different OS--I am using XP Pro SP2. Also I am using FWH 7.05 with xHarbour.

James

--------------------------
#include "fivewin.ch"
function main()

cAesdd := "www.microsoft.com"
cHan := ""

DEFINE WINDOW oWnd2

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

oWnd2:oClient = oActiveX

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

ACTIVATE WINDOW oWnd2 //ON INIT BringWindowToTop( oWnd2:hWnd )

return nil

// eof
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 5:16 pm

James,

Here is a cleaned up version. It will create file C:\TEST.HTM with minimal variables. My applications works fine except that I have to click on the application on the taskbar

#include "fivewin.ch"

//-----------------------------------------------------------------------------
function _AesSend()

local hHan , ;
oWnd2 , ;
oIcon , ;
cAesdd := "c:\" , ;
cHan := "TEST.HTM" , ;
cAesem := 'darrell.ortiz@cdmsoft.com' , ;
cText := "" , ;
cSRN := 'TEST' , ;
cTmp := "" , ;
lTmp := .F. , ;
cChar := "" , ;
cFirst := "" , ;
cLast := "" , ;
nLine := 0

// Init...
cMode := 'O'
cDb := 'ocean'
cFile := 'AESTEST'

// 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="HIDDEN" NAME="EMAIL" VALUE="' + cAesEm + '">' + cEol

cText += '<INPUT TYPE="HIDDEN" NAME="SRN" VALUE="' + cSRN + '">' + 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 ICON oIcon RESOURCE "CDMLOGO"

MENU oMenu
MENUITEM "&Close" ACTION ( oWnd2:End() )
ENDMENU

DEFINE WINDOW oWnd2 FROM 0, 0 TO 40, 85 ;
MENU oMenu TITLE "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 )

RETURN nil
*~*~*~*~*~*~*~*~*~*
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:24 pm

Darrell,

>Here is a cleaned up version. It will create file C:\TEST.HTM with minimal variables. My applications works fine except that I have to click on the application on the taskbar

It was missing a definition for cEol which I defined as CRLF and the program is working fine for me even without the ON INIT. The window is displayed on top.

What OS and version of FWH are you using?

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

Postby James Bott » Tue Jul 17, 2007 5:27 pm

Darrell,

If you will email me your email address I will send you a working EXE for you to test there.

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

Postby James Bott » Tue Jul 17, 2007 5:39 pm

Darrell,

I found your email address and sent you the working example EXE.

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

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 61 guests