Can a VB6 component be compiled to 64 bit? - com

Is there a way to compile a VB6 component into 64 bits?
My feeling is that the answer is "no", but I would like to confirm this.
Please, if you can, paste a link to an authorative source that would confirm.

No. I hope this counts as authoritative.
64-Bit Windows
Visual Basic 6.0
runtime files are 32-bit. These files
ship in 64-bit Windows Operating
Systems referenced in the table below.
32-bit VB6 applications and components
are supported in the WOW emulation
environment only. 32-bit components
must also be hosted in 32-bit
application processes.
The Visual Basic 6.0 IDE has never
been offered in a native 64-bit
version, nor has the 32-bit IDE been
supported on 64-bit Windows. VB6
development on 64-bit Windows is not
and will not be supported.

No it cannot (well Microsoft has not released a compiler to compile it for a 64-bit environment), but this does not mean that it won't run on a 64-bit system. To run it in conjunction with IIS, you'll need to install the 32-bit version of IIS.

Related

Connection Problem with QBFC15 64-bit version

Here is what I have:
Problem: Trying to connect two different 64-bit applications:
Microsoft Access 64-bit
QuickBooks Entrprise 21.0 (I'm not sure if it is actually 32-bit or 64-bit)
Using:
Visual Studio 2022 64-bit edition
VB.NET
64-bit version of QBFC15 library for QuickBooks
My thought is that when you use a 64-bit API, it would connect to a 64-bit application. I am most likely incorrect.
When I connect to MS Access in the debug 64-bit mode, it connects fine. The Intuit developer Network says you need to publish applications in the 32-bit mode. I have always used the 32-bit mode for publishing QuickBooks applications because they were 32-bit programs and, well, frankly, 64-bit applications hadn't come out yet (no old person jokes here). Anyway, I was really excited to see that the 64-bit version of a QBFC library came out (QBFC15) and they offer both 32-bit and 64-bit. So I downloaded the 64-bit version (which they recommend on their site https:\\developer.intuit.com>
So I'm thinking, hey, it's a 64-bit SDK! Yeah! So now I have this project that tells me I need to connect a 64-bit Access application to QuickBooks. When I debug, my new application connects just fine to MS Access in the 64-bit mode! Yeah! But the 64-bit Intuit SDK needs to be published in the 32-bit mode!!!! I'm confused. I know that they have put the cart before the horse and I know that they must still be running QuickBooks Enterprise in the 32-bit mode but come on. Putting out the SDK before the commercial product comes out to use it one? (I'm done whining now...got to get it out somehow!).
So how am I to connect my application to both "64-bit" programs when one errors in the 32-bit mode and the other errors in the 64-bit mode?
The programming isn't the issue, but this scenario seems really problematic. Do I tell the customer they need to downgrade their Microsoft Office to the 32-bit mode version? That would be an easy answer I guess, but it sure makes me look bad. Any other suggestions out there that could help me in this would be much appreciated.
If you running desktop edition of QuickBooks, then if you are running a x32 bit version of QuickBooks?
Then that means automation and working with the desktop edition means your software ALL MUST remain x32.
Only in 2022, have they rather recent upgraded and offer a x64 bit verison.
So, you have to check which desktop version of QuickBooks you are running. (most up to rather recent have been x32 bits - for a VERY long time).
So, what determines what QBFC library, what version of Access, and quite much vb.net?
You must continue to force your vb.net projects to run as x86, and NOT use "any" CPU and not use x64.
So, what will determine what all of your code is to run as?
It will be the desktop edition of QB that determines this.
It is of ZERO use to adopt office x64, access x64, or run your vb.net software, and the QBFC sdk and library as x64 bits if QuickBooks remains as x32.
(you using the wrong bit size and architecture here).
so, you have to be 100%, and in fact 200% sure
now, if QBFC is hitting the server database for QuickBooks, then that can be x64 bits but if you using the QB sdk and QBFC? Then that all must remain x32 bits until such time you upgrade the desktop edition of QuickBooks.
So, you have to REALLY but REALLY find out if in fact if you are running x32 QuickBooks for desktop, or x64 for desktop.
The version of QuickBooks and what version you you THEN much choose of QBFC library, vb.net, Access/office then again will have to match the bit size of QuickBooks desktop.
So from everything else from down to Access to vb.net to QBFC then all again much match the version of QuickBooks for desktop you have installed.
Now, if vb.net, Access you use is NOT to interface via the QBFC .dll and SDK? Then you don't care. But, inter process communication based on so called "windows COM objects"? And say upgrading from office x32, and the associated software systems you have? You can't just out of the blue decide to jump to office x64 without say your company and IT department not knowing the difference between x32 bit software, and that of x64 bit software.
Hint: 8 bit Apple II computer has a different architecture then a 16 bit IBM PC. And going from 16 bits to x32 bits? Again, a huge and large jump.
And from x32 bit software to x64 bit software? again a huge jump.
So, while windows can happy run x32 bit software, and it been a x64 bit OS by default for 10+ years?
Well, software packages running as x32 bits, and them interfacing to x64 bit software is a whole different matter. Such software has to remain the same bit size - and you can't have different bit size process on windows such as x32 bit COM objects (ole, COM, ActiveX = same technology stack).
So keep this basic knowledge and hallmark and pillar in our industry - different bit size software systems can't talk to each other via inter-op, or so called COM object automation.

