Click to See Complete Forum and Search --> : findwindow
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
how do I use this?
also, what is it used for, when it finds the window, does it open it, or does it have to be open to find the window?
help me please.
i just learned how to use this
you would do this:
a = FindWindow(windowclassname,windowcaption)
and if this is succesful then "a" will hold the handle for the window. for example, i am making a program for napster and i need to know its handle, so i would put this line of code in:
napster_handle = FindWindow("napster",vbNullString)
and now napster_handle will hold the handle for napsters window. hope i helped out. check out http://www.vbapi.com
thanks,
but how do you know the windowclassname?
well i used a spy program to find the class name of napster, but there is a way to find it with coding. i dont know the code off hand, but it is fairly simple. what the code does is follow your mouse cursor, and with the function "GetClassNameA" you can retrieve the window class. but im not sure how to get your mouse cursor position outside of the form, so i cant give the code. i hope this helps.
check out http://www.vbapi.com for a lot more help on this kind of stuff.
I've got a program that gives you the class AND the window handle :D
after finding the window, how do I manipulate it and open it using the handle?
well you have to be more specific, but ill give you one example. for instance once you get the window handle of the window you want to play around with, then use the SetWindowText function.
Call SetWindowText(windowhandle, "anything you want")
now the caption of that window will be "anything you want". so that is a cool way to mess around with programs.
THANK YOU....
it worked good.... but it doesnt need the call setwindowtext
just
SetWindowText 1208, "My First Sucessful API Call :D "
1208 is the handle for my DUN connection window...
can someone list all of the calls related to this kind of thing?
here is a small list of very simple API functions that work by just knowing the handle of the window:
Call EnableWindow(windowhandle, True/False) depending on if that window is enabled or disabled.
Call ShowWindow(windowhandle, True/False) depending if you want to hide or show it.
there are many more stuff, but those are just 2 of them. plus im new to API so i dont know many functions.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.