Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Total Physical Memory for Windows 7 and 8 computers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Total Physical Memory for Windows 7 and 8 computers

    As you may know, Win_Memory_Info() is supposed to be able to return the total amount of RAM a computer has. However, for that purpose it only works on Windows XP machines, not on Win7 or Win8. As the "Win" prefix in Alpha indicates, this function makes use of an MS Windows function and it is the MS function that does not work in Win 7 or 8.

    Below is an alternative function that works on XP, Win7 and Win8 (but only returns total memory). For those who may not know it is even possible, note that my function is a 2 in 1 function, i.e., the main function contains a 2nd function that is used by the main one (the 2nd one uses a Windows function). The main (top) function is really there only to convert bytes into gigabytes, something that could have been done in the 2nd function (I have my reasons to keep them separate but it is not a necessity). For the top function I have not used a "Win" prefix (Z_Win instead) because I think Alpha reserves Win_ for functions that use Windows functions and returns the raw windows information, which for memory is always in bytes.

    I realize that I may be the only one in the Alpha world that used to use Win_Memory_Info() to get total memory, but I'm sharing this anyway.

    Raymond Lyons

    Code:
    'Date Created: 28-Apr-2013 05:59:40 PM
    'Last Updated: 28-Apr-2013 10:44:33 PM
    'Created By  : Ray lyons
    'Updated By  : Ray Lyons
    FUNCTION Z_Win_Total_Ram AS N ()
    'Description:Get total Ram for this computer in Gigabyes
    	dim ptr as P
    	dim Ram_in_kb as n
    	ptr=Win_physical_memory()
    	Ram_in_kb=ptr.TotalPhysicalMemory
    	Z_Win_Total_Ram=Ram_in_kb/(1024*1024)/1024
    END FUNCTION
    
    '*****Function below used by one above***no need to separate them or use**********
    '*****local variables. It can just be part of the above function in the Control Panel*****
    FUNCTION Win_Physical_Memory AS P (computer = "." as c)
    'DESCRIPTION:Retrieve the computer's physical memory in bytes
    dim objWMIService as p
    dim colItems as p
    dim objItem as p
    if computer = ""
    computer = "."
    end if
    on error resume next
    objWMIService = ole.GetObject("winmgmts:" + chr(92) + chr(92) + computer + "\root\CIMV2")
    colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
        For Each objItem In colItems
            Win_Physical_Memory.TotalPhysicalMemory=objItem.TotalPhysicalMemory
       Next
    end function


    #2
    Re: Total Physical Memory for Windows 7 and 8 computers

    Hey Raymond,

    May I suggest this for the code archive?
    Dave Mason
    [email protected]
    Skype is dave.mason46

    Comment


      #3
      Re: Total Physical Memory for Windows 7 and 8 computers

      Hi Raymond,

      Originally posted by Raymond Lyons View Post
      As you may know, Win_Memory_Info() is supposed to be able to return the total amount of RAM a computer has. However, for that purpose it only works on Windows XP machines, not on Win7 or Win8. As the "Win" prefix in Alpha indicates, this function makes use of an MS Windows function and it is the MS function that does not work in Win 7 or 8.
      Good Information. I never noticed that failure of the Windows. Odd that they didn't maintain the call in some sort of compatible way.

      Originally posted by Raymond Lyons View Post
      I realize that I may be the only one in the Alpha world that used to use Win_Memory_Info() to get total memory, but I'm sharing this anyway.
      Well, maybe not the only one. My free CSDA DiagInfo utility has used that function and displayed those values for a fairly long time. I have updated my code to display these and other memory size values correctly for Windows Vista and up, and the update is now available at the link.

      Incidently, the other window WMI functions that I have changed to for Vista and up, still work in Win XP, however, I'm not sure about older ones than that. It's rare that there is backward compatibility but not forward compatibility.

      You also can currently use a5_os_info() in any windows version to get the size as well
      ?a5_os_info().TotalVisibleMemorySize
      which returns the size in KB (multiples of 1024)
      or
      ?a5_os_info().TotalVisibleMemorySize * 1024
      which returns the size in bytes
      Last edited by csda1; 04-30-2013, 03:15 PM.
      Regards,

      Ira J. Perlow
      Computer Systems Design


      CSDA A5 Products
      New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
      CSDA Barcode Functions

      CSDA Code Utility
      CSDA Screen Capture


      Comment


        #4
        Re: Total Physical Memory for Windows 7 and 8 computers

        Originally posted by csda1 View Post
        Hi Raymond,

        Good Information. I never noticed that failure of the Windows. Odd that they didn't maintain the call in some sort of compatible way.
        ....
        You also can currently use a5_os_info() in any windows version to get the size as well
        ?a5_os_info().TotalVisibleMemorySize
        which returns the size in KB (multiples of 1024)
        ....
        Hi Ira,

        Interesting that the current documentation (or for that matter the older V10 docs) for A5_os_info() does not include the .TotalVisibleMemory property. Of course like Win_Memory_Info(), the A5_os_info() function is just a wrapper for a function that uses a windows function that has more properties than Alpha was interested in when they did the documentation for their wrapper function. Same is true for the windows function I used, but I was only interested in total physical memory, plus the other properties are already available in other A5 functions (e.g. domain, computer name, etc.).

        As a point of interest, I almost went with a different windows function that would return all kinds of properties for the memory in each memory slot on the motherboard, e.g. serial #, manufacturer, etc.. But, I had no use for any of that detail, plus I would have had to add up the possibly various byte amounts in the slots to get the total--so I took the easier route with the function I used. I always try to take the easy route, and had I known about the .TotalVisibleMemory property for A5_os_info() I would have used that!

        Raymond Lyons

        Comment


          #5
          Re: Total Physical Memory for Windows 7 and 8 computers

          Hi Raymond,

          Originally posted by Raymond Lyons View Post
          For the top function I have not used a "Win" prefix (Z_Win instead) because I think Alpha reserves Win_ for functions that use Windows functions
          I forgot to comment on the above. Alpha may use the WIN_ prefix for some of their functions, but Alpha has almost no reserved words or prefixes that you couldn't potentially use for code or variable names, except you must be careful not to use full ones that Alpha already uses without having conflicts.

          Some exceptions that I know are definitely asking for big trouble are DIM, SHARED, GLOBAL, LOCAL, AND, OR, XOR, NOT, AS, BYREF, and BYVAL
          Regards,

          Ira J. Perlow
          Computer Systems Design


          CSDA A5 Products
          New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
          CSDA Barcode Functions

          CSDA Code Utility
          CSDA Screen Capture


          Comment


            #6
            Re: Total Physical Memory for Windows 7 and 8 computers

            FYI, I have put my function in the Code Archive.

            Regarding the Win_ prefix for functions, yes I know I could have used that for mine instead of Z_Win_. However, if it is true that Alpha uses Win_ for many of their wrapper functions that get information from the Windows OS, I think it is good policy to make the prefixes for one's User Defined Functions that use a windows function something different, both to avoid possible conflicts in the future and to remind me when writing code that it is my UDF, not one of Alpha's functions. Of course it is a good question as to why I should need reminding, so I'm not sure the name of the prefix is all that important.

            Raymond Lyons

            Comment

            Working...
            X