1. GetVersionEx
- Posted by jjnick at cvn.com May 15, 2001
- 357 views
This is a multi-part message in MIME format. ------=_NextPart_000_0046_01C0DD9B.BF0948E0 charset="Windows-1252" 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 =3D allot( DWord ),=20 dwMajorVersion =3D allot( DWord ),=20 dwMinorVersion =3D allot( DWord ),=20 dwBuildNumber =3D allot( DWord ),=20 dwPlatformId =3D allot( DWord ), szCSDVersion =3D allot( Lpsz ), SIZEOF_OSVERSION =3D allotted_size()=20 . . . ptOS =3D allocate_struct( SIZEOF_OSVERSION ) store( ptOS, dwOSVersionInfoSize, SIZEOF_OSVERSION ) OSVersion =3D define_c_func(kernel32, "GetVersionExA", {C_POINTER}, = C_INT) val =3D c_func(OSVersion, { ptOS } ) result =3D message_box(sprintf( "Boolean: %d", val ), "OSVersion", = MB_ICONINFORMATION+MB_TASKMODAL ) ------=_NextPart_000_0046_01C0DD9B.BF0948E0 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=3DContent-Type content=3D"text/html; = charset=3Dwindows-1252"> <META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY> <DIV><FONT face=3DArial size=3D2>Man, I am having a terrible time = getting=20 GetVersionEx to work, what am I doing wrong . . . The value of = "Boolean"=20 is "0", False . . .</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3D"Courier New" size=3D2>. . .</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2>global constant<BR> =20 dwOSVersionInfoSize =3D allot( DWord ), <BR> =20 dwMajorVersion =3D allot( DWord ), = <BR> =20 dwMinorVersion =3D allot( DWord ), = <BR> =20 dwBuildNumber =3D allot( DWord ),=20 <BR> dwPlatformId = =3D allot(=20 DWord ),<BR> = szCSDVersion =3D=20 allot( Lpsz ),<BR> SIZEOF_OSVERSION =3D = allotted_size()=20 <BR>. . .</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2> ptOS =3D allocate_struct( = SIZEOF_OSVERSION )<BR> store( ptOS, dwOSVersionInfoSize, = SIZEOF_OSVERSION=20 )</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV> <DIV><FONT face=3D"Courier New" size=3D2> OSVersion =3D = define_c_func(kernel32,=20 "GetVersionExA", {C_POINTER}, C_INT)<BR> val =3D c_func(OSVersion, = { ptOS }=20 )<BR> result =3D message_box(sprintf( "Boolean: %d", val ), = "OSVersion",=20 ------=_NextPart_000_0046_01C0DD9B.BF0948E0--
2. Re: GetVersionEx
- Posted by jjnick at cvn.com May 16, 2001
- 358 views
This is a multi-part message in MIME format. ------=_NextPart_000_0074_01C0DDA3.233D46C0 charset="Windows-1252" Worked like a charm, thanks ----- Original Message -----=20 From: Derek Parnell=20 To: EUforum=20 Sent: Wednesday, May 16, 2001 12:17 AM Subject: RE: GetVersionEx Hi, the definition of the structure is wrong. Try this instead... global constant dwOSVersionInfoSize =3D allot( DWord ),=20 dwMajorVersion =3D allot( DWord ),=20 dwMinorVersion =3D allot( DWord ),=20 dwBuildNumber =3D allot( DWord ),=20 dwPlatformId =3D allot( DWord ), szCSDVersion =3D allot( 128 ), SIZEOF_OSVERSION =3D allotted_size()=20 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. -----------=20 cheers,=20 Derek Parnell=20 =20 -----Original Message----- From: jjnick at cvn.com [mailto:jjnick at cvn.com] Sent: Wednesday, 16 May 2001 4:04 PM To: EUforum Subject: GetVersionEx . . . global constant =20 dwOSVersionInfoSize =3D allot( DWord ), =20 dwMajorVersion =3D allot( DWord ), =20 dwMinorVersion =3D allot( DWord ), =20 dwBuildNumber =3D allot( DWord ),=20 dwPlatformId =3D=20 allot( DWord ), =20 szCSDVersion =3D allot( Lpsz=20 ), SIZEOF_OSVERSION =3D allotted_size() . .=20 . ptOS =3D allocate_struct(=20 SIZEOF_OSVERSION ) store( ptOS, dwOSVersionInfoSize, SIZEOF_OSVERSION=20 ) =20 OSVersion =3D define_c_func(kernel32,=20 "GetVersionExA", {C_POINTER}, C_INT) val =3D c_func(OSVersion, { ptOS = }=20 ) result =3D message_box(sprintf( "Boolean: %d", val ), "OSVersion",=20 MB_ICONINFORMATION+MB_TASKMODAL ) ------=_NextPart_000_0074_01C0DDA3.233D46C0 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=3DContent-Type content=3D"text/html; = charset=3DWindows-1252"> <META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Worked like a charm, = thanks</FONT></DIV> <BLOCKQUOTE dir=3Dltr=20 style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; = BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A title=3Dddparnell at bigpond.com = href=3D"mailto:ddparnell at bigpond.com">Derek=20 Parnell</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = title=3DEUforum at topica.com=20 href=3D"mailto:EUforum at topica.com">EUforum</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Wednesday, May 16, 2001 = 12:17=20 AM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> RE: GetVersionEx</DIV> <DIV><FONT face=3DArial size=3D2></FONT><BR></DIV><PRE><SPAN = class=3D202521306-16052001><FONT face=3DArial color=3D#0000ff = size=3D2>Hi,</FONT></SPAN></PRE> <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> </DIV> <DIV><FONT face=3DArial color=3D#0000ff><FONT size=3D2><FONT = face=3D"Courier New"=20 color=3D#000000>global constant<BR> dwOSVersionInfoSize =3D = allot( DWord ),=20 <BR> dwMajorVersion =3D allot( = DWord ),=20 <BR> dwMinorVersion =3D allot( = DWord ),=20 <BR> dwBuildNumber =3D = allot( DWord ),=20 <BR> dwPlatformId = =3D=20 allot( DWord ),<BR> =20 szCSDVersion =3D = allot( <SPAN=20 class=3D202521306-16052001>128</SPAN> ),<BR> =20 SIZEOF_OSVERSION =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=20 long 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=20 size=3D2>cheers,</FONT> <BR><FONT face=3DArial size=3D2>Derek=20 Parnell</FONT> <BR><FONT face=3DTahoma><FONT size=3D2><SPAN=20 class=3D202521306-16052001><FONT face=3DArial=20 color=3D#0000ff> </FONT></SPAN></FONT></FONT></P> <P><FONT face=3DTahoma><FONT size=3D2><SPAN=20 class=3D202521306-16052001> </SPAN>-----Original=20 Message-----<BR><B>From:</B> jjnick at cvn.com=20 [mailto:jjnick at cvn.com]<BR><B>Sent:</B> Wednesday, 16 May 2001 4:04=20 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> >>>>> The = Euphoria Mailing List <<<<< <A <DIV><FONT face=3D"Courier New" size=3D2>. . .</FONT><DIV></DIV> <DIV><FONT face=3D"Courier New" size=3D2>global constant<BR> =20 dwOSVersionInfoSize =3D allot( DWord ), <BR> =20 dwMajorVersion =3D allot( DWord ), = <BR> =20 dwMinorVersion =3D allot( DWord ), = <BR> =20 dwBuildNumber =3D allot( DWord ),=20 <BR> dwPlatformId = =3D=20 allot( DWord ),<BR> =20 szCSDVersion =3D allot( Lpsz = ),<BR> SIZEOF_OSVERSION =3D allotted_size() = <BR>. .=20 .</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2> ptOS =3D = allocate_struct(=20 SIZEOF_OSVERSION )<BR> store( ptOS, dwOSVersionInfoSize, = SIZEOF_OSVERSION=20 )</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV> <DIV><FONT face=3D"Courier New" size=3D2> OSVersion =3D = define_c_func(kernel32,=20 "GetVersionExA", {C_POINTER}, C_INT)<BR> val =3D = c_func(OSVersion, { ptOS }=20 )<BR> result =3D message_box(sprintf( "Boolean: %d", val ), = "OSVersion",=20 MB_ICONINFORMATION+MB_TASKMODAL = ------=_NextPart_000_0074_01C0DDA3.233D46C0--