Not a Member Yet,
Click here to Register
How do you like the new design?
It's cool, great job
[tally: 70%] 70%
It's okay
[tally: 20%] 20%
Its OK but I liked the old layout better
[tally: 0%] 0%
Please bring the old one back
[tally: 10%] 10%

votes: 10

ID: 369
Viewed: 3978
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

If MSHTML.DLL Is installed In the system directory, you can use the following code :

Highlight all by clicking in box
<!---Declaration--->
Public Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Public Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Public Declare Function GetSystemDirectory Lib "kernel32" Alias
"GetSystemDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long

Public Const PROCESS_QUERY_INFORMATION = &H400
Public Const STATUS_PENDING = &H103&

Highlight All
<!---Code--->
Public Sub PrintHtmlFile(cHtmlFile As String)
Dim hProcess As Long
Dim ProcessId As Long
Dim ExitCode As Long
Dim cWinSysDir As String
cWinSysDir = String(254, " ")
Call GetSystemDirectory(cWinSysDir, Len(cWinSysDir))
cWinSysDir = Trim(Left(cWinSysDir, InStr(cWinSysDir, Chr(0)) - 1))
If Dir(cWinSysDir & "MSHTML.DLL") <> "" Then
ProcessId = Shell("rundll32.exe " & cWinSysDir &
"MSHTML.DLL,PrintHTML " & Chr(34) & cHtmlFile & Chr(34), vbNormalFocus)
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId)
Do
Call GetExitCodeProcess(hProcess, ExitCode)
DoEvents
Loop While ExitCode = STATUS_PENDING
Call CloseHandle(hProcess)
End If
End Sub



'If MSHTML.DLL Is installed In the system directory, you can use the
'following code :


Public Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Public Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Public Declare Function GetSystemDirectory Lib "kernel32" Alias
"GetSystemDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long

Public Const PROCESS_QUERY_INFORMATION = &H400
Public Const STATUS_PENDING = &H103&

Public Sub PrintHtmlFile(cHtmlFile As String)
Dim hProcess As Long
Dim ProcessId As Long
Dim ExitCode As Long
Dim cWinSysDir As String
cWinSysDir = String(254, " ")
Call GetSystemDirectory(cWinSysDir, Len(cWinSysDir))
cWinSysDir = Trim(Left(cWinSysDir, InStr(cWinSysDir, Chr(0)) - 1))
If Dir(cWinSysDir & "MSHTML.DLL") <> "" Then
ProcessId = Shell("rundll32.exe " & cWinSysDir &
"MSHTML.DLL,PrintHTML " & Chr(34) & cHtmlFile & Chr(34), vbNormalFocus)
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId)
Do
Call GetExitCodeProcess(hProcess, ExitCode)
DoEvents
Loop While ExitCode = STATUS_PENDING
Call CloseHandle(hProcess)
End If
End Sub;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions