DaleHohm Posted July 13, 2005 Share Posted July 13, 2005 Using COM, the InternetExplorer.Application object has an HWND property. $o_object = ObjCreate("InternetExplorer.Application") $IEhandle = $o_object.HWND () I want to be able to get this value and then use it in AutoIt functions like WinActivate etc. Unfortunately, when I retrieve it with COM it comes back as an integer (e.g. 592114 and IsInt returns 1) and AutoIt represents handles as some sort of special datatype (IsInt returns 0) and I cannot use the value in these AutoIt functions. Any suggestions for how I can turn the COM value into something that the AutoIt functions can use? Thanks, Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
layer Posted July 14, 2005 Share Posted July 14, 2005 (edited) Hmm... Good question... I tried this:$hwnd = WinGetHandle("Windows Media Player") MsgBox(0, "WMP", $hwnd) $o_object = ObjCreate("InternetExplorer.Application") $IEhandle = Hex($o_object.HWND (), 8) MsgBox(0, "IE", $IEhandle) $title1 = WinGetTitle($hwnd) MsgBox(0, "WMP", $title1) $title2 = WinGetTitle($IEHandle) MsgBox(0, "IE", $title2)But the final $IEhandle returned 0...Because it looks like the returns for hWnd's are Hex values... Anyone else wanna give it a shot?EDIT: Couldn't find much here: http://msdn.microsoft.com/library/default....netexplorer.asp Edited July 14, 2005 by layer FootbaG Link to comment Share on other sites More sharing options...
Administrators Jon Posted July 14, 2005 Administrators Share Posted July 14, 2005 Hmm, this is a good point. Maybe ezztabi will get his wish about ToHandle() conversion functions after all... Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
SlimShady Posted July 14, 2005 Share Posted July 14, 2005 Hmm, this is a good point. Maybe ezztabi will get his wish about ToHandle() conversion functions after all...<{POST_SNAPBACK}>It would definitely help in some of my scripts.I really would like this. Link to comment Share on other sites More sharing options...
layer Posted July 14, 2005 Share Posted July 14, 2005 Hmm, this is a good point. Maybe ezztabi will get his wish about ToHandle() conversion functions after all...<{POST_SNAPBACK}>Thank you!!!!!!!!! FootbaG Link to comment Share on other sites More sharing options...
DaleHohm Posted July 25, 2005 Author Share Posted July 25, 2005 This is a question of protocol... Is this already considered to be a real feature request based on the discussion here (including Jon's reply)? It is certainly not a bug, but should it perhaps be moved to the V3 Idea Lab so that it doesn't get lost? Thanks, Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Administrators Jon Posted July 26, 2005 Administrators Share Posted July 26, 2005 Using COM, the InternetExplorer.Application object has an HWND property. $o_object = ObjCreate("InternetExplorer.Application") $IEhandle = $o_object.HWND ()I want to be able to get this value and then use it in AutoIt functions like WinActivate etc.Unfortunately, when I retrieve it with COM it comes back as an integer (e.g. 592114 and IsInt returns 1) and AutoIt represents handles as some sort of special datatype (IsInt returns 0) and I cannot use the value in these AutoIt functions.Any suggestions for how I can turn the COM value into something that the AutoIt functions can use?Thanks,DaleActually, I'll check with Sven. I would expect that code to return a native HWND type rather than a integer. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
SvenP Posted July 26, 2005 Share Posted July 26, 2005 Actually, I'll check with Sven. I would expect that code to return a native HWND type rather than a integer.<{POST_SNAPBACK}>Jon,COM doesn't know anything about HWNDs. It always returns an integer value in this case. There is no way to determine if it's actually a HWND (unless I do an 'IsHandler()' call on EVERY COM function, but that's what we call 'Spaghetti Programming' here).Also: Isn't the purpose of AutoIt to be datatypeless where possible? So I propose it would be better to modify functions like WinGetTitle(), so it will check for you if you have passed it a valid HWND or not. In this way the user does not have to worry about whether he/she is handling with integers or HWNDs. Regards,-Sven Link to comment Share on other sites More sharing options...
Administrators Jon Posted July 27, 2005 Administrators Share Posted July 27, 2005 Jon,COM doesn't know anything about HWNDs. It always returns an integer value in this case. There is no way to determine if it's actually a HWND (unless I do an 'IsHandler()' call on EVERY COM function, but that's what we call 'Spaghetti Programming' here).Also: Isn't the purpose of AutoIt to be datatypeless where possible? So I propose it would be better to modify functions like WinGetTitle(), so it will check for you if you have passed it a valid HWND or not. In this way the user does not have to worry about whether he/she is handling with integers or HWNDs. Regards,-SvenAh, that answers it then - i'd assumed that COM was returning a native HWND type and autoit was misinterpereting it.int / HWND conversion is a bit weird - the compiler doesn't just let you cast and iirc I did some pretty weird stuff to make it work (in some of the WinWait conversion functions). Maybe I should modify the Win functions so that they try an automatic HWND conversion if passes an int. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Valik Posted July 27, 2005 Share Posted July 27, 2005 Gah, where are we discussing this at, the private thread or this one? I've stated in the other thread my reservations about automatically trying to cast int's to HWND. Let's talk about things there for now, two threads are confusing. Link to comment Share on other sites More sharing options...
DaleHohm Posted August 5, 2005 Author Share Posted August 5, 2005 Yeah! 3.1.1.66 adds the new HWnd function and it works beautifully. This allows us to readily get a reference to a COM-created IE window that can be used in all of the traditional AutoIt functions: $oIE = ObjCreate("InternetExplorer.Application") $oIE.visible = 1 $handle = HWnd($oIE.HWND) WinFlash($handle) Thanks all! Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
layer Posted August 5, 2005 Share Posted August 5, 2005 (edited) Works like a charm! Hmm, the first time I've seen someone use my function!!! w00000000000000000000000000t, I feel so cool now The latest BETA (.66) looks so great You made my day :"> Edited August 5, 2005 by layer FootbaG Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now