Gupta.narod.ru - примеры программирования на Gupta Team Developer 2005 (GTD, CTD, TOM, Quest, SQLTalk, Report Builder, SQLWindows, SQLBase, Oracle, Web Developer, Team Object Manager)

Найти: на
Скачать пример в архиве SalPrt
Вернуться на страницу архива примеров

.head 0 +  Application Description: Centura SQLWindows/32 Standard Application Template
.head 1 -  Outline Version - 4.0.27
.head 1 +  Design-time Settings
.data VIEWINFO
0000: 6F00000001000000 FFFF01000D004347 5458566965775374 6174650400010000
0020: 0000000000C10000 002C000000020000 0003000000FFFFFF FFFFFFFFFFFCFFFF
0040: FFE9FFFFFFFFFFFF FF000000007C0200 004D010000010000 0001000000010000
0060: 000F4170706C6963 6174696F6E497465 6D0100000012496E 7465726E616C2046
0080: 756E6374696F6E73
.enddata
.head 2 -  Outline Window State: Normal
.head 2 +  Outline Window Location and Size
.data VIEWINFO
0000: 6600040003002D00 0000000000000000 0000B71E5D0E0500 1D00FFFF4D61696E
0020: 0000000000000000 0000000000000000 0000003B00010000 00000000000000E9
0040: 1E800A00008600FF FF496E7465726E61 6C2046756E637469 6F6E730000000000
0060: 0000000000000000 0000000000003200 0100000000000000 0000E91E800A0000
0080: DF00FFFF56617269 61626C6573000000 0000000000000000 0000000000000000
00A0: 3000010000000000 00000000F51E100D 0000F400FFFF436C 6173736573000000
00C0: 0000000000000000 0000000000000000
.enddata
.data VIEWSIZE
0000: D000
.enddata
.head 3 -  Left: -0.013"
.head 3 -  Top:    0.0"
.head 3 -  Width:  8.013"
.head 3 -  Height: 4.969"
.head 2 +  Options Box Location
.data VIEWINFO
0000: D4180909B80B1A00
.enddata
.data VIEWSIZE
0000: 0800
.enddata
.head 3 -  Visible? No
.head 3 -  Left: 4.15"
.head 3 -  Top:    1.885"
.head 3 -  Width:  3.8"
.head 3 -  Height: 2.073"
.head 2 +  Class Editor Location
.head 3 -  Visible? No
.head 3 -  Left: 0.575"
.head 3 -  Top:    0.094"
.head 3 -  Width:  5.063"
.head 3 -  Height: 2.719"
.head 2 +  Tool Palette Location
.head 3 -  Visible? No
.head 3 -  Left: 6.388"
.head 3 -  Top:    0.729"
.head 2 -  Fully Qualified External References? Yes
.head 2 -  Reject Multiple Window Instances? No
.head 2 -  Enable Runtime Checks Of External References? Yes
.head 2 -  Use Release 4.0 Scope Rules? No
.head 1 -  Libraries
.head 1 +  Global Declarations
.head 2 +  Window Defaults
.head 3 +  Tool Bar
.head 4 -  Display Style? Etched
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Form Window
.head 4 -  Display Style? Etched
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Dialog Box
.head 4 -  Display Style? Etched
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Top Level Table Window
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Data Field
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Multiline Field
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Spin Field
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Background Text
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Pushbutton
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 3 +  Radio Button
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Check Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Option Button
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 3 +  Group Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Child Table Window
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  List Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Combo Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Line
.head 4 -  Line Color: Use Parent
.head 3 +  Frame
.head 4 -  Border Color: Use Parent
.head 4 -  Background Color: 3D Face Color
.head 3 +  Picture
.head 4 -  Border Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 2 +  Formats
.head 3 -  Number: 0'%'
.head 3 -  Number: #0
.head 3 -  Number: ###000
.head 3 -  Number: ###000;'($'###000')'
.head 3 -  Date/Time: hh:mm:ss AMPM
.head 3 -  Date/Time: M/d/yy
.head 3 -  Date/Time: MM-dd-yy
.head 3 -  Date/Time: dd-MMM-yyyy
.head 3 -  Date/Time: MMM d, yyyy
.head 3 -  Date/Time: MMM d, yyyy hh:mm AMPM
.head 3 -  Date/Time: MMMM d, yyyy hh:mm AMPM
.head 2 -  External Functions
.head 2 +  Constants
.data CCDATA
0000: 3000000000000000 0000000000000000 00000000
.enddata
.data CCSIZE
0000: 1400
.enddata
.head 3 -  System
.head 3 -  User
.head 2 -  Resources
.head 2 -  Variables
.head 2 +  Internal Functions
.head 3 -  ! ! Printer
.head 3 +  Function: SalPrtGetPrinters
.head 4 -  Description: 
author: 	newsgroupcode, tl
date:	2002
version:	1.00

