Hola, bueno encontre un codigo y lo modifique porque no me funcionaba, me quedo asi:
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Function winversion() As String
'declaramos la variable osvi de tipo osversioninfo
Dim osvi As OSVERSIONINFO
'asignamos valor al parametro dwOSVersionInfoSize
'de acuerdo a la longitud de nuestra variable osvi de tipo
'osversioninfo
osvi.dwOSVersionInfoSize = Len(osvi)
'le pasamos el parametro a la API
GetVersionEx osvi
'comparamos y le damos valor a winversion
If osvi.dwPlatformId = 1 Then
If osvi.dwMinorVersion = 0 Then winversion = "Windows 95"
If osvi.dwMinorVersion = 10 Then winversion = "Wiondows 98"
ElseIf osvi.dwPlatformId = 2 Then
If osvi.dwMinorVersion = 0 Then
winversion = "Windows 2000"
Else
winversion = "Windows xp"
End If
End If
End Function
Private Sub Command1_Click()
Label1.Caption = "La version es " & winversion
End Sub
Lo que les quiero pedir ahora es que me digan si tiene algun error poprque yo solo tengo Windows XP, ami me funciona pero no se si detectara bien los otros windows asi que porfavor si lo pueden probar y me dicen si anda.
@ Anhur sos muy amable pero la verdad no se utilisar bien las API, mejor dicho no se utilizarlas, y la ayuda del MSDN me parece chino basico. Estaria bueno que agas un mini tuto para aprender a usar la ayuda de MSDN ocea para poder entender, claro oviamente4 si queres.
Esta es la info que me brindo Anhur si me la pueden explicar asi para la proxima.
GetVersionEx
The GetVersionEx function obtains extended information about the version of the operating system that is currently running.
To obtain information for the operating system on a remote computer, use the NetWkstaGetInfo function, the Win32_OperatingSystem WMI class, or the OperatingSystem property of the IADsComputer interface.
To compare the current system version to a required version, use the VerifyVersionInfo function instead of using GetVersionEx to perform the comparison yourself.
BOOL GetVersionEx(
LPOSVERSIONINFO lpVersionInfo
);
Parameters
lpVersionInfo
[in, out] Pointer to an OSVERSIONINFO or OSVERSIONINFOEX structure that receives the operating system version information.
Before calling the GetVersionEx function, set the dwOSVersionInfoSize member of this structure as appropriate.
Return Values
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError. The function fails if you specify an invalid value for the dwOSVersionInfoSize member of the OSVERSIONINFO or OSVERSIONINFOEX structure.
Remarks
Identifying the current operating system is usually not the best way to determine whether a particular operating system feature is present. This is because the operating system may have had new features added in a redistributable DLL. Rather than using GetVersionEx to determine the operating system platform or version number, test for the presence of the feature itself. For more information, see Operating System Version.
To verify whether the current operating system is Windows XP Media Center Edition, Windows XP Tablet PC Edition, or Windows Server 2003 "R2", use the GetSystemMetrics function with SM_TABLETPC, SM_MEDIACENTER, or SM_SERVERR2, respectively.
Example Code [C++]
When using the GetVersionEx function to determine whether your application is running on a particular version of the operating system, check for version numbers that are greater than or equal to the desired version numbers. This ensures that the test succeeds for later versions of the operating system. For example, if your application requires Windows XP, use the following test.
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx (&osvi);
bIsWindowsXPorLater =
( (osvi.dwMajorVersion > 5) ||
( (osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion >= 1) );
Example Code
For an example that identifies the current operating system, see Getting the System Version.
Requirements
Client Requires Windows "Longhorn", Windows XP, Windows 2000 Professional, Windows NT Workstation 3.5 and later, Windows Me, Windows 98, or Windows 95.
Server Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000 Server, or Windows NT Server 3.5 and later.
Header
Declared in Winbase.h; include Windows.h.
Library
Link to Kernel32.lib.
DLL Requires Kernel32.dll.
Unicode
Implemented as GetVersionExW (Unicode) and GetVersionExA (ANSI). Note that Unicode support on Windows Me/98/95 requires Microsoft Layer for Unicode.
Chau salu2!!! y muchas gracias.