get bit architecture in vb [duplicate] - vb.net

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to detect Windows 64 bit platform with .net?
I am totally new to VB. I have VS2008 express edition on my machine and I want to know the bit architecture of my (target user's) machine. I got OS name and major and minor versions but how do I get bit architeture?

I have already linked to a previously asked question on this but
The easiest solution is (if you can) is use Visual Studio 2010 onwards, then If you want to know what the bitedness is of the operating system you can simply use:
Environment.Is64BitOperatingSystem
If you want to know the bitedness of the processor then use kor_'s answer already given (although why you would need to know this I don't know)
Note:- you can also check the bitedness of the process you are running:
Environment.Is64BitProcess

Dim Is64Bit As Boolean
Is64Bit = Not String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))
See also: How to detect Windows 64-bit platform with .NET?

If you want to know whether the OS is 32-bit or 64-bit and you're using .NET Framework 4.0 or higher, use Environment.Is64BitOperatingSystem.
If you want to know whether the current process is 32-bit or 64-bit and you're using .NET Framework 4.0 or higher, use Environment.Is64BitProcess.
I've tested these two on Windows 7 and XP SP3, but not on any earlier OS version.
If you want to know the CPU bitness, you can use this WMI call:
Dim mo = New ManagementObject("Win32_Processor.DeviceID='CPU0'")
Dim i As UShort = CUShort(mo("Architecture"))
Select Case i
Case 0
Return "32 Bit"
Case 6 'Itanium
Return "64-bit"
Case 9
Return "64-bit"
Case Else 'Ooops!
Exit Select
End Select

Related

Printing DYMO barcode on 64Bit Office fails using VBA. But works on 32Bit Office

I have a Windows 10 PC running Office 64Bit. When I try to print a DYMO Barcode label, it fails. But works fine on 32Bit Office. I'm programming in MSAccess using VBA.
I reach out to DYMO and they said:
"We have different version of SDK, DLS SDK is out dated and DYMO is not supporting DLS SDK anymore."
I am only a VBA level programmer and not sure what steps to take next.
Maybe someone has run into this before?
The code fails on line 10 below. "429 ActiveX component can't create object"
Dim DymoAddIn As Object
Din DymoLabels As object
10 Set DymoAddIn = CreateObject("Dymo.DymoAddIn")
20 Set DymoLabels = CreateObject("Dymo.DymoLabels")
Well, I figured it out(with no help from DYMO). There is a newer version of the COM object which gets installed using this link.
http://labelwriter.com/software/dls/win/DLS8Setup.8.6.1.648.exe
BUT WARNING! The file is not on a secure server (HTTPS:\). I am not sure why and have asked DMO for a explanation. So, if anyone comes across this situation, just be aware of this.

How can I adapt a 32-bit VB6 application to work with 64-bit Office?

I have an application developed in VB 6.0 and VBA that uses latest Office 32 bit version. But since this application is 32 bit, it does not run on systems where 64 bit Office versions are installed. What is the best strategy I have to adopt to port this application to 64 bit. We have a mandate to use VB.NET and minimal (as much as possible) code modification from VB/VBA to .NET 64 bit. Please suggest the best option I can use so that I can leverage all best practices for this porting.
The answer of #Prof.Falken is fine, and porting to VB.NET may be a good idea for itself, but this does not guarantee that you get easily a 64 bit version of your application. If your .NET port will use 32 bit ActiveX components for which you have no 64 bit replacement, then this won't help. Here are some topics listed to be considered:
http://office.microsoft.com/en-us/word-help/choose-the-32-bit-or-64-bit-version-of-microsoft-office-HA010369476.aspx
In our workplace, systems administration decided not to install 64 bit Office on any of the new 64 bit Windows machines since here are too much applications in use (also from third party vendors) which would run into trouble else. And currently we don't see much benefits for us from the 64 bit Office version nowadays.
Here I found another link which might be interesting for you:
http://www.pcpro.co.uk/news/enterprise/356173/microsoft-warns-users-off-64-bit-office-2010
Depending on what the code looks like, one or both of these may be a good way:
a) Port it to VB.NET, or another language altogether.
b) Keep it in VB6, but replace EVERY place it talks to Office, with a wrapper call. This wrapper call talks to a VB.NET application, which in turn talks to Office.
The upshot of method b, is that it makes is possible to keep all the business logic in the old VB6 program untouched. Whether this is suitable or not depends on what the program looks like, what the programmers are experienced with, and so on. The old VB6 program and the new VB.NET could talk to each other through for instance COM or XML-RPC.

Does Mono support visual basic (not .NET)?

Someone asked me today if it was possible to port a visual basic application to Linux or similar platform, I assumed it was .NET so I suggested to use Mono, but noticed that on their vb support page they only talk about vb 8 (.NET)
Does mono support non-.NET vb? In fact I'm not sure what he is using, I think vb6, I'm not sure of the versioning at all though.
No, VB6 is an entirely different beast from VB.NET. Mono is basically there to run (via JITting, interpreting or AOT-compiling) IL - the Intermediate Language that VB.NET and C# compile down to. (Of course it also provides the libraries and compilers.)
Running VB6 requires an entirely different execution environment, basically.
No, but you could take a look at gambas
Gambas is a free development
environment based on a Basic
interpreter with object extensions, a
bit like Visual Basicâ„¢

New to VS.net (VB.net) 2008. Windows 7 aero glass stuff

Hey all, i have been using VB.net 2008 for a few months and i have a question. I compiled my program and ran it in a VM running windows 7. However, the progress bar looks like it does in XP. It doesn't have that cool look to it like I've seen in many other programs running in windows 7.
I have downloaded the 3.5 .net framework with sp1 and also the sdk for windows 7 (1.4+ gb dvd) but i still see nothing.
Is there a check-box i am missing in VS 2008 to enable these types of features? Maybe some type of code i need to place in the program?
Thanks!
David
I think you're looking for System.Windows.Forms.Application.EnableVisualStyles :)
The Windows API Code Pack can be used to get access to some Win 7 (and Vista) controls etc:
http://code.msdn.microsoft.com/WindowsAPICodePack
You can also use the SetWindowTheme API function to make the standard controls look more 7ish.
Here's a link to a project that uses SetWindowTheme to get Vista style controls, should be similar for Windows 7 (quite possibly the exact same code sometimes):
http://www.codeproject.com/KB/vista/themedvistacontrols.aspx

Irda + vb.net express

Not sure that this is a valid programming question ... but is it possible to program infa red using vb.net express (iRDA) Got a programming project in my mind, but none of the coding examples work, IrDAClient never gets recognised
Cheers
It's a valid question but it needs to be a bit more specific. VB.Net can certainly be used to program against IRDA. There is nothing preventing you from using IrDAClient with VB.Net.
We do need to know though what problems you are having? Can you post the samples that are giving you trouble or tell us what errors you are seeing?
EDIT Update to comments
There is nothing that will prevent you from writing a program targeting IRDA from VB Express. What you appear to be missing is a reference to the DLL that contains the IrDA libraries. You'll neeed to add a reference to System.Net.Irda.dll. It will be in the following directory (assuming your programming to Windows CE)
C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE
EDIT2
I may be wrong about the ability of VB express to program against a device project. I don't have any 2008 express builds on my machine to verify right now.
The IrDAClient class is part of the .Net Compact framework. I'm not sure if it's possible to use it on a desktop machine.
You can at least add the reference by searching for the file System.Net.IrDA.dll. On my system it was under: Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE
If it's not present you may be able to download it here: http://msdn.microsoft.com/en-us/netframework/aa497280.aspx