VB program does not run on older XP machine

First off, I do most my programming as tools for myself and know just enough to get by. I wrote a VB program which uses a vender's API DLL to communicate with a serial port device. I used VS Express. Works great on my Win 7 32-bit machine.
I handed my program off to a co-worker (didn't expect to share my tools) who has a XP 32-bit machine. I get a windows error that it "is not a valid win32 application" I made sure to include the vender's DLL with my executable.
I really don't want to have to install VS Express on his computer as that is how I have solved the issue in the past. I could use some pointers on cross-platform compatibility. Not looking to make my software universal, just to get it running on a XP machine.
Thank you,
Xp only supports up to .NET framework 2.0 if you want to use it on all versions of xp.
So you need to check with version he has or you want to support.
So if you want it to run on Xp "All versions" you need to make it .NET framework 2.0
Is .NET 4.0 Compatible with Windows XP SP2 or below?

Is it possible to load a 64-bit dll into a 32-bit process?

Is it possible to load a 64-bit dll into a 32-bit process ?
Generally speaking, I know it can not happen.
Yet, maybe there are some exceptions ?
No, and neither a 64-bit process can load a 32-bit DLL.
If you're on a 64 bit OS, you can load the DLL in a 64-bit process and have it communicate with your 32-bit process through IPC.
If you're on a 32 bit OS, you're out of luck.
In .NET, it is possible to load a 64-bit DLL into a 32-bit process for reflection only. For details please check "Analyze 64-bit DLL from within T4 template in Visual Studio (32-bit) using Reflection".
I know that this is a special case, but I thought I'd add it anyway because it might help others looking for a similar solution as me.
Yes, you can load 64 code in 32 bit module. example:
vmprotect
metatrader4
above software mixed x86 and x64 in one process.
I found metatrade4 for win7 has a function it exeucte a instruction like :
jmp 0x33:0x175328
segment selector 33 is a 64bit segment. after execution this instruction, cpu will switch to 64bit mode from 32bit mode.
if you use windbg to trace some windows api on windows x64 OS, you will find similar code.
for example:
NtQueryInformationProcess
But new computer bought today at least have 4G ram. We cannot prevent using 64-bit OS to avoid problem. We must face 64-bit positively! Server 2008 R2 only have 64-bit.
Issues around EXE AnyCPU / x86, 32-bit COM / C++ dll must be handled.
Ideally compile both 32 and 64 bit COM / C++ dll.

How do I install both 32-bit and 64-bit versions of a COM DLL and "auto-select"?

We've got a DLL (a COM server) that will compile fine in 32-bit and 64-bit, but the DLL uses the same CLSID and AppID for the 32-bit version and the 64-bit version. Is this OK or does this have to change?
I'm asking this because apparently on a 64-bit machine, we can't register the 32-bit version and the 64-bit version together. It would be nice if 32-bit client applications could automatically use the 32-bit DLL, and 64-bit client applications could automatically use the 64-bit DLL.
On a related note, we have the source code and Visual Studio 2005 project file for a client application ... how do we compile a 32-bit and 64-bit version of the same application? It's a C# application, and it includes a reference to our COM server DLL like this:
<ItemGroup> <COMReference Include="ComServer">
<Guid>{C1FADEA6-68FD-4F43-9FC2-0BC451FA5D53}</Guid>
<VersionMajor>830</VersionMajor> <VersionMinor>0</VersionMinor>
<Lcid>0</Lcid> <WrapperTool>tlbimp</WrapperTool> <Isolated>False</Isolated>
</COMReference> </ItemGroup>
If it turns out that we need a separate CLSID for 64-bit, how do we make this reference "only for the 32-bit configuration" in Visual Studio? Or do we have to have separate projects with the same source code: one that refers to 32-bit DLL, and the other that refers to 64-bit DLL?
Both versions can (and indeed should) use the same GUIDs for everything.
On a 32-bit machine you can't register or use the 64-bit DLL, so there's no problem there. The 64-bit DLL simply doesn't enter the picture.
On a 64-bit machine the 64-bit DLL gets registered in HKLM/Software/Classes/CLSID (etc.) and the 32-bit DLL gets registered in HKLM/Software/Wow6432Node/Classes/CLSID. (I wonder where you got the advice that you can't register the 32-bit DLL on a 64-bit machine...) A 32-bit client running on the 64-bit machine will look in the normal place in the registry, but the OS will silently redirect it to the Wow6432Node key instead.
This is dealt with inside Windows with a feature called 'Registry redirection' On the 64-bit version of Windows, a 32-bit program gets a different view of the registry. Any access to the HKCR alias or the HKLM\Software root is redirected for the kind of keys that a COM server uses. A 32-bit program actually sees the key values stored in HKLM\Software\Wow6432Node. You can see it with Regedit.exe
This is normally taken care of by an installer, a VS Setup project has the TargetPlatform property for example. If you want to make the COM server available in both 32-bit and 64-bit mode then you should use two installers. Or a 64-bit installer that writes both sets of keys. Having a COM server that can handle both is very unusual in the olden days. But not unheard of when you implemented in .NET for example.

Does a 64-bit CruiseControl.NET exist?

Does a 64-bit CruiseControl.NET exist or do I need to install the 32-bit version? Our CI server is Server2003 64-bit. Currently I have been testing on WinXP Pro and no problems.
If I do need to run cc.net 32-bit on a 64-bit OS, what issues should I expect to encounter? This post mentions a couple, Running 32-bit ASP.NEt 3.5 apps in Windows 2003 64-bit . I would also need to have the .NET 2.0 and 3.5 framework installed. Do I install the 32-bit versions if running cc.net 32-bit? Can 32-bit and 64-bit coexist on the same server?
A quick peek at the source code reveals that CruiseControl.NET is compiled with "Any CPU" platform, so it will (and does) run on either a 32 or 64 bit runtime.
My notebook runs 64 bit O/S and has no problems with CruiseControl.NET server or web dashboard (IIS 7). Just install it as per normal and you should be fine.
Personally I'd be really worried if it needed > 3GB of memory :)
It shouldn't be anything you need to worry about. Cruise control just launches the build, subsequent steps such as compilation can be 64-bit.
I don't think there's much benefit from making CruiseControl 64-bit at the moment. I'm running CruiseControl without issues on a 64-bit machine. The setup was not much different, other than the folder which it was installed into (Program files (x86)).
Generally speaking, all 32bit applications will work on a 64bit OS. I have been doing this with my webapps for some time. You will encounter issues only if you are trying to reference assemblies across the bit boundary, ie. 64bit assembly from 32bit application.
You should be already to run CC on 32bit mode on 64bit OS.
There are no seperate version of CruiseControl for 64-bit. But but you may run into an ASP.NET error if working with Win. Server 2008 and IIS7.
Workaround:
"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe" -i
and
"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe" -i "W3SVC/1/ROOT/ccnet"
NOTE: it is using Framework64 as this would not work for 32-bit.