Here's a sample for 3270 Office Vision and OLE to Word 7.x
The goal was to use common 32-bit API to print to the Word
for Windows object without displaying Word (hidden task)
'--------------------------------------------------------
' Sample code to logon to Host and send mail to Word 7
' Environment: Attachmate Extra Personal Client 6.1
' with Windows 95 and Word for Windows 7.x
'--------------------------------------------------------
' User is logged on to OASW (Office Vision/3270 Host)
' and wants to print the contents of the message
' This sample illustrates how to display a status to user
' with Windows 32-bit API and how to use OLE to Word 7.0
'-------------------------------------------------------
' Written by : Rasanen, Email: rasanen@msn.com 5/11/96
'--------------------------------------------------------
' Watch out for split lines !!
'--------------------------------------------------------
'API Support
Const STAND_WAITBOX = &H80400001
Const WS_OVERLAPPED = &H0&
Const WS_CAPTION = &HC00000 ' WS_BORDER Or WS_DLGFRAME
Const WS_SYSMENU = &H80000
Const WS_THICKFRAME = &H40000
Const WS_MINIMIZEBOX = &H20000
Const WS_MAXIMIZEBOX = &H10000
Const WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or
WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)
Const WS_EX_TOPMOST = &H8&
'Not needed for this app - for sample only
Declare Function ExitWindows Lib "user32" (ByVal dwReserved As Long, ByVal
ReturnCode As Long) As Long
Declare Function WriteProfile Lib "kernel32" Alias
"WritePrivateProfileStringA
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As
Any,ByVal lpFileName As String) As Long
Declare Function GetProfile Lib "kernel32" Alias "GetPrivateProfileStringA"
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault
s
String,ByVal lpReturnedString As String, ByVal nSize As Long, ByVal
pFileName
As String) As Long
'Not needed for this app - for sample only
'These are used
Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal
dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As
String,ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth
As
Long,ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As
Long,ByVal
hInstance As Long, lpParam As Any) As Long
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow
A
Long) As Long
Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA"
(ByVa
lpModuleName As String) As Long
'Global variable declarations
Global g_HostSettleTime%
Function EndWaitBox(hMessWnd&) As Long
EndWaitBox = DestroyWindow(hMessWnd&)
End Function
Function WaitBox(WaitString$) As Long
Dim hUserInst&, hMessWnd&, rc&
hUserInst& = GetModuleHandle("USER32")
If hUserInst& = 0 Then
MsgBox "ERROR! Unable to get Module handle for 'USER'"
Exit Function
End If
hMessWnd& =
CreateWindowEx(WS_EX_TOPMOST,"STATIC",WaitString$,STAND_WAITBOX,250, 350,
00,
29, 0, 0, hUserInst&, Chr$(0))
If hMessWnd& = 0 Then
MsgBox "ERROR! Unable to create WaitBox window."
Exit Function
End If
rc& = ShowWindow(hMessWnd&, 5) ' SW_SHOWNORMAL
WaitBox = hMessWnd&
End Function
'-------------------------------------------------------------------
Sub Main()
'-----------------------------------------------------------------------------
-
' Get the main system object
Dim x&
Dim hwnd&
hwnd& = WaitBox("Initializing...")
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system
objec
If (System is Nothing) Then
x& = EndWaitBox(hwnd&)
(Continued to next message)
--- WILDMAIL!/WC v4.12
---------------
* Origin: Eagle Eye 954-584-6258 Internet: rasanen@msn.com (1:369/73.0)
|