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 

Window HWND returned via COM - convert to Hex

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



Joined: 24 May 2009
Posts: 722
Location: Iowa, USA

PostPosted: Wed Nov 18, 2009 11:21 pm    Post subject: Window HWND returned via COM - convert to Hex Reply with quote

I'm trying to convert an integer to Hex, which I've gotten to work. However, if I try to do this with a window HWND that I retrieved via COM, it will not convert. This demonstrates what I mean:
Code:
pwb := COM_CreateObject("InternetExplorer.Application") ; AHK_L & COM_L
pwb.Visible := True
hwnd := pwb.HWND
If hwnd is Integer
   MsgBox, %hwnd%
; hwnd := 10617752   ; example hwnd
SetFormat, Integer, Hex
   hwnd := hwnd
SetFormat, Integer, Dec
MsgBox, %hwnd%

The first MsgBox always comes up as an integer, but the second comes up as an integer as well (dec format). However, if I uncomment the sixth line, the second MsgBox will come up as Hex. Is the variable hwnd different if it's storing a value retrieved with COM? What I'm trying to do is access a window that was accessed with COM, but using the AHK commands. (ie WinTitle := ahk_id %hwnd%)
_________________
AHKL, COM_L,Webpage Controls,Donate to AHK
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 2428

PostPosted: Thu Nov 19, 2009 12:06 am    Post subject: Reply with quote

Why did you go with this for conversion?

Code:
hwnd := hwnd


I believe the manual recommends this:

Code:
hwnd += 0


Have you tried that already?
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message
jethrow



Joined: 24 May 2009
Posts: 722
Location: Iowa, USA

PostPosted: Thu Nov 19, 2009 12:13 am    Post subject: Reply with quote

sinkfaze wrote:
Why did you go with this for conversion?
Found it in a post on converting dec --> hex.
sinkfaze wrote:
Have you tried that already?

Just did, and it works Very Happy . Thanks sinkfaze.
_________________
AHKL, COM_L,Webpage Controls,Donate to AHK
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2141

PostPosted: Thu Nov 19, 2009 12:30 am    Post subject: Reply with quote

It's essentially difference between:
Code:
hwnd := "10617752"
; or
hwnd := 10617752
Back to top
View user's profile Send private message
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