desc:

example:
.head 4 +  Returns
.head 5 -  Number:
.head 4 +  Parameters
.head 5 -  Receive String: rsPrinterName[*]
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Receive String: rsPrinterDriver[*]
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Receive String: rsPrinterPort[*]
.data INHERITPROPS
0000: 0100
.enddata
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: lnCount
.head 5 -  Number: lnIdx
.head 5 -  String: lsPrinterNames[*]
.data INHERITPROPS
0000: 0100
.enddata
.head 4 +  Actions
.head 5 -  Call VisProfileEnumStrings( 'WIN.INI', 'Devices', lsPrinterNames )
.head 5 +  If SalArrayIsEmpty( lsPrinterNames )
.head 6 -  Return NUMBER_Null
.head 5 -  Call SalArrayGetUpperBound( lsPrinterNames,1,lnCount)
.head 5 +  While lnIdx < lnCount
.head 6 -  Set rsPrinterName[lnIdx] = lsPrinterNames[lnIdx]
.head 6 -  Call SalPrtGetPrinterSettings( rsPrinterName[lnIdx],rsPrinterDriver[lnIdx],rsPrinterPort[lnIdx])
.head 6 -  Set lnIdx = lnIdx + 1
.head 5 -  Return lnCount
.head 3 +  Function: SalPrtGetPrinterSettings
.head 4 -  Description: 
author: 	newsgroupcode, tl
date:	2002
version:	1.00

desc:

example:
.head 4 -  Returns
.head 4 +  Parameters
.head 5 -  String: sPrinterName
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Receive String: sPrinterDriver
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Receive String: sPrinterPort
.data INHERITPROPS
0000: 0100
.enddata
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  String: lsProfiles[*]
.head 5 -  String: sPrinterProfile
.data INHERITPROPS
0000: 0100
.enddata
.head 4 +  Actions
.head 5 -  Call SalGetProfileString('Devices',sPrinterName,'',sPrinterProfile, 'WIN.INI' )
.head 5 -  Call SalStrTokenize(sPrinterProfile,'',',', lsProfiles )
.head 5 -  Set sPrinterDriver = lsProfiles[0]
.head 5 -  Set sPrinterPort = lsProfiles[1]
.head 3 +  Function: SalPrtPrintFile
.head 4 -  Description: author: 	???
date:	???
version:	1.00

desc:
Prints a file with the to the file associated programm over the standard printer.
If there is no application associated with the given file name extension
this function open the 'open with' dialog.

example:

if SalPrtPrintFile('C:\\Temp\\Test.pdf', lsError ) > 0
   Call SalMessageBox( lsError,'Print Error', MB_Ok)
   Return FALSE

.head 4 +  Returns
.head 5 +  Number:
.head 6 -  ! the errorcode of shellexecute (SE_*)
.head 4 +  Parameters
.head 5 +  String: p_sFilename
.head 6 -  ! the filename
.head 5 +  Receive String: pr_sErrorString
.head 6 -  ! a errorstring
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: l_nReturn
.head 4 +  Actions
.head 5 -  Set l_nReturn = ShellExecuteA(
	hWndNULL,
	"Print",
	p_sFilename,
	"",
	"",
	Window_Normal )   !!! SW_SHOWNORMAL
