Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi How to get Windows update number (https://www.delphipraxis.net/192353-how-get-windows-update-number.html)

WojTec 11. Apr 2017 14:03

How to get Windows update number
 
How to get Windows 8+ version number? I don't mean TOSVersionInfoEx.dwMajorVersion/TOSVersionInfoEx.dwMinorVersion but something like 1511 or 1607 on Windows 10 :?: This looks to be update version, I don't know how to name it exactly :?

And also I see in system info build number like this: (TOSVersionInfoEx.dwBuildNumber).953. Where to find the number after dot :?:

a.def 11. Apr 2017 14:05

AW: How to get Windows update number
 
I'm not sure but I think you have to get the version string from registry and parse it yourself.

Der schöne Günther 11. Apr 2017 15:36

AW: How to get Windows update number
 
Zitat:

In Windows 8.1 and Windows 10, the GetVersion and GetVersionEx functions have been deprecated. In Windows 10, the VerifyVersionInfo function has also been deprecated. While you can still call the deprecated functions, if your application does not specifically target Windows 8.1 or Windows 10, you will get Windows 8 version (6.2.0.0).
=> https://msdn.microsoft.com/de-de/lib...(v=vs.85).aspx

You will have to include the manifest stuff from that page into your application. Then
Delphi-Quellcode:
GetVersionEx(..)
will return the true build number.

HolgerX 11. Apr 2017 16:31

AW: How to get Windows update number
 
A simple option:

http://www.delphipraxis.net/1311524-post27.html

WojTec 11. Apr 2017 17:44

Re: How to get Windows update number
 
Yeah, with manifest old functions are working. But how to get OS version without manifest (I think check some file version from system is not real solution)?

BTW: if functions are deprecated, so why Delphi still uses it?:o:shock:

"Update number" I got from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion: ReleaseId, but I think this is not real solution too.

Some ideas:?:

a.def 11. Apr 2017 17:49

AW: How to get Windows update number
 
Zitat:

"Update number" I got from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion: ReleaseId, but I think this is not real solution too.
I do it the same way.

Normally the version number is written in registry. If not, the user changed it for sure and this is not the problem of a program creator.

Der schöne Günther 11. Apr 2017 17:53

AW: Re: How to get Windows update number
 
Zitat:

Zitat von WojTec (Beitrag 1367211)
Yeah, with manifest old functions are working. But how to get OS version without manifest

I'm puzzled. "Yeah, I can open that door with that key over there, but how can I open the door without the key?" :|

WojTec 11. Apr 2017 18:02

Re: AW: Re: How to get Windows update number
 
Zitat:

Zitat von Der schöne Günther (Beitrag 1367213)
I'm puzzled.

Why? This for sure will stop working some day, also MS told it's deprecated, so I'm looking for new solution :)

a.def 11. Apr 2017 18:32

AW: How to get Windows update number
 
Zitat:

Why? This for sure will stop working some day, also MS told it's deprecated, so I'm looking for new solution
Registry as long as it is working? ;)

Der schöne Günther 11. Apr 2017 18:33

AW: How to get Windows update number
 
I understand - It's about GetVersionEx being deprecated. Sorry :oops:

According to MS, the preferred solution is to use VerifyVersionInfo which (for now) behaves exactly the same except it returns a boolean whether the operating system matches your expectations rather than returning numbers.
Note that the "manifest stuff" still applies to VerifyVersionInfo. It's just not "deprecated", that's all.

This is also what the helper macros use, and they have been around for quite some time now.

a.def 11. Apr 2017 18:37

AW: How to get Windows update number
 
Zitat:

except it returns a boolean whether the operating system matches your expectations rather than returning numbers
This is not practical at all in my opinion.

I use a component I modify everyime there is a change in Windows' version history. Currently it's compatible until Update 1703 and it reads also the registry since Windows 10.
Everything works fine since Windows 10 exists.

This component I was talking about. But my version is newer than the last version posted in this thread.
http://www.delphipraxis.net/1335882-post59.html

ralfstocker 12. Apr 2017 07:29

AW: How to get Windows update number
 
Dein Programm sollte immer funktionieren. Also kein Bedarf, die Version zu ermitteln. Das sollte die Philosophie eines jeden Entwicklers sein.

bra 12. Apr 2017 08:56

AW: How to get Windows update number
 
Zitat:

Zitat von ralfstocker (Beitrag 1367262)
Dein Programm sollte immer funktionieren. Also kein Bedarf, die Version zu ermitteln. Das sollte die Philosophie eines jeden Entwicklers sein.

Was ist das denn für eine Aussage? Und wenn man Funktionen unterstützen will, die nur in bestimmten Versionen verfügbar sind, darf man kein Programm schreiben oder wie? :roll:

a.def 12. Apr 2017 09:07

AW: How to get Windows update number
 
Zitat:

Dein Programm sollte immer funktionieren. Also kein Bedarf, die Version zu ermitteln. Das sollte die Philosophie eines jeden Entwicklers sein.
Im Prinzip ist das Schwachsinn denn

Zitat:

Was ist das denn für eine Aussage? Und wenn man Funktionen unterstützen will, die nur in bestimmten Versionen verfügbar sind, darf man kein Programm schreiben oder wie?
Sehe ich genau so.


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:56 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz