Поддержка / Donate
 

WebMoney

Яндекс.Деньги

SMS.Копилка
Деньги@Mail.ru
Rupay
E-gold
PayPal

 

Благодарю за поддержку!

Лента RSS - Новости сайта Новости сайта
Лента RSS - Новости форума Новости форума
Добавить в закладки и поделиться Bookmark and Share

 

Архив исходников

 


Automatic translation

 
English German French
Italian Spanish Portuguese
Greece Japan Chinese
  Korean  

  

 

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Google  
 

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

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

{ 
  At times, it is necessary to get a handle (HWND) to the shell's main window. 
  MSDN offers us next method: 

   hwndShell := FindWindow('Progman', nil); 

  It seems to be a simple code but I've found much better solution. 
  The User32.dll has one more useful and of course 
  undocumented function - GetShellWindow! 
}

 // This example will show you how you can obtain a handle to the 
// Windows Shell window without calling the FindWindow function. 
// Translated from C to Delphi by Thomas Stutz 
// Original Code: 
// (c)1999 Ashot Oganesyan K, SmartLine, Inc 
// mailto:ashot@aha.ru, http://www.protect-me.com, http://www.codepile.com 


// This function returns a handle to the Windows Shell window 
function ShellWindow: HWND;
 type
   TGetShellWindow = function(): HWND; stdcall;
 var
   hUser32: THandle;
   GetShellWindow: TGetShellWindow;
 begin
   Result := 0;
   hUser32 := GetModuleHandle('user32.dll');
   if (hUser32 > 0) then
   begin
     @GetShellWindow := GetProcAddress(hUser32, 'GetShellWindow');
     if Assigned(GetShellWindow) then
     begin
       Result := GetShellWindow;
     end;
   end;
 end;

 procedure TForm1.Button1Click(Sender: TObject);
 var
   hShellWindow: Hwnd;
   strWinText: array[0..260] of char;
 begin
   hShellWindow := ShellWindow;
   if hShellWindow <> 0 then
   begin
     GetWindowText(ShellWindow, strWinText, 255);
     ShowMessage(strWinText);
   end;
 end;



Источник - Проект "Delphi World" © Выпуск 2002 - 2004
Автор проекта: Акулов Николай



   Rambler's Top100             Яндекс цитирования