Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения
KANSoftWare

Получить текст заголовка определенного окна

Delphi , Программа и Интерфейс , Заголовок формы

Получить текст заголовка определенного окна

Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch

// This example will show you a faster method how you can obtain 
// the text of the specified window's title bar under Windows NT/2000 systems. 
// (c)1999 Ashot Oganesyan K, SmartLine, Inc 
// mailto:ashot@aha.ru, http://www.protect-me.com, http://www.codepile.com 

// The function copies the text of the specified window's title bar 
// (if it has one) into a buffer. The InternalGetWindowText function is 
// much faster than the documented GetWindowText because it uses INT 2E interrupt 

// NT-Specific! 
// Here is the prototype for InternalGetWindowText: 

 (*
   InternalGetWindowText(
   hWnd: HWND;  {a handle to a window or control with text}
   lpString: PChar;  {a pointer to a buffer to receive the string (UNICODE!!!)}
   nMaxCount: Integer  {the maximum number of characters to copy}
   ): Integer;  {returns the length of the copied string}
 *)


 function NT_InternalGetWindowText(Wnd: HWND): string;
 type
   TInternalGetWindowText = function(Wnd: HWND; lpString: PWideChar;
     nMaxCount: Integer): Integer;
    stdcall;
 var
   hUserDll: THandle;
   InternalGetWindowText: TInternalGetWindowText;
   lpString: array[0..MAX_PATH] of WideChar; //Buffer for window caption 
  oemStr: PChar;
 begin
   Result   := '';
   hUserDll := GetModuleHandle('user32.dll');
   if (hUserDll > 0) then
   begin @InternalGetWindowText := GetProcAddress(hUserDll, 'InternalGetWindowText');
     if Assigned(InternalGetWindowText) then
     begin
       InternalGetWindowText(Wnd, lpString, SizeOf(lpString));
       Result := string(lpString);
     end;
   end;
 end;

 procedure TForm1.Button1Click(Sender: TObject);
 begin
   ShowMessage(NT_InternalGetWindowText(Form1.Handle));
 end;

Статья Получить текст заголовка определенного окна раздела Программа и Интерфейс Заголовок формы может быть полезна для разработчиков на Delphi и FreePascal.


Комментарии и вопросы


Ваше мнение или вопрос к статье в виде простого текста (Tag <a href=... Disabled). Все комментарии модерируются, модератор оставляет за собой право удалить непонравившейся ему комментарий.

заголовок

e-mail

Ваше имя

Сообщение

Введите код




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Заголовок формы ::


реклама



©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru Rambler's Top100
24.04.2024 13:01:29/0.0048799514770508/2