Solved

CHtmlView::OnPrint crashes under Windows 2000

Posted on 2001-06-15
7
339 Views
Last Modified: 2013-11-20
at this line >>>  lpTarget->Exec(NULL, OLECMDID_PRINT, 0, NULL, NULL);

yet if I create a appwizzard app under w98 using CHtmlView it works fine?
Also is a try and access a web page on the Internet it crashes as well but works fine for local files.

Any ideas how to fix this?

My system and OS are:
OS:           W2000 SP1
VC++:       6.0, SP5
0
Comment
Question by:jrc
  • 3
  • 3
7 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 6197768
Yes,
Don't use Exec(...)

Just let CHtmlView's default printing do it's thing.  It handles printing internally (by splitting off a thread with a new hiddne browser).

Aside from that, you can get crashing in some cases when Execing some commands when document is not fully download.  So mkae certain that the page is fully loaded.

Also, you don't show where you got the value for lpTarget, so there may be a problem there.

-- Dan
0
 

Author Comment

by:jrc
ID: 6198514
I am using the default print function from CHtmlView. I just built an MDI application using the appwizzard vith the view class derived from CHtmlView. Then changed navigate2 to point to a local HTML file in the view class created for me by the wizzard since it could not access a file on the net. Which is yet another problem.

The file appears to load fine but when I try and print it crashed in NTDLL. It seems odd that it calls it a user break point??? It never gets to posting the print dialog like it does
under win98.
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 100 total points
ID: 6199444
Check the Debug trace window.  Are there any messages there that could lend a clue?

-- Dan
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:jrc
ID: 6199862
It looks to me like the NT DLL is actually intentionally exiting the program for some reason. The only reason I can think of is that there is some sort of permission problem under Windows 2000. I have had problems running programs under Windows 2000 due to permissions. On more than one occasion I have had to first run the program as administrator before I could run as a user with full administration privileges. Without doing this first the program would crash. I have tried running this as administrator and it still crashes.

Debug line that it stops on:
-------------------------------------
77F9EEA9   int         3

Call stack during load of document:
-------------------------------------------------
Warning: constructing COleException, scode = DISP_E_MEMBERNOTFOUND ($80020003).
First-chance exception in HtmlApp.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
Warning: constructing COleException, scode = DISP_E_MEMBERNOTFOUND ($80020003).
First-chance exception in HtmlApp.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.

Call stack after trying to print:
----------------------------------------
The thread 0x5E8 has exited with code 0 (0x0).
Loaded 'C:\WINNT\system32\msrating.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\printui.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\WINSPOOL.DRV', no matching symbolic information found.
Loaded 'C:\WINNT\system32\activeds.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\adsldpc.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\mscms.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\cfgmgr32.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\SETUPAPI.DLL', no matching symbolic information found.
HEAP[HtmlApp.exe]: Heap block at 0017B170 modified at 0017B3D2 past requested size of 25a

Trace back window:
----------------------------
NTDLL! 77f9eea9()
NTDLL! 77fcd942()
NTDLL! 77fb54c9()
NTDLL! 77fb4316()
NTDLL! 77fab4ab()
SETUPAPI! 778834e2()
SETUPAPI! 77883019()
SETUPAPI! 77882ce7()
SETUPAPI! 77882b69()
NTDLL! 77f8bfcc()
NTDLL! 77f8c618()
NTDLL! 77f889c0()
KERNEL32! 77e8723d()
COMDLG32! 76b4ed57()
SHDOCVW! 76cca703()
SHDOCVW! 76cc9687()
SHDOCVW! 76cbf1dd()
SHDOCVW! 76c93e34()
MSHTML! 75be4565()
MSHTML! 75be857d()
MSHTML! 75c12187()
CHtmlView::OnFilePrint() line 104


0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6200992
Here's a snippete of VB code that checks to see if printing is enabled.  I found it at:
  http://msdn.microsoft.com/workshop/browser/webbrowser/WebBrowser.asp

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Private Sub BtnPrint_Click()
Dim eQuery As OLECMDF 'return value type for QueryStatusWB
On Error Resume Next
eQuery = WebBrowser1.QueryStatusWB(OLECMDID_PRINT)  'get print command status
If Err.Number = 0 Then
    If eQuery And OLECMDF_ENABLED Then
        WebBrowser1.ExecWB OLECMDID_PRINT,
          OLECMDEXECOPT_PROMPTUSER, "", ""    'Ok to Print?
    Else
      MsgBox "The Print command is currently disabled."
    End If
End If
If Err.Number <> 0 Then MsgBox "Print command Error: " & Err.Description
End Sub
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Without testing, I'd guess that you could use the QueryStatusWB() member of CHtmlView to learn whether printing was allowed and display a messagebox.  Even if this is not a satisfactory overall solution, I suggest that you try it to help identify the problem and see if it leads to that solution.

-- Dan
0
 

Author Comment

by:jrc
ID: 6208464
OK, after updating to Windows 2000 service back 2 and every other Windows update available for Windows 2000 it now works OK.
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9490004
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by : DanRollins

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now