Eu postei no forum dos desenvolvedores do Harbour sobre um problema de a GTWVW esta com algumas funções com o mesmo nome da Hbwin.
Este é o arquivo de nome preview.hbc.
preview.prg corrigido para o Harbour.
Código: Selecionar todos
//
// PRINT PREVIEW WITH GTWVW, USING HBEDITOR
// MANOEL ANGEIRAS, 12/2009
//
// ALL FILES FOR THIS PROJECT YOU CAN DOWNLOAD FROM A 4SHARED LINK :
//
// http://www.4shared.com/file/183564422/aa4ded4d/preview.html
//
#include "inkey.ch"
#include "common.ch"
//#include "winuser.ch"
//#include "wingdi.ch"
#include "setcurs.ch"
#include "getexit.ch"
#include "directry.ch"
#include "box.ch"
#define RGB( nR,nG,nB ) ( nR + ( nG * 256 ) + ( nB * 256 * 256 ) )
//
// Toolbar defines
//
#define IDM_PRINT 401
#define IDM_PROCURAR 402 // search
#define IDM_IRPARA 403 // goto
#define IDM_SAIR 404 // quit
#define IDM_BACK 405
#define IDM_FORWARD 406
#define IDM_FIRST 407
#define IDM_END 408
#define IDM_SALVAR_TXT 409 // save to txt
#define IDM_SALVAR_PDF 410 // save to pdf
#define IDM_SALVAR_DOC 411 // save to doc
#define IDM_SALVAR_XLS 412 // save to xls
//
// print defines
//
#define K_LINEFEED 10
#define DF_SALTO_PAGINA "@SP"
#define DF_SAYPRINT( x, vf ) oPrinter:TextOut( x, vf )
//
// Create PDF file defines
//
#define DF_CALCFONT( n ) if( n <= 90, 11, if( n > 90 .and. n <= 110, 8, 8 ) )
//
// Create RTF file defines
//
#define CRLF chr(K_ENTER) + chr(K_LINEFEED)
#define INI_RTF "{\rtf1\ansi\deff0{\fonttbl {\f0\fnil\fcharset0 Courier New;}{\f1\fnil\fcharset0 Arial;}}\uc1\pard\lang1033\ulnone\f0\fs20"+CRLF
#define FIM_RTF "\f1\fs16\par"+CRLF+"}"
REQUEST HB_GT_WVW_DEFAULT
REQUEST HB_GT_WVW
****************************
FUNCTION MAIN( cFile, nLen )
****************************
public _aPalette
public _aObjetos := {}
public p_nNormalMaxrow := 52
public p_nNormalMaxcol := 144
public _paginatual // current page
public _file
public _len
public _acols := { 132 }
default cFile to "", nLen to 80
if empty( cFile )
quit
endif
_file := cFile
_len := if( valtype( nLen ) == "C", val( nLen ), nLen )
if _len > 80
wvw_SetFont(,"Lucida Console" , 12, 0, 0, 0 )
else
wvw_setfont(,"Courier new", 22, 10, 0, 0)
// wvw_SetFont(,'Ms Sans Serif' , 16, 8, 0, 0 )
// wvw_SetFont(,'Ms Sans Serif' , 16, 8, FW_MEDIUM, DEFAULT_QUALITY )
endif
set eventmask to INKEY_ALL
wvw_noclose()
wvw_size_ready(.T.)
wvw_setmaincoord(.F.)
wvw_SetPaintRefresh(0)
WVW_SetCodePage(,255)
wvw_SetVertCaret(.T.)
wvw_enableshortcuts(0,.T.)
wvw_setdeflinespacing(4)
wvw_setdeflspacecolor(7)
wvw_maximize()
wvw_setmousemove(,.T.)
ConfigCores()
setcolor("w/n*")
cls
wvw_seticon(, 100)
// SetInkeyAfterBlock({|nkey| fAfterInkeyPRN( nkey ) })
wvw_tbcreate( , .F., NIL, 2 )
wvw_tbAddButton( )
wvw_tbAddButton( , IDM_PRINT , 307 , "Imprimir" , 0, .T. )
wvw_tbAddButton( )
wvw_tbAddButton( , IDM_SALVAR_TXT, 308 , "Gravar em TXT" , 0, .T. )
wvw_tbAddButton( , IDM_SALVAR_PDF, 309 , "Exportar como PDF" , 0, .T. )
wvw_tbAddButton( , IDM_SALVAR_DOC, 310 , "Exportar como Documento Word", 0, .T. )
wvw_tbAddButton( , IDM_SALVAR_XLS, 311 , "Exportar como Planilha Excel", 0, .T. )
wvw_tbAddButton( )
wvw_tbAddButton( , IDM_FIRST , 207 , "Início" , 0, .T. )
wvw_tbAddButton( , IDM_BACK , 213 , "Página Anterior" , 0, .T. )
wvw_tbAddButton( , IDM_FORWARD , 212 , "Próxima Página" , 0, .T. )
wvw_tbAddButton( , IDM_END , 210 , "Final" , 0, .T. )
wvw_tbAddButton( )
wvw_tbAddButton( , IDM_PROCURAR , 303 , "Pesquisar Texto" , 0, .T. )
wvw_tbAddButton( , IDM_IRPARA , 312 , "Ir para Página" , 0, .T. )
wvw_tbAddButton( )
wvw_tbAddButton( , IDM_SAIR , 304 , "Sair" , 0, .T. )
wvw_SBcreate()
wvw_SBaddPart( , space(12) )
wvw_SBaddPart( , space(12) )
view( cFile, nLen )
RETURN
************************************
STATIC PROCEDURE View( cFile, nLen )
************************************
local nkey, nCursor := setcursor()
private oEdit
if valtype( nLen ) == "C"
nLen := val( nLen )
endif
//
// TRANSFORMAR O MARCARDOR @sp EM FINAL DE PAGINA GRAFICO
//
// In text file, @SP points to end of page
//
nHandle := fCreate("TEMP.TXT")
cNTexto := ""
cTexto := memoread( cFile )
nLinhas := mlcount( cTexto, nLen, 1, .F. )
aPag := { { 1, 1, 0 } }
nPag := 1
for nA := 1 to nLinhas
cLinha := memoline( cTexto, nLen, nA, 1, .F. )
if left( alltrim( cLinha ), 3 ) == DF_SALTO_PAGINA
cLinha := replicate(chr(223), nLen+1)
nPag++
aPag[ len( aPag ), 3 ] := nA
aadd( aPag, { nPag, nA+1, 0 } )
endif
fWrite( nHandle, cLinha + chr(13) + chr(10) )
next
aPag[ len( aPag ), 3 ] := nLinhas+1
fClose( nHandle )
if nLen < 132
nMargem := round( ( maxcol() - nLen ) / 2, 0 )
else
nMargem := 6
endif
//
// ESTOU USANDO UM HBEditor MODIFICADO
//
// Using a changed HBEditor file
//
oEdit := HBEditor():New( "", 0, nMargem, wvw_maxmaxrow(), maxcol()-nMargem, .F., nLen )
oEdit:lWordWrap := .F.
oEdit:setcolor("n/w*")
oEdit:Loadfile( "TEMP.TXT" )
oEdit:GoToPos(1,1,.T.)
oEdit:RefreshLine(, "n+/gr+*")
setcursor(0)
while .t. //Alterador por Itamar M. Lins Jr. estava comsumindo 100% a CPU.
nKey := inkey(0)
if nKey # 0
oEdit:RefreshLine()
oEdit:MoveCursor(nKey)
wvw_sbSetText(, 1, " Pag " + strzero( AtuPag( oEdit:nRow ), 3 ) )
wvw_sbSetText(, 2, " Lin " + strzero( AtuRow( oEdit:nRow ), 3 ) )
oEdit:RefreshLine(, "n+/gr+*")
endif
If nKey = K_ESC
exit
EndIf
enddo
setcursor(nCursor)
RETURN
***************************
STATIC FUNCTION ATUPAG( l )
***************************
local nRet := 0, nA
for nA := 1 to len( aPag )
if l >= aPag[ nA, 2 ] .and. l <= aPag[ nA, 3 ]
nRet := aPag[ nA, 1 ]
exit
endif
next
if nRet > 0
_paginatual := nRet
endif
RETURN nRet
***************************
STATIC FUNCTION ATUROW( l )
***************************
local nRet := 0, nA, nLinI
for nA := 1 to len( aPag )
if l >= aPag[ nA, 2 ] .and. l <= aPag[ nA, 3 ]
nRet := aPag[ nA, 1 ]
nLinI := aPag[ nA, 2 ]
exit
endif
next
if nRet > 1
nRet := ( l - nLinI ) + 1
else
nRet := l
endif
RETURN nRet
*******************************
FUNCTION fAfterInkeyPRN( nkey )
*******************************
if nKey == 1002 .or. nKey == 1006
elseif nKey == 1024
return MenuAction( WVW_GETLASTMENUEVENT() )
elseif nKey == 1004
elseif nKey == 1003
endif
RETURN nKey
******************************
FUNCTION MenuAction( nAction )
******************************
memvar oEdit
if nAction == IDM_PRINT
PrintFile()
elseif nAction == IDM_PROCURAR
Alert("Procurar...") // Searching...
elseif nAction == IDM_IRPARA
Alert("Ir Para...") // Go to ...
elseif nAction == IDM_BACK
if _paginatual == 1
oEdit:GoToPos(1,1,.T.)
else
_paginatual--
nA := aScan( aPag, {|aE| aE[1] == _paginatual } )
oEdit:GoToPos( aPag[ nA, 2 ], 1, .T. )
endif
oEdit:RefreshLine(, "n+/gr+*")
wvw_sbSetText(, 1, " Pag " + strzero( AtuPag( oEdit:nRow ), 3 ) )
wvw_sbSetText(, 2, " Lin " + strzero( AtuRow( oEdit:nRow ), 3 ) )
elseif nAction == IDM_FORWARD
_paginatual++
if _paginatual > len( aPag )
_paginatual := aPag[ len( aPag ), 1 ]
else
nA := aScan( aPag, {|aE| aE[1] == _paginatual } )
endif
oEdit:GoToPos( aPag[ nA, 2 ], 1, .T. )
oEdit:RefreshLine(, "n+/gr+*")
wvw_sbSetText(, 1, " Pag " + strzero( AtuPag( oEdit:nRow ), 3 ) )
wvw_sbSetText(, 2, " Lin " + strzero( AtuRow( oEdit:nRow ), 3 ) )
elseif nAction == IDM_FIRST
oEdit:GoToPos(1,1,.T.)
oEdit:RefreshLine(, "n+/gr+*")
wvw_sbSetText(, 1, " Pag " + strzero( AtuPag( oEdit:nRow ), 3 ) )
wvw_sbSetText(, 2, " Lin " + strzero( AtuRow( oEdit:nRow ), 3 ) )
elseif nAction == IDM_END
__KeyBoard( chr( K_CTRL_PGDN ) )
oEdit:RefreshLine(, "n+/gr+*")
wvw_sbSetText(, 1, " Pag " + strzero( AtuPag( oEdit:nRow ), 3 ) )
wvw_sbSetText(, 2, " Lin " + strzero( AtuRow( oEdit:nRow ), 3 ) )
elseif nAction == IDM_SALVAR_TXT
SalvarTXT()
elseif nAction == IDM_SALVAR_PDF
SalvarPDF()
elseif nAction == IDM_SALVAR_DOC
SalvarDOC()
elseif nAction == IDM_SALVAR_XLS
SalvarXLS()
elseif nACTION == IDM_SAIR
__KeyBoard( chr(K_ESC) )
endif
RETURN 0
***********************************************************
FUNCTION WVW_SIZE( nWindow, hWnd, message, wParam, lParam )
***********************************************************
local cScreen, maxsavedscrrow, maxsavedscrcol, lNeedReset := .F.
if !wvw_Size_Ready()
return NIL
endif
if nWindow # 0
return NIL
endif
wvw_Size_ready(.F.)
do case
case wParam == 2 // Maximizar a janela
if ( maxcol() # wvw_maxmaxcol() .or. maxrow() # wvw_maxmaxrow() )
maxsavedscrrow := min( min( p_nNormalMaxrow, wvw_maxmaxrow() ), maxrow() )
maxsavedscrcol := min( min( p_nNormalMaxcol, wvw_maxmaxcol() ), maxcol() )
cScreen := savescreen( 0, 0, maxsavedscrrow, maxsavedscrcol )
if setmode( wvw_maxmaxrow()+1, wvw_maxmaxcol()+1 )
restscreen( 0, 0, maxsavedscrrow, maxsavedscrcol, cScreen )
endif
endif
case wParam == 0 // Restaurar o Tamanho da Janela
if ( maxcol() # p_nNormalMaxcol .or. maxrow() # p_nNormalMaxrow )
maxsavedscrrow := min( p_nNormalMaxrow, maxrow() )
maxsavedscrcol := min( p_nNormalMaxcol, maxcol() )
cScreen := savescreen( 0, 0, maxsavedscrrow, maxsavedscrcol )
if setmode( p_nNormalMaxrow+1, p_nNormalMaxcol+1 )
restscreen( 0, 0, maxsavedscrrow, maxsavedscrcol, cScreen )
endif
endif
otherwise
endcase
wvw_size_ready(.T.)
RETURN NIL
**********************
FUNCTION CONFIGCORES()
**********************
_aPalette := WVW_GetPalette()
_aPalette[01] := GetSysColor( 8 ) // N Black
_aPalette[02] := RGB( 0, 51, 153 )
_aPalette[04] := RGB( 0, 255, 255 )
_aPalette[08] := GetSysColor( 15 ) // W White
_aPalette[10] := RGB( 100, 135, 220 )
_aPalette[13] := RGB( 227, 92, 47 )
_aPalette[15] := RGB( 255, 255, 128 ) // AMARELO CLARO - bright yellow
WVW_SetPalette( _aPalette )
RETURN NIL
*****************************
FUNCTION WVW_PAINT( nWindow )
*****************************
if len( _aObjetos ) >= nWindow+1
aeval( _aObjetos[nWindow+1], {|e| eval( e, nWindow )} )
endif
RETURN 0
// ************************************************************************** //
// //
// IMPRESSAO DO ARQUIVO NA IMPRESSORA SELECIONADA //
// print file in selected printer //
// //
// ************************************************************************** //
***************************
STATIC FUNCTION PrintFile()
***************************
local cPrinter := ""
local cTexto, nLinhas, nA, cLinha
private oPrinter := win32prn()
cPrinter := SetupPrinter()
if empty( cPrinter )
return NIL
else
oPrinter:New( cPrinter )
oPrinter:Landscape := .F.
oPrinter:FormType := 1 // LETTER
oPrinter:Copies := 1
oPrinter:SetPrintQuality(-1) // DRAFT
if !oPrinter:Create()
Alert("Nao foi possivel imprimir na impressora selecionada")
return NIL
endif
if !oPrinter:StartDoc("Impressao ICBRASIL" )
Alert("Inicializacao do documento para impressao falhou ( Erro StartDoc() )")
return NIL
endif
oPrinter:SetDefaultFont()
if _len > 80
oPrinter:setfont(,,18,,,,255)
else
oPrinter:setfont(,,11,,,,255)
endif
oPrinter:NewLine()
DF_SAYPRINT( space( _len ), .T. )
cTexto := memoread( _file )
nLinhas := mlcount( cTexto, _len, 1, .F. )
for nA := 1 to nLinhas
cLinha := memoline( cTexto, _len, nA, 1, .F. )
if left( alltrim( cLinha ), 3 ) == DF_SALTO_PAGINA
oPrinter:NewPage()
else
DF_SAYPRINT( cLinha, .T. )
endif
next
oPrinter:EndDoc()
oPrinter:Destroy()
endif
RETURN NIL
// ************************************************************************** //
// //
// GERAR ARQUIVO TXT //
// Create TXT file //
// //
// ************************************************************************** //
***************************
STATIC FUNCTION SalvarTXT()
***************************
local cPath := getenv("USERPROFILE"),;
cNameFile := "" ,;
cTexto := ""
cTexto := memoread( _file )
cNameFile := GetSaveFileName( 0, "", "Salvar Relatorio como Arquivo TXT", { { "Texto ( *.txt )", "*.txt" } },, cPath, "txt" )
//
// PRECISA VOLTAR PARA O DIRETORIO DO SISTEMA
// need to go back to you path application
//
DirChange( "\sistemas\preview\" )
if !empty( cNameFile )
memowrit( cNameFile, cTexto )
if Alert("Abrir arquivo gerado ?", { "SIM", "NAO" } ) == 1
AbrePadrao( cNameFile )
endif
endif
RETURN NIL
// ************************************************************************** //
// //
// GERAR ARQUIVO PDF //
// //
// ************************************************************************** //
***************************
STATIC FUNCTION SalvarPDF()
***************************
local cPath := getenv("USERPROFILE") ,;
cNameFile := "" ,;
aMsg := {} ,;
cFile
cNameFile := GetSaveFileName( 0, "", "Salvar Relatorio como Arquivo PDF", { { "Arquivos Adobe PDF ( *.pdf )", "*.pdf" } },, cPath, "pdf" )
//
// VER OBSERVACAO EM salvartxt()
// check note in salvartxt()
//
DirChange( "\sistemas\preview" )
if !empty( cNameFile )
cFile := cNameFile
dbCreate( cPath + "TEMP.DBF", { { "LINHA", "C", 200, 0 } } )
use (cPath+"TEMP.DBF") alias temp new shared
append from (_file) sdf
/*
if PdfNew( cFile, DF_CALCFONT( _len ), 842, 595, 1, 1,,, {"Preview Relatorio", "", "", "ICB SOFTWARE", "ICB SOFTWARE" } ) == 0
Alert("Erro na criacao do arquivo .PDF")
temp->(dbCloseArea())
return NIL
endif
PdfStartPage( {""} , .T. )
temp->(dbGoTop())
while !temp->(eof())
if alltrim( temp->linha ) == DF_SALTO_PAGINA
PdfDrawPage( aMsg )
PdfEndPage()
PdfStartPage( {""} , .T. )
aMsg := {}
else
cLinha := temp->linha
aadd( aMsg, cLinha )
endif
temp->(dbskip())
enddo
PdfDrawPage( aMsg )
PdfEndPage()
PdfEnd()
temp->(dbCloseArea())
*/
if Alert("Abrir arquivo gerado ?", { "SIM", "NAO" } ) == 1
AbrePadrao( cNameFile )
endif
endif
RETURN NIL
// ************************************************************************** //
// //
// GERAR ARQUIVO RTF //
// //
// ************************************************************************** //
***************************
STATIC FUNCTION SalvarDOC()
***************************
local cPath := getenv("USERPROFILE"),;
cNameFile := "" ,;
nHandle
cNameFile := GetSaveFileName( 0, "", "Salvar Relatorio como Documento do Word", { { "Documento do Word ( *.doc )", "*.doc" } },, cPath, "doc" )
//
// VER OBSERVACAO EM salvartxt()
// check note in salvartxt()
//
DirChange( "\sistemas\preview" )
if !empty( cNameFile )
if CreateRTF( cNameFile, @nHandle )
WriteRTF( _file, nHandle )
CloseRTF( nHandle )
if Alert("Abrir arquivo gerado ?", { "SIM", "NAO" } ) == 1
AbrePadrao( cNameFile )
endif
endif
endif
RETURN NIL
**********************************************
STATIC FUNCTION CreateRTF( cNomeRtf, nHandle )
**********************************************
nHandle := fCreate( cNomeRtf ) // full path
if fError() # 0
Alert("Erro na criacao do arquivo " + strzero( fError(), 3 ))
return .F.
endif
fWrite( nHandle, INI_RTF )
RETURN .T.
*******************************************
STATIC FUNCTION WriteRTF( cTexto, nHandle )
*******************************************
local cCHar, cLine, xAtt, i, _xAtt, n, nChar, xChar, y
hb_fuse( cTexto )
while !hb_feof()
cLine := hb_freadln() + "\par"
fWrite( nHandle, cLine + CRLF )
hb_fskip()
enddo
hb_fuse()
RETURN NIL
***********************************
STATIC FUNCTION CloseRTF( nHandle )
***********************************
fWrite( nHandle, FIM_RTF )
fClose( nHandle )
RETURN NIL
// ************************************************************************** //
// //
// GERAR ARQUIVO XLS //
// //
// ************************************************************************** //
***************************
STATIC FUNCTION SalvarXLS()
***************************
local cPath := getenv("USERPROFILE") ,;
cNameFile := "" ,;
aMsg := {} ,;
cFile, nA, aStru
cNameFile := GetSaveFileName( 0, "", "Salvar Relatorio como Planilha Excel", { { "Planilhas Excel ( *.xls )", "*.xls" } },, cPath, "xls" )
//
// VER OBSERVACAO EM salvartxt()
// check note in salvartxt()
//
// DirChange( _path + _base )
if !empty( cNameFile )
cFile := cNameFile
aStru := {}
for nA := 1 to len( _acols )
aadd( aStru, { "COLUNA" + strzero( nA, 2 ), "C", _acols[ nA ], 0 } )
next
dbCreate( cNameFile, aStru )
use (cNameFile) alias temp new shared
append from (_file) sdf
temp->(dbCloseArea())
if Alert("Abrir arquivo gerado ?", { "SIM", "NAO" } ) == 1
AbrePadrao( cNameFile )
endif
endif
RETURN NIL
******************************************************************************************
FUNCTION GetSaveFileName( hWnd, cFile, cTitle, aFilter, nFlags, cIniDir, cDefExt, nIndex )
******************************************************************************************
local n, c :=''
if aFilter == NIL
aFilter := {}
endif
for n := 1 to len( aFilter )
c += aFilter[n,1] + chr(0) + aFilter[n,2] + chr(0)
next
cFile := _GetSaveFileName( hWnd, cFile, cTitle, c, nFlags, cIniDir, cDefExt, @nIndex )
RETURN cFile
********************************
FUNCTION AbrePadrao( cHelpFile )
********************************
local nRet, cPath, cFileName, cFileExt
HB_FNameSplit( cHelpFile, @cPath, @cFileName, @cFileExt )
nRet := _OpenHelpFile( cPath, cHelpFile )
RETURN nRet
#pragma BEGINDUMP
#define WINVER 0x0500
#define _WIN32_WINNT 0x0400
#include "windows.h"
#include "shlobj.h"
#include "hbapi.h"
#include "math.h"
#include "hbvm.h"
#include "hbstack.h"
#include "hbapiitm.h"
#include "hbapigt.h"
/*
HB_FUNC( WVW_SIZE_READY )
{
BOOL bIsReady;
static BOOL s_bIsReady = FALSE;
bIsReady = s_bIsReady;
if (ISLOG(1))
{
s_bIsReady = hb_parl(1);
}
hb_retl(bIsReady);
}
*/
HB_FUNC( _GETSAVEFILENAME )
{
OPENFILENAME ofn;
char szFileName[MAX_PATH+1] ;
strcpy( szFileName, hb_parc (2) );
ZeroMemory(&ofn, sizeof(ofn));
ofn.hInstance = GetModuleHandle(NULL) ;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = ISNIL (1) ? GetActiveWindow() : (HWND) hb_parnl(1);
ofn.lpstrTitle = hb_parc (3);
ofn.lpstrFilter = hb_parc (4);
ofn.Flags = (ISNIL (5) ? OFN_FILEMUSTEXIST|OFN_EXPLORER : hb_parnl(4) );
ofn.lpstrInitialDir = hb_parc (6);
ofn.lpstrDefExt = hb_parc (7);
ofn.nFilterIndex = hb_parni(8);
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
if (GetSaveFileName(&ofn))
{
hb_stornl(ofn.nFilterIndex , 8 );
hb_retc( ofn.lpstrFile );
}
else
{
hb_retc( "" );
}
}
HB_FUNC( GETCONSOLEWINDOWHANDLE )
{
HWND hwnd;
AllocConsole();
hwnd = FindWindowA("ConsoleWindowClass",NULL);
hb_retnl( (LONG) hwnd );
}
HB_FUNC ( SETUPPRINTER )
{
PRINTDLG pd;
LPDEVNAMES lpDevNames;
LPSTR lpPrinterName;
ZeroMemory(&pd, sizeof(pd));
pd.lStructSize = sizeof(pd);
pd.hwndOwner = GetActiveWindow();
pd.hDevMode = NULL;
pd.hDevNames = NULL;
pd.Flags = PD_PRINTSETUP | PD_USEDEVMODECOPIES | PD_RETURNDC; // PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC;
pd.nCopies = 1;
pd.nFromPage = 0xFFFF;
pd.nToPage = 0xFFFF;
pd.nMinPage = 1;
pd.nMaxPage = 0xFFFF;
if (PrintDlg(&pd)==TRUE)
{
lpDevNames = (LPDEVNAMES) GlobalLock( pd.hDevNames );
if( lpDevNames )
{
GlobalUnlock( pd.hDevNames );
lpPrinterName = ( LPSTR ) lpDevNames + lpDevNames->wDeviceOffset;
hb_retc((LPSTR)lpPrinterName);
DeleteDC(pd.hDC);
if (pd.hDevMode)
GlobalFree( pd.hDevMode );
if (pd.hDevNames)
GlobalFree( pd.hDevNames );
}
else
hb_retc( "" );
}
else
hb_retc( "" );
}
HB_FUNC( _OPENHELPFILE )
{
HINSTANCE hInst;
LPCTSTR lpPath = (LPTSTR) hb_parc( 1 );
LPCTSTR lpHelpFile = (LPTSTR) hb_parc( 2 );
hInst = ShellExecute( 0, "open", lpHelpFile, 0, lpPath, SW_SHOW );
hb_retnl( (LONG) hInst );
return;
}
#pragma ENDDUMP
Itamar M. Lins Jr.