Announcement

Collapse
No announcement yet.

#if(WINVER >= 0x0400)

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

  • Josef Lindinger
    replied
    Originally posted by Eric Pearson:
    If your primary goal is to suggest that #IF might be enhanced to support < and > then I'm sure that many people here would agree with you.
    As i wrote above, that´s exactly the point!
    Thank you and thanks Scott for your sample-code. This is how my program works at the moment.


    ------------------

    mailto:[email protected][email protected]</A> www.selisoft.com

    Leave a comment:


  • Eric Pearson
    replied
    Josef --

    My personal experience is that it is a mistake to create different executable files for different versions of Windows. It can be a distribution and update nightmare, so I always create a single EXE or DLL that makes runtime adjustments for the various versions of Windows. But if you really want to create different versions...

    The only obstacle is that the PowerBASIC #IF metastatement does not currently support things like <= and =>. But if you want to create a complex set of individual "=" tests you can obtain exactly the same results. You would need to enumerate all of the versions of Windows that exist, rather than using things like "greater than or equal to version 4".

    If your primary goal is to suggest that #IF might be enhanced to support < and > then I'm sure that many people here would agree with you.

    -- Eric

    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>



    [This message has been edited by Eric Pearson (edited June 05, 2000).]

    Leave a comment:


  • Scott Turchin
    replied
    If you can put this in a pre-compile directive of some kind:

    Code:
    Function GetWindowsVersion() Export As String
    Local osinfo   As OSVERSIONINFO
    Local lResult  As Long
    
    osinfo.dwOsVersionInfoSize = SizeOf(osinfo)
    lResult = GetVersionEx(osinfo)
    
    If IsFalse lResult Then
       Function = "Windows"
       Exit Function
    End If
    
    If osinfo.dwPlatformId = %VER_PLATFORM_WIN32_NT Then
       Select Case osinfo.dwMajorVersion'
              Case 4
                   Function = "Windows NT"
              Case 5
                   Function = "Windows 2000"
       End Select
    ElseIf osinfo.dwPlatformId = %VER_PLATFORM_WIN32_WINDOWS Then
       'dwPlatformId
       Select Case osinfo.dwMinorVersion
              Case < 10
                   Function = "Windows 95"
              Case 10
                   If osinfo.dwPlatformId = 1 Then
                       Function = "Windows 98 OSR1"
                   ElseIf osinfo.dwPlatformId = 2 Then
                       Function = "Windows 98 OSR2"
                   Else
                       Function = "Windows 98"
                   End If
    
              Case > 12 ???
                   Function = "Windows Mil."
       End Select
    End If
    End Function

    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    MCSE, MCP+Internet

    Leave a comment:


  • Josef Lindinger
    replied
    Originally posted by Eric Pearson:
    In what context? The #IF metastatement is a compile-time directive, so if your code worked it would be like saying "if this program is being compiled on Windows version 4 or later machine, include this code...".

    But most programs are more interested in the Windows version at runtime, not compile time. If that is the case, you would need to use the GetVersion API function to determine what version of Windows is being used.

    I have also seen that notation used to mean "if the Windows version is greater than or equal to 4, the operating system will return these values. Otherwise, it will return these other values."

    Actually, now that I think about it, it may not matter what context you're talking about. Windows 95, 98, NT, and 2000 all have Windows version numbers that are greater than or equal to 4, so the only time you'd see <4 would be with Windows 3.x. And since the PB/CC and PB/DLL compilers require Windows 95 or better, your programs should never encounter <4.

    -- Eric

    You are right, the sample is not the best, but what if i want to create different versions of my software for different destination-os like NT3.51, NT4, NT5 or WIN95, WIN98, WIN??.

    My intention is that the compile-time directives should be more flexible to handle things like "#if _WIN32_IE >= 0x0400", "#if _WIN32_WINNT=0x0400 and WINVER=0x0400" or "#if _WIN32_WINDOWS=0x0410 and WINVER=0x0400"

    It seems to me, that it is not possible at the moment, but i think such things should be possible in future versions of PBDLL/CC.


    ------------------
    Josef Lindinger
    mailto:[email protected][email protected]</A>
    www.selisoft.com

    Leave a comment:


  • Eric Pearson
    replied
    In what context? The #IF metastatement is a compile-time directive, so if your code worked it would be like saying "if this program is being compiled on Windows version 4 or later machine, include this code...".

    But most programs are more interested in the Windows version at runtime, not compile time. If that is the case, you would need to use the GetVersion API function to determine what version of Windows is being used.

    I have also seen that notation used to mean "if the Windows version is greater than or equal to 4, the operating system will return these values. Otherwise, it will return these other values."

    Actually, now that I think about it, it may not matter what context you're talking about. Windows 95, 98, NT, and 2000 all have Windows version numbers that are greater than or equal to 4, so the only time you'd see <4 would be with Windows 3.x. And since the PB/CC and PB/DLL compilers require Windows 95 or better, your programs should never encounter <4.

    -- Eric

    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>



    [This message has been edited by Eric Pearson (edited June 04, 2000).]

    Leave a comment:


  • Josef Lindinger
    started a topic #if(WINVER >= 0x0400)

    #if(WINVER >= 0x0400)

    Hi,

    i want to do something like in the Subject, how would you do this?
    Thank you!

    -------------
    Josef Lindinger
    mailto:[email protected][email protected]</A>
    www.selisoft.com
Working...
X