Reply from emacdonald on Apr 18 at 4:42 PM Rob, are you programming in VB 6 on a Win 7 machine? Ed MacDonald Transportation Manager
| | | ---------------Original Message--------------- From: Rob Crombie Sent: Wednesday, April 18, 2012 2:10 PM Subject: z-order Enum Top Level Windows In case anyone is using the example I posted in our 'VB for Access' forum. There is a very common error in that example and in most of the examples out in the web. If one is trying to get the Active window's Text (aka Title), the API requires a fixed length string. Nearly all of the examples use - Dim sText as string * 255 That will work in allowing the API call to place the Text (Title) into the variable sText The error occurs when they try to trim the final contents of sText. They use - Trim(sTitle) And are assuming that that will Trim the contents down to the length of the Title. HOWEVER the Trim does nothing, as the fixed length sText variable, was padded with vbNullChar and not with spaces. So you should get rid of - Trim(sTitle) and use this instead - Trim(Replace(sTitle, vbNullChar, "")) | | Reply to this email to post your response. __.____._ | In the Spotlight Become a blogger at Toolbox.com and share your expertise with the community. Start today. _.____.__ |
No comments:
Post a Comment