System.MissingMethodException - Public Declare Sub GlobalMemoryStatus Lib "kernel32" (ByRef lpBuffe

  • Thread starter Thread starter A_PK
  • Start date Start date
A

A_PK

Public Declare Sub GlobalMemoryStatus Lib "kernel32" (ByRef lpBuffer As
MEMORYSTATUS)...

Is this valid for Vb.net for Compact Framework Platform....

I am having this error message System.MissingMethodException.......

the following are my coding
----------------------------------------------------------------------------------------------------------------------

Public Structure MEMORYSTATUS
Dim dwLength As Integer ' Size of MEMORYSTATUS
End Structure

Public Declare Sub GlobalMemoryStatus Lib "kernel32" (ByRef lpBuffer As
MEMORYSTATUS)



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim MS As MEMORYSTATUS

GlobalMemoryStatus(MS)
MsgBox("Total memory: " & CStr(MS.dwLength))

End Sub
 
Hi,
try
Declare Function GlobalMemoryStatus Lib "coredll.dll" (ByVal StrBuffer As
String) As Long

Pete
 
kernel32.dll is a desktop DLL. It doesn't exist in CE. Did you do a Google
search on this? I'm certasin there are several places in the archives and
on the web where this is defined.

-Chris
 
I think that you want "As Int", not "As Long", right? Long = 64-bit?

Paul T.
 
YES>...i got it...
but the value i got is based on Bit or what ?

how can I covert that number to MB or Kbyte

thank you
 
Read the Help. It explicitly says the numbers are bytes. Then it becomes
4th grade math. There are 1024 bytes in 1kb. There are 1024kb in 1 MB
(actually in 1 MiB if you want to be totally correct). Divide the number by
1024*1024 and you get MB.

-Chris
 
Back
Top