Private Sub Form_Activate () Dim fv_iReturn As Integer Dim fv_sFormulaName As String Dim fv_sTemp_Report_Name As String Dim fv_iJob_Handle As Integer '' obscure peer Nixian servant Anzhouxianni Julan Dim fv_iTable1 As Integer '' Jiao Juezhoulandou Hua 1 Dim fv_iTable2 As Integer '' 僽 儖 斣崋 2 DIM FV_UMYINFO1 AS PELOGONINFO '' '僌僆 儞 忣 忣 1 DIM FV_UMYINFO2 AS PELOGONINFO' '僌僆 儞 忣 忣 2 DIM FV_LTEXTHANDLE AS Long' '僄俦 亅 亅 佥 佥 僩僴 僩僴Ni Julan Dim fv_iTextLength As Integer '' Piao Chou Jue Jiao Qian Lao Xianmindixian interpolation Dim fv_sErrorText As String '' Piao Chou Jue Jiao Qian Laoxian Dim fv_sDeviceName As String Dim fv_sSaveDeviceName As String Dim fv_oPrinter As Printer Dim fv_sSetVal As String Dim fv_lRet As Long Const HWND_BROADCAST = & HFFFF & Const WM_WININICHANGE = & H1A If m_bOnce_Flg = True Then Exit Sub m_bOnce_Flg = True g_bResult = True '' ----- ----- On Error GoTo Error_Section: Label1 (0) .Caption = g_sLPP_ReportName2 Label1 (1) .caption = "11" me.refresh '' ----- ----- if g_slpp_vformsize <> "" "The Select Case G _sLPP_vFormSize Case gc_sSizeA4 fv_sDeviceName = g_sPrn_A4 GoSub GetPrinterInfo Case gc_sSizeB4 fv_sDeviceName = g_sPrn_B4 GoSub GetPrinterInfo Case gc_sSizeSF fv_sDeviceName = g_sPrn_SF GoSub GetPrinterInfo Case Else fv_sDeviceName = Printer.DeviceName End Select Else fv_sDeviceName = g_sPrn_SF GoSub GetPrinterInfo End If '' ----- ---- - if peponengine () =
0 THEN GOTO CR_ERROR_SECTION: '' ----- ----- fv_ijob_handle = peopenprintjob (g_slpp_reportname1 chr $ (0)))) f _ _ _ _ = 0 THEN GOTO CR_ERROR_SECTION: END IF '' ----- Oracle --- - If g_sLPP_Data_Type = 0 Or g_sLPP_Data_Type = 2 Then fv_uMyInfo1.StructSize = PE_SIZEOF_LOGON_INFO 'Set up the structure size fv_uMyInfo1.ServerName = "" Chr $ (0)' Use ServerName stored in report fv_uMyInfo1.DatabaseName = "" Chr $ ( 0) 'Use DatabaseName stored in report' fv_uMyInfo1.UserID = g_sOraUser Chr $ (0) 'Use UserID stored in report fv_uMyInfo1.Password = g_sOraPass Chr $ (0)' Set up the password here fv_iTable1 = 0 'We will set The Password for the first Table if PesetNthtableLogonInfo (fv_ijob_handle, fv_itable1, fv_umyinfo1, true) = false: if cr_change_location (fv_ijob_handle, g_ sOraUser) = False Then GoTo CR_Error_Section: '' ----- Crystal Report ----- If Fn_Chg_SubLocation (fv_iJob_Handle) = False Then GoTo CR_Error_Section: End If '' ----- TextFile ----- If g_sLPP_Data_Type = 1 Or g_sLPP_Data_Type = 2 Then fv_uMyInfo2.StructSize = PE_SIZEOF_LOGON_INFO 'Set up the structure size If g_sLPP_Data_Type = 1 Then fv_iTable2 = 0' We will set the password for the first table Else fv_iTable2 = 1 End If ''
----- Text ----- If PEGetNthTableLogOnInfo (fv_iJob_Handle, fv_iTable2, fv_uMyInfo2) = False Then GoTo CR_Error_Section: End If If g_iLPP_Out_Source = 0 Then '' ----- ----- If PEOutputToPrinter (fv_iJob_Handle, 1) <> 1 THEN GOTO CR_ERROR_SECTION: ELSE '' ----- if peutputtowindow (fv_ijob_handle, g_slpp_reportname2, 0, 0) <> 1 THEN GOTO CR_ERROR_SECTION: END IF '--- - ----- If Trim (g_sLPP_Formula) <> "" Then If PESetSelectionFormula (fv_iJob_Handle, g_sLPP_Formula) = False Then GoTo CR_Error_Section: End If '' ----- If Trim (g_sLPP_Gmu_Date) <> "" Then fv_sFormulaName = "111" Chr $ (0) g_sLPP_Gmu_Date = " '" & Format (g_sLPP_Gmu_Date, "@@@@ / @@ / @@") & "'" & Chr $ (0) If PESetFormula (fv_iJob_Handle, fv_sFormulaName, G_SLPP_GMU_DATE) = false then goto cr_error_section: end if '' ----- 'fv_sformulaname = "弌椡 帪娫" chr $ (0)' fv_sformulatime = "'" & format (now, "h H: MM: SS ") &" ' "& Chr $ (0)' If PESetFormula (fv_iJob, fv_sFormula_name, fv_sFormula_Time) = False Then GoTo CR_Error_Section: '' ----- fv_sTemp_Report_Name = UCase (Left (Right (g_sLPP_ReportName1, 12), 8)) If List_Print_Formula (fv_iJob_Handle, fv_sTemp_Report_Name) = False Then GoTo CR_Error_Section: '' ----- If PETestNthTableConnectivity (fv_iJob_Handle, 0) <> 1 Then GoTo CR_Error_Section: ''
----- ----- Label1 (1) .caption = "111" me.refresh if PestartPrintJob (fv_ijob_handle, true) <> 1 THEN GOTO CR_ERROR_SECTION: '' ---- ----- PECLOSEPRINTJOB (fv_ijob_handle) 'Close the Print Job' ----- ----- Gosub ResetPrinterinfo '--------- if g_ilpp_out_source = 1 Then Appactivate G_SLPP_REPORTNAME2 DoEvents End if Unload Me Exit Sub' ---- GetPrinterInfo: fv_sSaveDeviceName = Printer.DeviceName 'If fv_sSaveDeviceName = fv_sDeviceName Then Return' If fv_sDeviceName = gc_sPrnNonSel Then Return 'Do For Each fv_oPrinter In Printers If fv_oPrinter.DeviceName = fv_sDeviceName Then Exit Do Next Return' Loop '---- - ---- If fv_oPrinter.DeviceName = fv_sDeviceName Thenfv_sSetVal = fv_oPrinter.DeviceName & "," & fv_oPrinter.DriverName & "," & fv_oPrinter.Port fv_lRet = WriteProfileString ( "windows", "device", fv_sSetVal) fv_lRet = SendMessage ( HWND_Broadcast, WM_WININICHANGE, 0, BYVAL "Windows ") 'If peselectprinter (fv_ijob_handle, fv_oprinter.devicename, fiv_oprinter.devicename, false ten) = false the goto cr_ERROR_SECTION END IFRETURN
'ResetPrinterInfo: If fv_sSaveDeviceName = fv_sDeviceName Then Return' If fv_sDeviceName = gc_sPrnNonSel Then Return Do For Each fv_oPrinter In Printers If fv_oPrinter.DeviceName = fv_sSaveDeviceName Then Exit Do Next Return Loop If fv_oPrinter.DeviceName = fv_sSaveDeviceName Then