DOCUMENT:Q180624 10-FEB-1998 [vbwin] TITLE :PRB: Invalid Page Fault Occurs with More Than 34 DDE Channels PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:4.0,5.0 OPER/SYS:Win95 WINDOWS KEYWORDS:vb432 VB4WIN vb5all ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 5.0 on the following platform: Win95 - Microsoft Visual Basic Standard, Professional, and Enterprise Editions, 32-bit only, for Windows, version 4.0 on the following platform: Win95 --------------------------------------------------------------------- SYMPTOMS ======== The following error message is displayed if you attempt to open more than 34 DDE (Dynamic Data Exchange) channels: VB5 caused an invalid page fault in module KRNL386.EXE at 0002:000033C6 This error message is displayed only in the 32-bit versions of Visual Basic running under Windows 95. RESOLUTION ========== Use OLE automation instead of DDE. OLE automation is the current and future support technology at Microsoft. For more information about OLE automation see the following: - "Programming with Components" in the Visual Basic Programmer's Guide - OLE Automation: Communicating with Other Applications at http://www.microsoft.com/AccessDev/Articles/comothap.htm To be safe, you should also reuse connections rather than open additional ones to keep the total number of open connections below 30. STATUS ====== Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ The number of DDE channels required to reproduce this problem varies by machine and configuration and is not predictable. This behavior occurs in as few as 34 channels to as many as 72 channels. The next section shows how to create a sample project that demonstrates this behavior. In order to observe the behavior, you need to create an Excel spreadsheet to act as a server. Create the Excel Spreadsheet ---------------------------- 1. Start Excel. Book1 is created by default. 2. Enter a number in the cell R1C1. 3. Save the spreadsheet using the default filename Book1.xls, and then Minimize Excel. After you create and save the Excel spreadsheet, create the Visual Basic project to reproduce the behavior. Steps to Reproduce Behavior --------------------------- 1. Start a new Standard EXE project in Visual Basic. Form1 is created by default. 2. Add the CommandButton, Label, and Text Box to Form1. Set the Index property of the Label control to 0. 3. Copy the following code to the Code window of Form1: Option Explicit Const MAX_CONNECTIONS = 98 Private Sub Form_Load() 'Creates a grid composed of labels. Dim i As Integer Dim n As Integer Dim j As Integer Dim temptop As Integer Dim templeft As Long templeft = 120 temptop = 120 ' Set initial properties of label used as template for dynamically ' created labels. Label1(0).BorderStyle = 1 Label1(0).Caption = "" Label1(0).Visible = False Label1(0).Move 120, 120, 1200, 300 ' Size form to handle array of MAX_CONNECTIONS labels and other ' controls. Me.Height = (Label1(0).Height * 14) + (60 * 15) + 980 Me.Width = (Label1(0).Width * 7) + (60 * 8) + 200 Me.Caption = "DDE Connection Limit Test" 'Set initial properties of Command1. Command1.Caption = "Number of DDE connections" Command1.Move 1420, Me.Height - 920, 4800, 400 Command1.Default = True 'Set initial properties of Text1. Text1.Text = "" Text1.Move 120, Command1.Top, 1200, Command1.Height 'Two nested For loops create grid of labels. For i = 1 To 14 'Outer loop moves down the form, For j = 1 To 7 'inner loop moves across the form. n = n + 1 'supplies you with array index. Load Label1(n) Label1(n).Visible = True Label1(n).Top = temptop Label1(n).Left = templeft templeft = templeft + Label1(0).Width + 60 Next j templeft = 120 temptop = temptop + Label1(0).Height + 60 Next i Me.Show Text1.SetFocus End Sub Private Sub Command1_Click() Dim iValue As Integer Dim i As Integer 'Get the value entered by the user. iValue = Val(Text1) 'Test for invalid value. If iValue < 1 Or iValue > MAX_CONNECTIONS Then MsgBox "Enter a number between 1 and " & MAX_CONNECTIONS Exit Sub End If 'Remove any existing connections and reset all captions. For i = 1 To MAX_CONNECTIONS Label1(i).LinkMode = vbLinkNone Label1(i).Caption = "" Next i 'Start DDE conversations for the chosen number of labels. For i = 1 To iValue Label1(i).LinkTopic = "EXCEL|Book1.xls" Label1(i).LinkItem = "R1C1" Label1(i).LinkMode = vbLinkAutomatic Next i End Sub 6. On the Run menu, click Start, or press the F5 key to start the program. In the Text Box, enter a number between 34 and 98 and click the CommandButton. The result is that an Invalid Page Fault occurs. Additional query words: IPF GPF Crash Dynamic Data Exchange DDE Link ====================================================================== Keywords : vb432 VB4WIN vb5all Version : WINDOWS:4.0,5.0 Platform : Win95 WINDOWS Issue type : kbprb Solution Type : kbnofix ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1998.