Advertisement

05.01.2008 at 03:19PM PDT, ID: 23370273
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.9

Printer control OCX for web application hangs in IE7 on non-vista OS.

Asked by infrasafe in Visual Basic Programming, VB Controls, Internet Explorer Web Browser

Tags: ,

I am currently modifying an existing printer control OCX for my company's web application.  The application is a visitor management system and the OCX is used to send information such as visitor name, badge number, etc. to a printer in a pre-determined format when a new visitor is checked in.

When the print button is clicked, all the required fields are passed to the OCX and a printer select dialog box is displayed.  It is at this point that Internet Explorer hangs for anywhere from 15 seconds to 4 or 5 minutes.  It is interesting to note, however, that this is not an issue on internet explorer 6 nor is it an issue in internet explorer 7 on Vista.  This only occurs on Internet Explorer 7 under Windows XP and 2003.  I'm running the latest version of IE7 on all boxes.

Also, I created a very stripped down test OCX which simply included a blank form and virtually no code and it still hung.  I have never developed in visual basic up until this point so I'm at a loss.  Posted below are some snippets of the applicable code.  

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
'''' do_iv_print() is the function called from the application 
Public Sub do_iv_print()
    Call iv_print_text
End Sub
 
 
'''' iv_print_text() is called from do_iv_print().  There is more 
'''' to this routine but it is mostly field setting stuff and 
'''' doesn't seem to have any relevance to the problem. 
Private Sub iv_print_text()
 
Dim MyCenteredTextWidth As Double
Dim separation As Integer
Dim topMargin As Double
Dim badge_leftmargin As Double
Dim marker As Integer
 
Dim I As Integer ' Declare variable.
 
Call StartDebug
 
If (select_printer = "1") Then
    select_printer = "2"
    SetSelectPrinterOption select_printer
'' This will call the PrinterCheck routine below and this appears to
'' be where the problem arises.
    PrinterCheck
End If
 
Call EndDebug
End Sub
 
 
Private Sub PrinterCheck()
    Dim disposition As Long
    Dim sKeyValue As String
    Dim prThis As Printer
    Dim tkeyvalue As String
    
 
On Error GoTo ErrTrap
 
 
 
    '***********************************
    If (select_printer = "2") Then
            Load frmPrintSelect
'' The line below (when the form is displayed) is exactly where it
'' hangs.  I am left with a form with a combo box and it doesn't
'' respond for 30 seconds to 5 minutes.  After this, it will start
'' responding, i can select a printer, and it works fine.
            frmPrintSelect.Show (1)
            sSubKey = "Software\Infrasafe Inc.\SGPrinter\DefaultPrinter"
            If RegOpenKeyEx(lMainKey, sSubKey, 0, KEY_READ, hnd) Then
                If RegCreateKeyEx(lMainKey, sSubKey, 0, 0, 0, 0, 0, hnd, disposition) Then
                    Err.Raise 1001, "VerifySettings() Sub", "Could Not Create Registry Key"
                End If
            End If
            sKeyValue = Space$(lLength)
            RegQueryValueEx hnd, sSettingsKey, 0, REG_SZ, ByVal sKeyValue, lLength
            tkeyvalue = Left$(sKeyValue, Len(Trim$(sKeyValue)) - Len(Trim$(sKeyValue)) / 2 - 1)
            SetDefaultPrinter (tkeyvalue)
            
            
    End If
EndSub
[+][-]05.06.2008 at 04:54AM PDT, ID: 21506439

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Basic Programming, VB Controls, Internet Explorer Web Browser
Tags: Visual Basic 6, Internet Explorer 7
Sign Up Now!
Solution Provided By: EDDYKT
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628