.head 5 +  If l_nReturn <= 32
.head 6 +  Select Case l_nReturn
.head 7 +  ! -- possible error codes
.head 8 -   SE_ERR_FNF = 2
.head 8 -   SE_ERR_PNF = 3
.head 8 -   SE_ERR_ACCESSDENIED = 5
.head 8 -   SE_ERR_OO#M = 8
.head 8 -   SE_ERR_DLLNOTFOUND = 32
.head 8 -   SE_ERR_SHARE = 26
.head 8 -   SE_ERR_ASSOCINCOMPLETE = 27
.head 8 -   SE_ERR_DDETIMEOUT = 28
.head 8 -   SE_ERR_DDEFAIL = 29
.head 8 -   SE_ERR_DDEBUSY = 30
.head 8 -   SE_ERR_NOASSOC = 31
.head 7 -  !
.head 7 +  Case 31
.head 8 -  ! -- if there is no application associated with the given file name extension
! -- try to open the 'open with' dialog
.head 8 -  !
.head 8 -  Set l_nReturn = WinExec( "RunDLL32.exe shell32,OpenAs_RunDLL " || p_sFilename, Window_Normal )   !!! SW_SHOWNORMAL
.head 8 +  If l_nReturn <= 31
.head 9 +  Select Case l_nReturn
.head 10 +  ! -- possible error codes
.head 11 -   ERROR_FILE_NOT_FOUND = 2
.head 11 -   ERROR_PATH_NOT_FOUND = 3
.head 11 -   ERROR_BAD_FORMAT = 11
.head 10 -  !
.head 10 +  Case 0
.head 11 -  Set pr_sErrorString = "The system is out of memory or resources."
.head 11 -  Break
.head 10 +  Case 2
.head 11 -  Set pr_sErrorString = "The specified file was not found."
.head 11 -  Break
.head 10 +  Case 3
.head 11 -  Set pr_sErrorString = "The specified path was not found."
.head 11 -  Break
.head 10 +  Case 11
.head 11 -  Set pr_sErrorString = "The .EXE file is invalid (non-Win32 .EXE or error in .EXE image)."
.head 11 -  Break
.head 10 +  Default
.head 11 -  Set pr_sErrorString = "Unknown error number: " || SalNumberToStrX( l_nReturn, 0 )
.head 11 -  Break
.head 8 +  Else
.head 9 -  ! -- everthing fine
.head 9 -  Return NUMBER_Null
.head 8 -  !
.head 8 -  Set pr_sErrorString = "There is no application associated with the given file name extension."
.head 8 -  Break
.head 7 +  Default
.head 8 -  Set pr_sErrorString = "Unknown error number: " || SalNumberToStrX( l_nReturn, 0 )
.head 8 -  Break
.head 5 +  Else
.head 6 -  ! -- everthing fine
.head 6 -  Return NUMBER_Null
.head 5 -  !
.head 5 -  Return l_nReturn
.head 3 +  Function: SalPrtPrintItemContent
.head 4 -  Description: author: 	gb
date:	2000
version:	1.00

desc:
Prints the content of DataFields, MultilineText, ListBox, ComboBox etc with notepad or wordpad

ATTENTION!!!
For printing the temporary file 'print.tmp' is created
This file should be delete with VisFileDelete(...) when you have printed it or close your application.
.head 4 -  Returns
.head 4 +  Parameters
.head 5 -  Window Handle: phWnd
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  File Handle: lhWfile
.head 5 -  String: lsPath
.head 5 -  Long String: lsItemContent
.head 5 -  Number: lnError
.head 5 -  Number: lnBoxEntries
.head 5 -  Number: lnIdx
.head 4 +  Actions
.head 5 +  Select Case SalGetType(phWnd)
.head 6 +  Case TYPE_FormWindow
.head 7 -  Call SalPrtPrintForm(phWnd)
.head 7 -  Return TRUE
.head 7 -  Break
.head 6 -  !
.head 6 -  Case TYPE_ComboBox
.head 6 +  Case TYPE_ListBox
.head 7 -  Set lnBoxEntries = SalListQueryCount(phWnd)
.head 7 -  Set lnIdx = 0
.head 7 +  While lnIdx <= lnBoxEntries
.head 8 -  Set lsItemContent = lsItemContent || SalListQueryTextX( phWnd, lnIdx ) || '
'
.head 8 -  Set lnIdx = lnIdx + 1
.head 7 -  Break
.head 6 -  !
.head 6 -  Case TYPE_MultilineText
.head 6 +  Case TYPE_DataField
.head 7 -  Call SalGetWindowText(phWnd, lsItemContent, 32000)
.head 7 -  Break
.head 6 -  !
.head 6 +  Default
.head 7 -  Return FALSE
.head 7 -  Break
.head 5 -  !
.head 5 +  If lsItemContent
.head 6 +  If SalFileOpen(lhWfile, "print.tmp", OF_Create | OF_Write)
.head 7 -  Call SalFilePutStr(lhWfile, lsItemContent)
.head 7 -  Call SalFileClose(lhWfile)
.head 7 -  If Not ShellExecuteA( hWndNULL, "open","Wordpad.exe", '/p "print.tmp"', "", SW_SHOWMINIMIZED) >= 32
.head 7 +  Else
.head 8 +  If Not ShellExecuteA( hWndNULL, "open","Wordpad.exe", '/p "print.tmp"', "", SW_SHOWMINIMIZED) >= 32
.head 9 -  Return FALSE
.head 6 +  Else
.head 7 -  Return FALSE
.head 5 +  Else
.head 6 -  Return FALSE
.head 3 +  Function: SalPrtPrintStr
.head 4 -  Description: author: 	gb
date:	2000
version:	1.00

desc:
Prints a string with notepad or wordpad

ATTENTION!!!
For printing the temporary file 'print.tmp' is created
This file should be delete with VisFileDelete(...) when you have printed it or close your application.

.head 4 -  Returns
.head 4 +  Parameters
.head 5 -  Long String: psPrtStr
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  File Handle: lhWfile
.head 5 -  String: lsPath
.head 4 +  Actions
.head 5 -  !
.head 5 +  If psPrtStr
.head 6 +  If SalFileOpen(lhWfile, "print.tmp", OF_Create | OF_Write)
.head 7 -  Call SalFilePutStr(lhWfile, psPrtStr)
.head 7 -  Call SalFileClose(lhWfile)
.head 7 -  If ShellExecuteA( hWndNULL, "open","Notepad.exe", '/p "print.tmp"', "", SW_SHOWMINIMIZED) >= 32
.head 7 +  Else
.head 8 +  If Not ShellExecuteA( hWndNULL, "open","Wordpad.exe", '/p "print.tmp"', "", SW_SHOWMINIMIZED) >= 32
.head 9 -  Return FALSE
.head 6 +  Else
.head 7 -  Return FALSE
.head 5 +  Else
.head 6 -  Return FALSE
.head 3 +  Function: SalPrtPrintScreen
.head 4 -  Description: author: 	???
date:	???
version:	1.00

desc:
Prints current window or screen.  Pass hWndNULL to print screen.
p_bScale:  TRUE - Expand Window to fit page,  FALSE - Original size on screen
Margin:  In inches.

example:
.head 4 +  Returns
.head 5 -  Boolean:
.head 4 +  Parameters
.head 5 -  Window Handle: p_hWnd
.head 5 -  Boolean: p_bScaleToPageSize
.head 5 -  Number: p_nLeftMargin	! in inches
.head 5 -  Number: p_nRightMargin	! in inches
.head 5 -  Number: p_nTopMargin	! in inches
.head 5 -  Number: p_nBottomMargin	! in inches
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: nRet
.head 5 -  Number: nPrinterDC
.head 5 -  Number: nScreenDC
.head 5 -  Number: nMemDC
.head 5 -  Number: hBitmap
.head 5 -  Number: nDoc
.head 5 -  Number: nPage
.head 5 -  Number: nPrinterWidth
.head 5 -  Number: nPrinterHeight
.head 5 -  Number: nScreenWidth
.head 5 -  Number: nScreenHeight
.head 5 -  Number: nImageWidth
.head 5 -  Number: nImageHeight
.head 5 -  Number: nWidthToUse
.head 5 -  Number: nHeightToUse
.head 5 -  Number: nDPI
.head 5 -  Number: nMinMargin
.head 5 -  Number: nLeft
.head 5 -  Number: nTop
.head 5 -  Number: nRight
.head 5 -  Number: nBottom
.head 5 -  Number: nScaleX
.head 5 -  Number: nScaleY
.head 5 -  Number: nScale
.head 5 -  String: sDriver
.head 5 -  String: sDevice
.head 5 -  String: sPort
.head 4 +  Actions
.head 5 -  Set nRet = TRUE
.head 5 -  !
.head 5 -  ! if accessories are enabled, get the right hWndForm
.head 5 +  If p_hWnd != hWndNULL
.head 6 +  If SalGetFirstChild( hWndForm, TYPE_FormToolBar ) != hWndNULL	! toolbar found
.head 7 -  Set p_hWnd = GetParent( hWndForm )
.head 5 -  !
.head 5 +  If nRet
.head 6 -  ! Use default printer
.head 6 -  Set nRet = SalPrtGetDefault(sDevice, sDriver, sPort)
.head 5 +  If nRet
.head 6 -  ! Get the device context for the whole screen
.head 6 -  Set nScreenDC = CreateDCA('DISPLAY', STRING_Null, STRING_Null, STRING_Null)
.head 6 -  Set nRet = (nScreenDC > 0)
.head 5 +  If nRet
.head 6 -  ! Get the screen size
.head 6 -  Set nScreenWidth = GetDeviceCaps(nScreenDC, HORZRES)
.head 6 -  Set nScreenHeight = GetDeviceCaps(nScreenDC, VERTRES)
.head 6 -  Set nRet = (nScreenWidth > 0 AND nScreenHeight > 0)
.head 5 +  If nRet
.head 6 -  ! Create a device context for the printer
.head 6 -  Set nPrinterDC = CreateDCA(sDriver, sDevice, STRING_Null, STRING_Null)
.head 6 -  Set nRet = (nPrinterDC > 0)
.head 5 +  If nRet
.head 6 -  ! Get the paper size
.head 6 -  Set nPrinterWidth = GetDeviceCaps(nPrinterDC, HORZRES)
.head 6 -  Set nPrinterHeight = GetDeviceCaps(nPrinterDC, VERTRES)
.head 6 -  ! take care of margins
.head 6 -  ! left & right
.head 6 +  If p_nLeftMargin != 0 OR p_nRightMargin != 0
.head 7 -  Set nDPI = GetDeviceCaps(nPrinterDC, LOGPIXELSX)
.head 7 -  Set nMinMargin = GetDeviceCaps(nPrinterDC, PHYSICALOFFSETX)
.head 7 +  If p_nLeftMargin != 0
.head 8 -  Set p_nLeftMargin = p_nLeftMargin * nDPI - nMinMargin
.head 8 +  If p_nLeftMargin < 0
.head 9 -  Set p_nLeftMargin = 0
.head 7 +  If p_nRightMargin != 0
.head 8 -  Set p_nRightMargin = p_nRightMargin * nDPI - nMinMargin
.head 8 +  If p_nRightMargin < 0
.head 9 -  Set p_nRightMargin = 0
.head 6 -  ! top & bottom
.head 6 +  If p_nTopMargin != 0 OR p_nBottomMargin != 0
.head 7 -  Set nDPI = GetDeviceCaps(nPrinterDC, LOGPIXELSY)
.head 7 -  Set nMinMargin = GetDeviceCaps(nPrinterDC, PHYSICALOFFSETY)
.head 7 +  If p_nTopMargin != 0
.head 8 -  Set p_nTopMargin = p_nTopMargin * nDPI - nMinMargin
.head 8 +  If p_nTopMargin < 0
.head 9 -  Set p_nTopMargin = 0
.head 7 +  If p_nBottomMargin != 0
.head 8 -  Set p_nBottomMargin = p_nBottomMargin * nDPI - nMinMargin
.head 8 +  If p_nBottomMargin < 0
.head 9 -  Set p_nBottomMargin = 0
.head 6 -  Set nRet = (nPrinterWidth > 0 AND nPrinterHeight > 0)
.head 5 +  If nRet
.head 6 -  ! Create a device context in the memory
.head 6 -  Set nMemDC = CreateCompatibleDC(nScreenDC)
.head 6 -  Set nRet = (nMemDC > 0)
.head 5 +  If nRet
.head 6 -  ! Create a bitmap from screen
.head 6 -  Set hBitmap = CreateCompatibleBitmap(nScreenDC, nScreenWidth, nScreenHeight)
.head 6 -  Set nRet = (hBitmap > 0)
.head 5 +  If nRet
.head 6 -  ! Select the bitmap
.head 6 -  Set nRet = SelectObject(nMemDC, hBitmap)
.head 5 +  If nRet
.head 6 -  ! Get the Bitmap (Screen)
.head 6 -  Set nRet = BitBlt(nMemDC, 0, 0, nScreenWidth, nScreenHeight, nScreenDC, 0, 0, SRCCOPY)
.head 5 +  If nRet
.head 6 -  ! Get the size of the window if necessary
.head 6 +  If p_hWnd != hWndNULL
.head 7 -  Set nRet = GetWindowRect(p_hWnd, nLeft, nTop, nRight, nBottom)
.head 6 +  Else
.head 7 -  Set nLeft = 0
.head 7 -  Set nTop = 0
.head 7 -  Set nRight = nScreenWidth
.head 7 -  Set nBottom = nScreenHeight
.head 6 -  ! get the scale right
.head 6 -  ! proportional - Use the whole page
.head 6 -  ! not proportional - use page based on window size -- for screen print, use whole page
.head 6 +  If p_bScaleToPageSize	! fit to page scale
.head 7 -  Set nWidthToUse = nRight - nLeft
.head 7 -  Set nHeightToUse = nBottom - nTop
.head 6 +  Else
.head 7 -  Set nWidthToUse = nScreenWidth
.head 7 -  Set nHeightToUse = nScreenHeight
.head 6 -  ! Adjust the proportions
.head 6 -  Set nPrinterWidth = nPrinterWidth - p_nLeftMargin - p_nRightMargin
.head 6 -  Set nPrinterHeight = nPrinterHeight - p_nTopMargin - p_nBottomMargin
.head 6 +  If nWidthToUse > nPrinterWidth
.head 7 -  Set nScaleX = nWidthToUse / nPrinterWidth
.head 6 +  Else
.head 7 -  Set nScaleX = nPrinterWidth / nWidthToUse
.head 6 +  If nHeightToUse > nPrinterHeight
.head 7 -  Set nScaleY = nHeightToUse / nPrinterHeight
.head 6 +  Else
.head 7 -  Set nScaleY = nPrinterHeight / nHeightToUse
.head 6 +  If nScaleX < nScaleY
.head 7 -  Set nScale = nScaleX
.head 6 +  Else
.head 7 -  Set nScale = nScaleY
.head 5 +  If nRet
.head 6 -  ! Start the document
.head 6 -  Set nDoc = StartDocA(nPrinterDC, 20, 'Print Form', STRING_Null, STRING_Null, 0)
.head 6 -  Set nRet = (nDoc > 0)
.head 5 +  If nRet
.head 6 -  ! Start the page
.head 6 -  Set nPage = StartPage(nPrinterDC)
.head 6 -  Set nRet = (nPage > 0)
.head 5 +  If nRet
.head 6 -  ! Copy the bitmap to the printer with scaling
.head 6 -  Set nImageWidth = (nRight - nLeft) * nScale
.head 6 -  Set nImageHeight = (nBottom - nTop) * nScale
.head 6 -  Set nRet = StretchBlt(nPrinterDC, (nPrinterWidth-nImageWidth)/2 + p_nLeftMargin,
	(nPrinterHeight-nImageHeight)/2 + p_nTopMargin,
	nImageWidth, nImageHeight,
	nMemDC, nLeft, nTop, nRight - nLeft, nBottom - nTop, SRCCOPY)
