api FindWindowA in pb10

bowsermxli
bowsermxli used Ask the Experts™
on
i try this simple code in pb10 and do not find the window.... i try the same code in pb8 and it works(return l_handle<>0):

//global external
FUNCTION ulong FindWindowA(ulong classname,string windowname) Library "user32.dll"

//script
ulong l_handle
string ls_wname

open (w1) //window with the title "Ventana de Pendientes"
ls_wname = "Ventana de Pendientes"  
l_handle = FindWindowA(0, ls_wname)
messagebox('WindowHandler',string(l_handle))


i try migrate an app from pb8 to pb10 but i use a lot of api calls... but my first trouble was most of the api calls do not work

what's wrong??

i'm using pb10.2.0 Build 8050, pb8.0.4 Build 10923

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
We're using version 9, and have many API calls that appear to work as they did in version 8.  Worst case situation you could move to version 9, and give version 10 some time to get it's wrinkle's ironed out.
hi

change you function with this little change

FUNCTION ulong FindWindowA(ulong classname,string windowname) Library "user32.dll"  alias for "findwindowA;Ansi"

this is the change in pb10

Gajender
;ansi Required if the function passes a string as an argument or returns a string that uses ANSI encoding. Even if you use the default name for an ANSI function, you must always use the ALIAS keyword if you want to specify that the string uses ANSI encoding, because you must qualify the ALIAS with the ansi keyword


Gajender

To expand on Gajender's reply, PB10 is UNICODE.  Arguably the biggest change in PB 10 and very well documented in various places on the web along with the various issues it will cause.  An alternative to using FindWindowA is to use the Unicode version of the API which I believe is simply FindWindow.

Mike

Author

Commented:
it works... only thing is the api calls are case sensitive then the right declare was :

FUNCTION ulong FindWindowA(ulong classname,string windowname) Library "user32.dll"  alias for "FindWindowA;Ansi"

was an error in  ...  - alias for "findwindowA;Ansi" -


....thank's

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial