Einzelnen Beitrag anzeigen

flotschie

Registriert seit: 3. Jul 2004
8 Beiträge
 
#1

Anfängerfrage: InternalGetWindowText verwenden

  Alt 3. Jul 2004, 00:19
hallo,

also ich bin zwar kein delphi programmierer aber ich ich glaube meine frage kann ich auch hier stellen:

es gibt in der windows API die Funktion

Code:
int InternalGetWindowText(HWND hWnd,
    LPWSTR lpString,
    int nMaxCount
);
die einen Text liefern soll (von mir auch kann man hier auch GetWindowText verwenden )

Anfängerfrage: Wie man sehen kann liefert diese Funktion einen integer wert zurück und keinen string! Das versteh ich nicht ganz....

Wenn ich ein Code-Beispiel für vb verwende, nämlich

Code:
Dim textlen As Long ' receives length of text of the window
Dim wintext As String ' receives the text of the window
Dim slength As Long ' receives the length of the returned string

' Find out how many characters are in the window's text.
' Add 1 to compensate for the terminating null.
textlen = GetWindowTextLength(Form1.hWnd) + 1
' Make sufficient room in the buffer.
wintext = Space(textlen)
' Retrieve the text of window Form1.
slength = GetWindowText(Form1.hWnd, wintext, textlen)
' Remove the empty space from the string, if any.
wintext = Left(wintext, slength)
' Display the result.
Debug.Print "The title bar of window Form1 is: "; wintext

funktionierts bei mir nicht weil ich VB.NET programmiere und es da keine Left Anweisung mehr gibt - aber an dem solls nicht scheitern. Überhaupt liefert mir ja fast jede API funktion einen integer oder long wert zurück, auch wenn man strings haben will. Wie bekomme ich denn nun meinen string?
  Mit Zitat antworten Zitat