AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A_OSType and 64-Bit Vista

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Thu Feb 07, 2008 6:54 am    Post subject: A_OSType and 64-Bit Vista Reply with quote

Hi Chris,

shouldn't A_OSType show WIN64_NT for Vista x64? If not, what could be the best way to detect 64-Bit? I need this as ContolGet, List also don't work on XP 64-Bit.
_________________
Tekl
Back to top
View user's profile Send private message Visit poster's website
DerRaphael



Joined: 23 Nov 2007
Posts: 456
Location: Heidelberg, Germany

PostPosted: Thu Feb 07, 2008 10:30 am    Post subject: Reply with quote

something like this (not fully tested, developed in win32 context under win2k)

Code:
varsetCapacity(Bool,1)
res := DllCall("IsWow64Process","Uint",WinExist("A"),"UInt",&bool)
; ErrorLevel -4 = The specified function could not be found
MsgBox % ((ErrorLevel="-4")||(!bool)) ? "win32" : "win64"


more informations can be found here:
MSDN on IsWow64Process

greets
derRaphael
_________________
Back to top
View user's profile Send private message
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Thu Feb 07, 2008 1:35 pm    Post subject: Reply with quote

Thanks, but bool is always empty.
_________________
Tekl
Back to top
View user's profile Send private message Visit poster's website
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Mon Feb 11, 2008 7:38 am    Post subject: Reply with quote

Setting a var's contents indirectly via &address-of will not automatically update it's "length". Use "Int*" instead. (Actually, what you had could be dangerous since BOOLs are 32-bit, not 8-bit, and you only allocated 1 byte.) Also, IsWow64Process accepts a process handle, not a window ID.
Code:
ThisProcess := DllCall("GetCurrentProcess")
; If IsWow64Process() fails or can not be found,
; assume this process is not running under wow64.
; Otherwise, use the value returned in IsWow64Process.
if !DllCall("IsWow64Process", "uint", ThisProcess, "int*", IsWow64Process)
    IsWow64Process := false
MsgBox % IsWow64Process ? "win64" : "win32"
Back to top
View user's profile Send private message
DerRaphael



Joined: 23 Nov 2007
Posts: 456
Location: Heidelberg, Germany

PostPosted: Wed Feb 13, 2008 12:16 am    Post subject: Reply with quote

learn every day something new. thanks lexikos for correcting my poor creation Smile
_________________
Back to top
View user's profile Send private message
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Wed Feb 13, 2008 12:27 am    Post subject: Reply with quote

Yes, thanks also from my side. It works.
_________________
Tekl
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group