.head 5 -  ! End the page
.head 5 +  If nPage > 0
.head 6 -  Set nRet = nRet AND (EndPage(nPrinterDC) > 0)
.head 5 -  ! End the document
.head 5 +  If nDoc > 0
.head 6 -  Set nRet = nRet AND (EndDoc(nPrinterDC) > 0)
.head 5 -  ! Clean up all used handles
.head 5 +  If hBitmap > 0
.head 6 -  Set nRet = nRet AND DeleteObject(hBitmap)
.head 5 +  If nMemDC > 0
.head 6 -  Set nRet = nRet AND DeleteDC(nMemDC)
.head 5 +  If nPrinterDC > 0
.head 6 -  Set nRet = nRet AND DeleteDC(nPrinterDC)
.head 5 +  If nScreenDC > 0
.head 6 -  Set nRet = nRet AND DeleteDC(nScreenDC)
.head 5 -  !
.head 5 -  ! goodbye
.head 5 -  Return nRet
.head 3 +  Function: SalPrtDeviceOpen
.head 4 -  Description: author: 	Jean-Marc Gemperle  (tip of the month contribution)
date:	24.03.2003
version:	1.00

desc:
Returns a device handle for the printer

example:
Call SalPrtGetDefault( sDevice, sDriver, sPort )
hDCPrinter = SalPrtDeviceOpen(sDevice, sDriver, psPort )
.head 4 +  Returns
.head 5 -  Number:
.head 4 +  Parameters
.head 5 +  String: psDevice
.data INHERITPROPS
0000: 0100
.enddata
.head 6 -  ! the printer
.head 5 -  String: psDriver
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Receive String: psPort
.data INHERITPROPS
0000: 0100
.enddata
.head 4 -  Static Variables
.head 4 -  Local variables
.head 4 +  Actions
.head 5 -  Return CreateDCA( psDriver, psDevice, psPort, STRING_Null )
.head 3 +  Function: SalPrtDeviceClose
.head 4 -  Description: author: 	Jean-Marc Gemperle  (tip of the month contribution)
date:	24.03.2003
version:	1.00

