Reading window title from external app

Hello guys, Can you tell me which function you are using to create your Gui, cause I never manage to catch the full main windows title. I am developping an automatic tagger program in early stage at the moment it works in a standalone mode for now but I need to catch the full filename of the actual selected file. There is no hotkey assigned for file properties and I don't want to force users to add an extra tag containing the filemane ( which would be a pain in the b...on the user side).

In summary your window title gets truncated when calling GetWindowTextW with a returned string set to 1024 bytes ( or 2048 if unicode).

Thank you.

I'm just using SetWindowText, nothing special.

You call getwindowtextlength frist?
You set up your recieve Buffer correctly? (remember, doublebyte per char on unicode)
You read hint's at msdn?

Get/SetWindowText/Length in all current unicode languages call W functions.

GetWindowText will return the same trunctated length. the exact same length with getwindowtextlength, and of course I've set the Lptrstring capacity to 1024 combined to IsWindowUnicode().

and of course I did read the manual and always did it since I first starting coding on z80 aged of 8 then 68k and so on. When You had coded on a commodore Amiga, you know those things.

Just to be sure are you creating the window using this ? :

  return DefWindowProcW(hWnd, uMsg, wParam, lParam);  
  return DefWindowProcA(hWnd, uMsg, wParam, lParam);

depending on this answer, this would be my last attempt,
 I am using my own tag reading function and audiogenie.dll  as well . Not only targetting win32 code so mp3tag is not essential for my project.


well, comodore and amiga don't know about multibyte strings - same as my early DOS versions running on my old 80286 :wink:
Didn't like to diss you :wink:

Just to find out what's going wrong:

Did you try to read windowtext inside an simple byte/char buffer array to verify if you really don't receive full text or may be a problem of your buffer datatype.
Check if received string is null byte terminated.

Try something like that (tested with winamp, working fine)
set up an buffer
array[0.. length * sizeof(char) + 1] of byte
array[0.. length + 1] of char

Receive WindowText to @buf[0]
Copy (Decode) from buffer to string using an Encoding class