1. RE: GetVersionEx

This is a multi-part message in MIME format.

------=_NextPart_000_0008_01C0DE23.C0C2FE00
	charset="Windows-1252"

Hi,
the definition of the structure is wrong. Try this instead...

global constant
  dwOSVersionInfoSize = allot( DWord ),
  dwMajorVersion      = allot( DWord ),
  dwMinorVersion      = allot( DWord ),
  dwBuildNumber       = allot( DWord ),
  dwPlatformId        = allot( DWord ),
  szCSDVersion        = allot( 128 ),
  SIZEOF_OSVERSION    = allotted_size()

The last field is supposed to be a 128 character array. You had defined it
as a long pointer to a zero-terminated string (Lpsz). This would cause the
SIZEOF_OSVERSION to be wrong, and the function won't work if that's wrong.
-----------
cheers,
Derek Parnell


 -----Original Message-----
From: jjnick at cvn.com [mailto:jjnick at cvn.com]
Sent: Wednesday, 16 May 2001 4:04 PM
To: EUforum
Subject: GetVersionEx




  Man, I am having a terrible time getting GetVersionEx to work, what am I
doing wrong . . .  The value of "Boolean" is "0", False . . .

  . . .
  global constant
    dwOSVersionInfoSize = allot( DWord ),
    dwMajorVersion      = allot( DWord ),
    dwMinorVersion      = allot( DWord ),
    dwBuildNumber       = allot( DWord ),
    dwPlatformId        = allot( DWord ),
    szCSDVersion        = allot( Lpsz ),
    SIZEOF_OSVERSION    = allotted_size()
  . . .
   ptOS = allocate_struct( SIZEOF_OSVERSION )
   store( ptOS, dwOSVersionInfoSize, SIZEOF_OSVERSION )

   OSVersion = define_c_func(kernel32, "GetVersionExA", {C_POINTER}, C_INT)
   val = c_func(OSVersion, { ptOS } )
   result = message_box(sprintf( "Boolean: %d", val ), "OSVersion",
MB_ICONINFORMATION+MB_TASKMODAL )




------=_NextPart_000_0008_01C0DE23.C0C2FE00
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DWindows-1252">


<META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><SPAN class=3D202521306-16052001><FONT face=3DArial color=3D#0000ff =

size=3D2>Hi,</FONT></SPAN></DIV>
<DIV><SPAN class=3D202521306-16052001><FONT face=3DArial color=3D#0000ff =
size=3D2>the=20
definition of the structure is wrong. Try this =
instead...</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><FONT face=3D"Courier =
New"=20
color=3D#000000></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff><FONT size=3D2><FONT =
face=3D"Courier New"=20
color=3D#000000>global constant<BR>&nbsp; dwOSVersionInfoSize =3D allot( =
DWord ),=20
<BR>&nbsp; dwMajorVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D allot( DWord =
),=20
<BR>&nbsp; dwMinorVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D allot( DWord =
),=20
<BR>&nbsp; dwBuildNumber&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D allot( =
DWord ),=20
<BR>&nbsp;&nbsp;dwPlatformId&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=3D allot(=20
DWord ),<BR>&nbsp; =
szCSDVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D=20
allot(&nbsp;<SPAN class=3D202521306-16052001>128</SPAN> ),<BR>&nbsp;=20
SIZEOF_OSVERSION&nbsp;&nbsp;&nbsp; =3D allotted_size()=20
</FONT><BR></FONT></FONT></DIV>
<DIV><SPAN class=3D202521306-16052001><FONT face=3DArial color=3D#0000ff =
size=3D2>The=20
last field is supposed to be a 128 character array. You had defined it =
as a long=20
pointer to a zero-terminated string (Lpsz). This would cause the=20
SIZEOF_OSVERSION to be wrong, and the function won't work if that's=20
wrong.</FONT></SPAN></DIV>
<P><FONT face=3DArial size=3D2>-----------</FONT> <BR><FONT face=3DArial =

size=3D2>cheers,</FONT> <BR><FONT face=3DArial size=3D2>Derek=20
Parnell</FONT>&nbsp;<BR><FONT face=3DTahoma><FONT size=3D2><SPAN=20
class=3D202521306-16052001><FONT face=3DArial=20
color=3D#0000ff>&nbsp;</FONT></SPAN></FONT></FONT></P>
<P><FONT face=3DTahoma><FONT size=3D2><SPAN=20
class=3D202521306-16052001>&nbsp;</SPAN>-----Original =
Message-----<BR><B>From:</B>=20
jjnick at cvn.com [mailto:jjnick at cvn.com]<BR><B>Sent:</B> Wednesday, 16 May =
2001=20
4:04 PM<BR><B>To:</B> EUforum<BR><B>Subject:</B>=20
GetVersionEx<BR><BR></P></FONT></FONT>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px"><PRE>            &gt;&gt;&gt;&gt;&gt; The =
Euphoria Mailing List &lt;&lt;&lt;&lt;&lt;
<A =
  <DIV><FONT face=3D"Courier New" size=3D2>. . .</FONT></DIV>
  <DIV><FONT face=3D"Courier New" size=3D2>global constant<BR>&nbsp;=20
  dwOSVersionInfoSize =3D allot( DWord ), <BR>&nbsp;=20
  dwMajorVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D allot( DWord ), =
<BR>&nbsp;=20
  dwMinorVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D allot( DWord ), =
<BR>&nbsp;=20
  dwBuildNumber&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D allot( DWord ),=20
  <BR>&nbsp;&nbsp;dwPlatformId&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=3D=20
  allot( DWord ),<BR>&nbsp;=20
  szCSDVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D allot( Lpsz =

  ),<BR>&nbsp; SIZEOF_OSVERSION&nbsp;&nbsp;&nbsp; =3D allotted_size() =
<BR>. .=20
  .</FONT></DIV>
  <DIV><FONT face=3D"Courier New" size=3D2>&nbsp;ptOS =3D =
allocate_struct(=20
  SIZEOF_OSVERSION )<BR>&nbsp;store( ptOS, dwOSVersionInfoSize, =
SIZEOF_OSVERSION=20
  )</FONT></DIV>
  <DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3D"Courier New" size=3D2>&nbsp;OSVersion =3D =
define_c_func(kernel32,=20
  "GetVersionExA", {C_POINTER}, C_INT)<BR>&nbsp;val =3D =
c_func(OSVersion, { ptOS }=20
  )<BR>&nbsp;result =3D message_box(sprintf( "Boolean: %d", val ), =
"OSVersion",=20
  MB_ICONINFORMATION+MB_TASKMODAL =
)<BR></FONT></DIV><PRE>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
Enter the email zone through My Topica - a free email
subscription system designed to maximize email efficiency
and minimize inbox overload.  Sign up today.
<A =
Or send an email To: EUforum-unsubscribe at topica.com
This email was sent to: ddparnell at bigpond.com

<A =

------=_NextPart_000_0008_01C0DE23.C0C2FE00--

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu