Knowing if W7

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
jouhmg
Posts: 26
Joined: Thu Jul 31, 2008 3:22 am

Knowing if W7

Post by jouhmg »

English by Google

Hi:
Can one know if the OS is W7?

TIA
jouhmg

Español

Hola:
¿ Se puede saber si el SO es W7 ?

Gracias
jouhmg
User avatar
mustafa
Posts: 1177
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Knowing if W7

Post by mustafa »

Hello
I think with: WindowsVersion ()
can determine the version of windows
Gretings

Hola
creo que con: WIndowsVersion()
se puede saber la versión de windows
Saludos
Mustafa :?:
User avatar
gfilatov
Posts: 1116
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Knowing if W7

Post by gfilatov »

jouhmg wrote:
Hi:
Can one know if the OS is W7?
Hi jouhmg,

Try to add the following C-function in your project:

Code: Select all

HB_FUNC( ISSEVEN )
{

	OSVERSIONINFO osvi;

	ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

	GetVersionEx(&osvi);

	if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)
	{
		hb_retl(TRUE);
	}
	else
	{	
		hb_retl(FALSE);
	}

}
Usage:

Code: Select all

If IsSeven()
   MsgInfo('Windows 7 is detected!')
EndIf
...
I hope that helps :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
mustafa
Posts: 1177
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Knowing if W7

Post by mustafa »

Hello I found this magnificent function
created by our great friend Bicahi Esgici
called MsgMulti
On my computer tells me ----> Windows XP
Professional Service Pack 2 Build 2600 <-----
If it can not be used to see if it is
Windows 7 installed
Greetings

Hola he encontrado esta magnifica función
creada por nuestro gran amigo Bicahi Esgici
que se llama MsgMulti
En mi Pc me indica ----> Windows XP
Profesional Service Pack 2 Build 2600 <-----
No se si puede servir para ver si está
instalado Windows 7
Saludos

Mustafa
Attachments
demoMsgMulti.zip
(693.97 KiB) Downloaded 306 times
jouhmg
Posts: 26
Joined: Thu Jul 31, 2008 3:22 am

Re: Knowing if W7

Post by jouhmg »

English by Google

Hi:
Thanks, but I think it only goes to W. Vista.
jouhmg

Español

Hola:
Gracias, pero creo que sólo llega a W.Vista.
jouhmg
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Knowing if W7

Post by mol »

Hello Mustafa!
I've ran this program on my notebook with Win 7 Home Premium 64bit and I've got only:

Home Edition Build 7600
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Knowing if W7

Post by Roberto Lopez »

jouhmg wrote:English by Google

Hi:
Can one know if the OS is W7?

TIA
jouhmg

Español

Hola:
¿ Se puede saber si el SO es W7 ?

Gracias
jouhmg
WindowsVersion() function must be updated to work with Win7. I've added to the current bug list.

Meanwhile, you could use the Grigory function or two functions already present in HMG:

- WINMAJORVERSIONNUMBER()
- WINMINORVERSIONNUMBER()

For Win7 these functions will return 6 and 1 respectively. ie:

msginfo ( str (WINMAJORVERSIONNUMBER()) + ' ' + str(WINMINORVERSIONNUMBER()) )

ehhh... yes... the Windows 7 version number is 6.1 :)
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
jouhmg
Posts: 26
Joined: Thu Jul 31, 2008 3:22 am

Re: Knowing if W7

Post by jouhmg »

English by Google

Hi:
Thanks to all.
jouhmg

Español

Hola:
Gracias para todos.
jouhmg
Post Reply