Solved

Unable to connect to COM Component in Windows 7 Pro 64, running VB6 exe program

Posted on 2014-04-30
8
821 Views
Last Modified: 2014-05-02
I am trying to run a very useful utility I wrote myself in Visual Basic 6 many years ago
with a Windows 7 Pro 64-bit installation.

Under Windows XP first you start the PowerPCB  executable, then upon loading the main form the VB6 program 'MainBoard_Client.exe' connects to the PADS COM Type Library, which  accessible to other programs while PowerPCB is running.

PADS COM Type Library is included in the main executable file 'powerpcb.exe'. See visual basic reference to the library, with the VB6 IDE under Windows XP, from VB6 IDE:

COM reference from VB6 IDE
It is also visible in the Microsoft ComView utility as a registered component,   under Windows XP, and the program fully communicates with the COM server, of course:

OLEView running under Windows XP
Now, I only want to transfer and run this program under Windows 7 Pro 64-bit, and to be able to run a VB6 program at all, I had to copy 3 required ocx files to  c:\Windows\SysWOW64\ and executed the following to register components commands under Windows 7 Pro 64:

regsvr32 c:\Windows\SysWOW64\comdlg32.ocx
regsvr32 c:\windows\SysWOW64\MSCOMCT2.OCX
regsvr32 c:\windows\SysWOW64\mscomct2.ocx

Which worked fine, got the dialog that registration of components was successful.

I can also verify, using ComView that the COM Server for PowerPCB was successfully
installed in Windows 7:

Windows 7: PADS type library installed
BUT!  The 2 programs still will not connect with COM.

What else is missing here under Windows 7?

This is the simple form load procedure in the VB6 program that is supposed to connect to the COM server:

Private Sub Form_Load()

Dim view As Object

' extablish connection of client with PCB

On Error GoTo NoPCBStarted

 ' Connect to a running instance of PowerPCB server
    Set powerPCBApp = GetObject(, "PowerPCB.Application")
    Set powerPCBDoc = powerPCBApp.ActiveDocument

If CheckPCBVersion() = False Then
MsgBox "This software requires 'PADS Layout v. 5.3' or later. Some functions may not work with your currently loaded version of " & _
powerPCBApp.Version, vbInformation
End If

'zoom to full board view
Set view = powerPCBDoc.ActiveView
view.SetExtentsToBoard
Set view = Nothing

' clear all selections in PCB
powerPCBDoc.SelectObjects ppcbObjectTypeAll, "*", False

' bring up client as the active application in
' normal state on the desktop
AppActivate "MainBoard_Client"
Me.WindowState = vbNormal

Exit Sub

NoPCBStarted:

MsgBox "Unable to connect to PowerPCB", vbCritical

End

End Sub

Open in new window


And if this procedure starts, with PowerPCB.exe already running, I will just get me to
the exceptions part of the program immediately:

"Unable to connect to PowerPCB"

What is happening here? Is there another missing component under Windows 7?
0
Comment
Question by:AttilaB
  • 5
  • 3
8 Comments
 
LVL 15

Expert Comment

by:eemit
ID: 40032611
- You may need explicitly call the 32-bit version of regsrv32 located in %systemroot%\SysWoW64\regsvr32.exe
- Open up the command prompt with "run as administrator"
0
 

Author Comment

by:AttilaB
ID: 40032730
Are you saying that comdlg32.ocx, MSCOMCT2.OCX, and mscomct2.ocx were not properly registered, even though I was using command prompt with "run as administrator"?

( I searched for 'cm.exe' and started it with Ctrl + Shift + Enter and got all 3 components
to register as seen below:)
Proper Registration of OCX
Also, please note that the VB6 program is running properly under Windows 7, other than not connecting to the COM server in 'powerpcb.exe': It gives me the proper dialog
box I am expecting if unable to connect to COM server. Without these 3 OCXs it would not run at all.

Perhaps something else is missing?
0
 

Author Comment

by:AttilaB
ID: 40032761
OK I will try to re-register these 3 OCXs, using the 32-bit version of regsrv32,
as you are saying shortly, and I will let you know.
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

Author Comment

by:AttilaB
ID: 40033738
Using the 32-bit version of regsrv32, getting identical results:

Re-registering all three OCXs
I am not pasting the other 2 here, they were giving identical results.

Same result: (Program starts, does not connect to COM server, brings up the dialog box for no connection:

Unable to Connect
0
 
LVL 15

Expert Comment

by:eemit
ID: 40034237
Can you post Err.Number and Err.Description?
0
 

Author Comment

by:AttilaB
ID: 40034615
Thank you. Excellent idea, it is a different error: I made the following change to the code, compiled into EXE and transferred over to the Windows 7 64 OS.

NoPCBStarted:

MsgBox "Unable to connect - Error No: " & Err.Number & "  Desc.: " & Err.Description, vbCritical

End

Open in new window


It turns out, that if the COM server is NOT running regardless of OS (XP or Win7 64) it will give you the same message, as follows here:
Server Running: Both XP and Win 7 64-bit
BUT! On Win7 64, if the server is running, and cannot connect, I get this message:
Error 13, type mismatch.  This is my problem:

Server Running Win 7: Type Mismatch
0
 
LVL 15

Accepted Solution

by:
eemit earned 500 total points
ID: 40034966
Can you find which line of code caused the error?
Have you tried to start powerpcb.exe with "run as administrator"?
0
 

Author Closing Comment

by:AttilaB
ID: 40038204
Yes, I did find which line was causing the error:

 ' Connect to a running instance of PowerPCB server
    Set powerPCBApp = GetObject(, "PowerPCB.Application")

The server was passing down wrong data type to the VB6 client, NOT
the PowerPCB.Application object.

BUT! After I ran powerpcb.exe with as administrator, as you suggested, even though it DID NOT CONNECT TO CLIENT WITH SERVER RUNNING AS ADMINISTRATOR, afterwards, after I RE-STARTED SERVER it just connected fine to the COM client. Every time. And even
after multiple re-starts of the computer.

What is this? Some kind of security issue with Windows 7 Pro 64-bit, perhaps?

I will try the same thing on another Win 7 Pro 64-bit machine.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Power supply fan not spinning 12 66
Non admin needs to install programs 17 66
driver missing Dell Latitude E5540 15 45
Sony EVI-D70 and Skype 2 33
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
In the modern office, employees tend to move around the workplace a lot more freely. Conferences, collaborative groups, flexible seating and working from home require a new level of mobility. Technology has not only changed the behavior and the expe…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

839 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