MSHTML.dll i dlukowanie HTML'a

0

wiem ze mozna wydrukowac plik wywolujac:

sprintf(chTemp, "rundll32.exe %%SystemRoot%%\\System32\\mshtml.dll,PrintHTML \"%s\"", Dane);
     system(chTemp);

ale otwiera mi sie okienko z wlasciwosciami drukarki...
Czy mozna to jakos opinac by od razu sie drukowalo oraz by nie drukowal naglowkow i stopki charakterystycznych dla wydrukow z IE ?
;( blagam o pomoc....

0

hehe przeszukalem caly internet chyba ale znalazlem

"START RUNDLL32.EXE MSHTML.DLL,PrintHTML %s %s", NazwaPliku, NazwaDrukarki"
i wyslac klawisz "Enter"

a to kod BAT ktory drukuje bez okienka drukarki
(poprawiony przezze mnie ;-) )

@ECHO OFF
SETLOCAL

:: Command line parsing |
ECHO.%* | FIND "?" >NUL
IF NOT ERRORLEVEL 1 GOTO Syntax
ECHO.%* | FIND "*" >NUL
IF NOT ERRORLEVEL 1 GOTO Syntax
IF NOT [%3]==[] GOTO Syntax
:: Check first parameter (file to be printed)
SET File2Print=%1
IF NOT DEFINED File2Print GOTO Syntax
SET File2Print=%File2Print:"=%
SET File2Print="%File2Print%"
IF NOT DEFINED File2Print GOTO Syntax
IF NOT EXIST "%File2Print:"=%" GOTO Syntax
:: Check second parameter (printer)
SET Printer=%2
IF NOT DEFINED Printer GOTO bartosak
SET Printer=%Printer:"=%
SET Printer="%Printer%"
REGEDIT /E %TEMP%.\%~n0.dat "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers"
TYPE %TEMP%.\%~n0.dat | FIND "[" | FIND /I %Printer% >NUL
IF ERRORLEVEL 1 (
	ECHO Invalid printer name, using default printer
	SET Printer=
)
DEL %TEMP%.\%~n0.dat

:bartosak

:: Create temporary Kix file to "press" Print button
> %TEMP%.\%~n0.kix ECHO.; Wait a few seconds for the Print dialog to appear
>>%TEMP%.\%~n0.kix ECHO SLEEP 2
>>%TEMP%.\%~n0.kix ECHO.; Press "Print" (Enter) using SendKeys function
:: Replace "Print" with the actual title of the
:: Print dialog for non-US Windows versions
>>%TEMP%.\%~n0.kix ECHO IF SETFOCUS( "Drukuj" ) = 0
>>%TEMP%.\%~n0.kix ECHO    $RC = SENDKEYS( "{ENTER}" )
>>%TEMP%.\%~n0.kix ECHO ENDIF

:Print
:: Actual print command
START RUNDLL32.EXE MSHTML.DLL,PrintHTML %File2Print% %Printer%

:: Call temporary Kix file to "press" Print button, then delete it
START /WAIT KIX32.EXE %TEMP%.\%~n0.kix
DEL %TEMP%.\%~n0.kix

:: Done
GOTO End

:Syntax
ECHO.
ECHO PrintHTM.bat,  Version 2.00 for Windows NT 4 / 2000
ECHO Prints a local HTML file from the command line
ECHO.
ECHO Usage:  %~n0  ^<html_file^>  [ ^<printer^> ]
ECHO.
ECHO Use quotes around the file and printer names if they contain spaces.
ECHO This version uses Kix's SendKeys^( ^) function to "press" the Print
ECHO button in the Print dialog. Make sure that you have Kix installed on
ECHO your system and that KIX32.EXE can be found in the PATH.
ECHO Modify this batch file if you are using a non-US Windows version
ECHO ^(read the comment lines for more information^).
ECHO.
ECHO Written by Rob van der Woude modified by Wojciech Bartosiak
ECHO http://www.robvanderwoude.com

:End
ENDLOCAL

A KIX'a mozesz pobrac stad:
http://www.kixtart.org/

1 użytkowników online, w tym zalogowanych: 0, gości: 1