[ yokid @ 07.03.2005. 20:11 ] @
Ovako.
Interesuje me kako mogu da saznam lpClassName za neki prozor?

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Sta je uopste taj ClassName?
[ UserNameZbunjeno @ 07.03.2005. 21:56 ] @
...Mislim... za sta ce ti...
[ jc denton @ 07.03.2005. 22:09 ] @
Mislim da core GDI C programeri znaju ovo bolje da objasne posto bez CreateWindow(Ex) propade GUI.

Dakle, premestamo u C/C++ forum.
[ `and @ 07.03.2005. 23:11 ] @
Milslim da ti je nepotrebno ako vec imas "lpWindowName" ali evo probaj sa ovim :
http://kobik.videodot.net/spy_capture.asp

po0z
[ yooyo @ 07.03.2005. 23:19 ] @
Code:

GetClassName
The GetClassName function retrieves the name of the class to which the specified window belongs. 

int GetClassName(
  HWND hWnd,           // handle to window
  LPTSTR lpClassName,  // class name
  int nMaxCount        // size of class name buffer
);
Parameters
hWnd 
[in] Handle to the window and, indirectly, the class to which the window belongs. 
lpClassName 
[out] Pointer to the buffer that is to receive the class name string. 
nMaxCount 
[in] Specifies the length, in TCHARs, of the buffer pointed to by the lpClassName parameter. The class name string is truncated if it is longer than the buffer. 
Return Values
If the function succeeds, the return value is the number of TCHARs copied to the specified buffer.

If the function fails, the return value is zero. To get extended error information, call GetLastError. 


Citat:

Sta je uopste taj ClassName?


ClassName je jedinstveno ime klase neke windows kontrole. Sve kontrole su izvedene iz osnovne window klase. Sve kontrole se prave pomocu CreateWindow funkcije, koja prima parametar classname da bi se kreirao odgovarajuci objekat. Npr: CreateWindow("BUTTON",....) ce kreirati dugme a CreateWindow("LISTBOX",....) ce kreirati listbox.

yooyo
[ yokid @ 08.03.2005. 14:59 ] @
jaoj gde u c/c++ :))) Salim se.

Citat:
Milslim da ti je nepotrebno ako vec imas "lpWindowName" ali evo probaj sa ovim :
http://kobik.videodot.net/spy_capture.asp

po0z


Stvar je u tome sto ja znam/imam "lpWindowName" ali sam mislio da treba da znam i "ClassName".

Citat:
ClassName je jedinstveno ime klase neke windows kontrole. Sve kontrole su izvedene iz osnovne window klase. Sve kontrole se prave pomocu CreateWindow funkcije, koja prima parametar classname da bi se kreirao odgovarajuci objekat. Npr: CreateWindow("BUTTON",....) ce kreirati dugme a CreateWindow("LISTBOX",....) ce kreirati listbox.


Meni za gore navedeni API treba ustvari za sledece:
Primer:
Pojavi se WINAMP na ekranu, program salje neku "komandu" Winampu, primer: da automatski pusti pesmu ili nesto.
Nadam se da me razumete :)

Dali meni sada treba znati taj "ClassName" ili mi je dovoljno znati da je "lpWindowName" : "Winamp" ???
[ Aleksandar Ružičić @ 08.03.2005. 19:50 ] @
za winamp cini mi se da ide ovako:
Code:

winampHwnd = FindWindow("Winamp v1.x", vbNullString)


ovde window name mora da bude "" (u slucaju winampa) jer on menja svoj window name (tj. caption) u zavisnosti od trenutne pesme...
[ yokid @ 09.03.2005. 19:39 ] @
Pa WINAMP sam dao samo kao primer.

I dalje ne znam kako pa neka me neko spasi muka.
Nisam imao vremena da eksperimentisem ali evo direkno pitanje:

Dali ovo moze proci bez lpClassName ako znam lpWindowName?

Kako da saznam lpClassName za neki prozor ako mi nekad zatreba?
[ Aleksandar Ružičić @ 09.03.2005. 22:08 ] @
Citat:
yokid:...
Dali ovo moze proci bez lpClassName ako znam lpWindowName?...

naravno da moze proci bez njega, ali ako si 100% siguran za lpWindowName...
[ Aleksandar Ružičić @ 09.03.2005. 22:11 ] @
Get Classname:
Code:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
(ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Const SW_SHOWNORMAL = 1
Const WM_CLOSE = &H10
Const gcClassnameMSWord = "OpusApp"
Const gcClassnameMSExcel = "XLMAIN"
Const gcClassnameMSIExplorer = "IEFrame"
Const gcClassnameMSVBasic = "wndclass_desked_gsk"
Const gcClassnameNotePad = "Notepad"
Const gcClassnameMyVBApp = "ThunderForm"
Private Sub Form_Load()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    Dim WinWnd As Long, Ret As String, RetVal As Long, lpClassName As String
    'Ask for a Window title
    Ret = InputBox("Enter the exact window title:" + Chr$(13) + Chr$(10) + _
            "Note: must be an exact match")
    'Search the window
    WinWnd = FindWindow(vbNullString, Ret)
    If WinWnd = 0 Then MsgBox "Couldn't find the window ...": Exit Sub
    'Show the window
    ShowWindow WinWnd, SW_SHOWNORMAL
    'Create a buffer
    lpClassName = Space(256)
    'retrieve the class name
    RetVal = GetClassName(WinWnd, lpClassName, 256)
    'Show the classname
    MsgBox "Classname: " + Left$(lpClassName, RetVal)
    'Post a message to the window to close itself
    PostMessage WinWnd, WM_CLOSE, 0&, 0&
End Sub
[ `and @ 09.03.2005. 22:53 ] @
Moze samo sa imenom prozora, ali ako ti vec treba i ime clase onda koristi alat za koji sam ti dao link ili iskoristi "code" sto je postovao yooyo.

I preporucejem ti da skines sa neta WIN32.HLP i\ili ApiViewer, ako se vec zaludjujes time ... po0z