Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2014-04-30
8
Medium Priority
?
845 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 1500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

As cyber crime continues to grow in both numbers and sophistication, a troubling trend of optimization has emerged over the last year.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
Suggested Courses

618 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