Post: How Check Your PC Architecture Version
11-15-2016, 08:55 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Sup NGU, I'm going to show you how to check the pc architecture version in 8 lines of code.

Whats needed:
Visual Studios


Getting started:

  • Make a new form project in visual basic and name it what ever.
  • Right click the form and view code.


Now paste this function.
    
Dim X64 As New IO.DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.System).Substring(0, 1) + ":\Program Files (x86)")
If X64.Exists Then Return True Else Return False


Form_Load Code:
    
If isbit() Then MessageBox.Show("PC INFO: 64-Bit", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) Else MessageBox.Show("PC INFO: 32-Bit", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
End



Build your project and your done.


Full Form1 class:
    
Public Class Form1


''''''''''''''''''''''''''''''''''''''''''''''
' '
' '
' Developed By: Josh(akaMeltDown) '
' Date: 11/15/2016 '
' Hackergrounds.tech Source code '
' '
' '
''''''''''''''''''''''''''''''''''''''''''''''


Public Function isbit() As Boolean
Dim X64 As New IO.DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.System).Substring(0, 1) + ":\Program Files (x86)")
If X64.Exists Then Return True Else Return False
End Function

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If isbit() Then MessageBox.Show("PC INFO: 64-Bit", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) Else MessageBox.Show("PC INFO: 32-Bit", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
End
End Sub
End Class


Cheers,
-Josh
11-16-2016, 04:59 PM #2
jagex
Gym leader
      If X64.Exists Then Return True Else Return False


If else is unnecessary, just do

If X64.Exists Then Return True

Return False

or just simply

Return X64.Exists
11-16-2016, 11:09 PM #3
Originally posted by jagex View Post
      If X64.Exists Then Return True Else Return False


If else is unnecessary, just do

If X64.Exists Then Return True

Return False

or just simply

Return X64.Exists


Explain what you mean and quote me.
11-18-2016, 04:21 AM #4
jagex
Gym leader
Originally posted by hacking247 View Post
Explain what you mean and quote me.


Your isBit() method does nothing aside from returning true/false.

So having an if/else statement to return true or false is redundant because X64.Exist property returns true/false...so you can just simply return the value of X64.Exists to the function

    
Public Function isbit() As Boolean
Dim X64 As New IO.DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.System).Substring(0, 1) + ":\Program Files (x86)")
Return X64.Exists
End Function


As for this:

     If X64.Exists Then Return True Else Return False


The else is unnecessary as the only other option is False.

You can just do

    

Dim X64 As New IO.DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.System).Substring(0, 1) + ":\Program Files (x86)")
If X64.Exists Then Return True
Return False

Last edited by jagex ; 11-18-2016 at 04:25 AM.
11-18-2016, 06:24 AM #5
Originally posted by jagex View Post
Your isBit() method does nothing aside from returning true/false.

So having an if/else statement to return true or false is redundant because X64.Exist property returns true/false...so you can just simply return the value of X64.Exists to the function

    
Public Function isbit() As Boolean
Dim X64 As New IO.DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.System).Substring(0, 1) + ":\Program Files (x86)")
Return X64.Exists
End Function


As for this:

     If X64.Exists Then Return True Else Return False


The else is unnecessary as the only other option is False.

You can just do

    

Dim X64 As New IO.DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.System).Substring(0, 1) + ":\Program Files (x86)")
If X64.Exists Then Return True
Return False




ok thats the exact same thing but if you want it here is a better way then what you wrote.

    
If X64.Exists Then Return True : Return False


Please make sure when you programing that you don't make the process to complex as good code should explain its self and over complex code make it a bad function.
11-18-2016, 02:55 PM #6
jagex
Gym leader
Originally posted by hacking247 View Post
ok thats the exact same thing but if you want it here is a better way then what you wrote.

    
If X64.Exists Then Return True : Return False


Please make sure when you programing that you don't make the process to complex as good code should explain its self and over complex code make it a bad function.


Well. step 1 would be to stop programming in VB lols

The following 2 users groaned at jagex for this awful post:

TheUnexpected
11-19-2016, 04:47 AM #7
Default Avatar
Oneup
Guest
Originally posted by jagex View Post
Well. step 1 would be to stop programming in VB lols


What difference does it make what he programs in?

The following user thanked Oneup for this useful post:

TheUnexpected
11-19-2016, 07:27 AM #8
Originally posted by jagex View Post
Well. step 1 would be to stop programming in VB lols


The guy could be just starting out. It's best to learn basic programming over something more complicated like C/C++, especially for beginners.
11-25-2016, 02:32 AM #9
jagex
Gym leader
Originally posted by Oneup View Post
What difference does it make what he programs in?


I can't say, im not qualifed to. I've researched it and almost every developer says VB is not a good language to start out with or program with anymore.
11-25-2016, 02:33 AM #10
jagex
Gym leader
Originally posted by Oneup View Post
What difference does it make what he programs in?


I can't say, im not qualified to. I've researched it and almost every developer says VB is not a good language to start out with or program with anymore.

If you are going to start learning now in the .Net framework, I think its best to just start with C# with VB. It'll also OP to branch out to another language like Java more easily.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo