Results 1 to 6 of 6

Thread: What does "GetProp" API call do?

  1. #1

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    What does "GetProp" API call do?

    What is that API call used for? I looked in PSDK but did not understand what was written there. SO can you tell me what does this "Getprop" API call do?

    Thanks
    Baaaaaaaaah

  2. #2

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Nobody knows anything about it????
    Baaaaaaaaah

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    From MSDN
    The GetProp function retrieves a data handle from the property list of the given window. The given character string identifies the handle to be retrieved. The string and handle must have been added to the property list by a previous call to the SetProp function.

    HANDLE GetProp(
    HWND hWnd, // handle of window
    LPCTSTR lpString // atom or address of string
    );

    Parameters
    hWnd
    Handle to the window whose property list is to be searched.
    lpString
    Pointer to a null-terminated character string or contains an atom that identifies a string. If this parameter is an atom, it must have been created by using theGlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word of the lpString parameter; the high-order word must be zero.
    Return Values
    If the property list contains the given string, the return value is the associated data handle. Otherwise, the return value is NULL.

  4. #4
    jim mcnamara
    Guest
    It lets you get & set arbitrary (meaning things you make up meanings for, not stuff the OS cares about.) property values

    Code:
    from allapi.net
    
    'in a module
    Declare Function GetProp Lib "user32" Alias "GetPropA" (ByVal hwnd As Long, ByVal lpString As String) As Long
    Declare Function SetProp Lib "user32" Alias "SetPropA" (ByVal hwnd As Long, ByVal lpString As String, ByVal hData As Long) As Long
    Declare Function RemoveProp Lib "user32" Alias "RemovePropA" (ByVal hwnd As Long, ByVal lpString As String) As Long
    Declare Function EnumProps Lib "user32" Alias "EnumPropsA" (ByVal hwnd As Long, ByVal lpEnumFunc As Long) As Long
    Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
    Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long
    Function PropEnumProc(ByVal hwnd As Long, ByVal lpszString As Long, ByVal hData As Long) As Boolean
        Dim Buffer As String
        'create ab buffer
        Buffer = Space(lstrlen(lpszString) + 1)
        'copy the string to the buffer
        lstrcpy Buffer, lpszString
        'show the buffer
        Form1.Print Buffer
        'continue enumeration
        PropEnumProc = True
    End Function
    'in a form
    Private Sub Form_Load()
        'KPD-Team 2000
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]
        'set the form's graphic mode to persistent
        Me.AutoRedraw = True
        'create a new property and set its value to 123
        SetProp Me.hwnd, "TestProp", 123
        'retrieve the value and show it
        MsgBox "Property Value:" + Str(GetProp(Me.hwnd, "TestProp"))
        'begin the enumeration
        EnumProps Me.hwnd, AddressOf PropEnumProc
        'remove the property
        RemoveProp Me.hwnd, "TestProp"
    End Sub

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Errrr....this is the C++ forum
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6
    jim mcnamara
    Guest
    Mea culpa. woops sorry.

    Answered about 10 VB questions, got locked into VB mode.

    heh. You think this is bad. I once wrote a whole block of Macro (assembler) right into the middle of a Fortran routine. It had a lot of trouble compiling....



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width