desc:
Destroys a device handle for the printer
.head 4 +  Returns
.head 5 -  Boolean:
.head 4 +  Parameters
.head 5 -  Number: hDCPrinter
.data INHERITPROPS
0000: 0100
.enddata
.head 4 -  Static Variables
.head 4 -  Local variables
.head 4 +  Actions
.head 5 +  If not hDCPrinter
.head 6 -  Return FALSE
.head 5 -  Return DeleteDC( hDCPrinter )
.head 3 +  Function: SalPrtSetupDlg
.head 4 -  Description: author: 	Jean-Marc Gemperle  (tip of the month contribution)
date:	24.03.2003
version:	1.00

desc:
Shows the default printer setup dialog

example:
.head 4 -  Returns
.head 4 +  Parameters
.head 5 -  Window Handle: phWndParent
.data INHERITPROPS
0000: 0100
.enddata
.head 5 +  Receive String: psDevice
.data INHERITPROPS
0000: 0100
.enddata
.head 6 -  ! the printer
.head 5 -  Receive String: psDriver
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Receive String: psPort
.data INHERITPROPS
0000: 0100
.enddata
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: hDCPrinter
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: nhDevNames
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: DevNames
.head 5 -  String: strData
.head 4 +  Actions
.head 5 -  !
.head 5 -  ! Get the default  device
.head 5 +  If psDevice = STRING_Null
.head 6 -  Call SalPrtGetDefault(psDevice, psDriver, psPort )
.head 5 -  Set hDCPrinter= SalPrtDeviceOpen( psDevice, psDriver, psPort )
.head 5 -  !
.head 5 +  If not hDCPrinter
.head 6 -  Return FALSE
.head 5 -  ! open the dialog
.head 5 +  If PrintDlgA( 66, phWndParent, 0, nhDevNames,hDCPrinter,
PD_PRINTSETUP | PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC,
0, 0, 0, 0, 0, 0, 0, 0, 0,
STRING_Null, STRING_Null,0, 0 )
.head 6 -  !
.head 6 -  ! GlobalLock returns us a pointer for the DevNames
.head 6 -  Set DevNames=GlobalLock( nhDevNames )
.head 6 -  Call SalStrSetBufferLength( strData, 8 )
.head 6 -  !
.head 6 -  ! strData will contain the offsets of the 4 Devenames entries at DevNames + offset
.head 6 -  Call CStructCopyFromFarMem( DevNames, strData, 8 )
.head 6 -  !
.head 6 -  ! handy wsprintf function !
.head 6 -  Call SalStrSetBufferLength (psDriver, 260)
.head 6 -  Call SalStrSetBufferLength (psDevice, 260)
.head 6 -  Call SalStrSetBufferLength (psPort, 260)
.head 6 -  Call wsprintfA(psDriver,"%s",DevNames+ CStructGetWord( strData, 0 ))
.head 6 -  Call wsprintfA(psDevice,"%s",DevNames+ CStructGetWord( strData, 2))
.head 6 -  Call wsprintfA(psPort,"%s",DevNames+ CStructGetWord( strData, 4))
.head 6 -  Call GlobalUnlock( nhDevNames )
.head 6 -  !
.head 6 -  Call SalPrtDeviceClose( hDCPrinter )
.head 6 -  Return TRUE
.head 5 -  Call SalPrtDeviceClose( hDCPrinter )
.head 5 -  Return FALSE
.head 3 +  Function: SalPrtPropertyDlg
.head 4 -  Description: author: 	Thomas L.
date:	24.03.204
version:	1.00

desc:
Shows the printer property dialog
.head 4 +  Returns
.head 5 -  Boolean:
.head 4 +  Parameters
.head 5 -  String: sDevice
.head 5 -  String: sDriver
.head 5 -  String: sPort
.head 5 -  Window Handle: hWndParent
.data INHERITPROPS
0000: 0100
.enddata
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: hPrinter
.data INHERITPROPS
0000: 0100
.enddata
.head 4 +  Actions
.head 5 +  If sDevice = STRING_Null AND sDriver = STRING_Null
.head 6 -  Call SalPrtGetDefault ( sDevice, sDriver, sPort )
.head 5 +  If NOT OpenPrinterA( sDevice, hPrinter, 0 )
.head 6 -  Return FALSE
.head 5 -  Call PrinterProperties(hWndParent, hPrinter )
.head 5 -  Call ClosePrinter( hPrinter )
.head 5 -  Return TRUE
.head 2 -  Named Menus
.head 2 -  Class Definitions
.head 2 +  Default Classes
.head 3 -  MDI Window: cBaseMDI
.head 3 -  Form Window:
.head 3 -  Dialog Box:
.head 3 -  Table Window:
.head 3 -  Quest Window:
.head 3 -  Data Field:
.head 3 -  Spin Field:
.head 3 -  Multiline Field:
.head 3 -  Pushbutton:
.head 3 -  Radio Button:
.head 3 -  Option Button:
.head 3 -  Check Box:
.head 3 -  Child Table:
.head 3 -  Quest Child Window: cQuickDatabase
.head 3 -  List Box:
.head 3 -  Combo Box:
.head 3 -  Picture:
.head 3 -  Vertical Scroll Bar:
.head 3 -  Horizontal Scroll Bar:
.head 3 -  Column:
.head 3 -  Background Text:
.head 3 -  Group Box:
.head 3 -  Line:
.head 3 -  Frame:
.head 3 -  Custom Control:
.head 3 -  ActiveX:
.head 2 -  Application Actions


Gupta.narod.ru - примеры программирования на Gupta Team Developer 2005 (GTD, CTD, TOM, Quest, SQLTalk, Report Builder, SQLWindows, SQLBase, Oracle, Web Developer, Team Object Manager)

Google
 

Return to http://gupta.narod.ru/


Сайт создан в системе uCoz