Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "WinAPI";
Текущий архив: 2004.03.14;
Скачать: [xml.tar.bz2];

Вниз

Прилипание формы   Найти похожие ветки 

 
DenisWW   (2004-01-08 16:37) [0]

Вопрос в процедуре EnumWindowsProc

private
procedure WMWINDOWPOSCHANGING(var Msg: TWMWINDOWPOSCHANGING);message WM_WINDOWPOSCHANGING;
procedure WMWINDOWSIZING(var Msg: TMessage);message WM_SIZING ;
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
Const
StickAt:Word=10;

function EnumWindowsProc(hwnd:HWND;lParam:LPARAM):bool; stdcall;

implementation
uses Types, Unit2;
{$R *.dfm}

Var
WorkArea:array of TRect;
SizingForm:Boolean;

function EnumWindowsProc(hwnd:HWND;lParam:LPARAM):bool; stdcall;
begin
if IsWindowVisible(hwnd)and(hwnd<>Form1.Handle) then begin
SetLength(WorkArea,Length(WorkArea)+1);
GetWindowRect(hwnd,WorkArea[Length(WorkArea)-1]);

//вот здесь я получаю список всех окон на экране(их координаты)
//присутсвует всегда координаты центра экрана
//какой handle этого обьекта????????????????????????
end;
Result:=True;
end;

procedure TForm1.WMWindowPosChanging(var Msg: TWMWindowPosChanging);
Var I:Integer;
begin
SetLength(WorkArea,0);EnumWindows(@EnumWindowsProc,LPARAM(Nil));
For I:=0 To Pred(Length(WorkArea)) Do with WorkArea[I],Msg.WindowPos^ do Begin
if abs(Left-x)<=StickAt then Begin
If SizingForm Then cx:=x+cx-Left;x:=Left End;
if abs(Right-x)<=StickAt then Begin
If SizingForm Then cx:=x+cx-Right;x:=Right End;
if abs(Top-y)<=StickAt then Begin
If SizingForm Then cy:=y+cy-Top;y:=Top End;
if abs(Bottom-y)<=StickAt then Begin
If SizingForm Then cy:=y+cy-Bottom;y:=Bottom End;
if abs(Right-cx-x)<=StickAt then Begin
If SizingForm Then cx:=Right-x;x:=Right-cx End;
if abs(Left-cx-x)<=StickAt then Begin
If SizingForm Then cx:=Left-x;x:=Left-cx End;
if abs(Bottom-cy-y)<=StickAt then Begin
If SizingForm Then cy:=Bottom-y;y:=Bottom-cy End;
if abs(Top-cy-y)<=StickAt then Begin
If SizingForm Then cy:=Top-y;y:=Top-cy End
End;
If Msg.WindowPos^.Flags=0 Then SizingForm:=False;
inherited;
end;

procedure TForm1.WMWINDOWSIZING(var Msg: TMessage);
begin
SizingForm:=True;
inherited;
end;


 
DenisWW   (2004-01-08 16:46) [1]

Что за обьект то ?


 
Игорь Шевченко   (2004-01-08 16:47) [2]


> function EnumWindowsProc(hwnd:HWND;lParam:LPARAM):bool;
> stdcall;
> begin
> if IsWindowVisible(hwnd)and(hwnd<>Form1.Handle) then begin
> SetLength(WorkArea,Length(WorkArea)+1);
> GetWindowRect(hwnd,WorkArea[Length(WorkArea)-1]);
>


> //вот здесь я получаю список всех окон на экране(их координаты)
> //присутсвует всегда координаты центра экрана
> //какой handle этого обьекта????????????????????????

hwnd :)


 
DenisWW   (2004-01-08 17:29) [3]

непонял
EnumWindowsProc добавляет говорит что
присутствуют два Handle
с координатами left 512 top 384 right 512 buttom 384
при разрешении экрана 1024\768
тоесть 2а центра экрана
таких окон на экране нет
что это за обьекты и как получить их Handle?



Страницы: 1 вся ветка

Форум: "WinAPI";
Текущий архив: 2004.03.14;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.011 c
3-43296
hva
2004-02-11 15:30
2004.03.14
Как перехватить TClientDataSet.CommandText


14-43876
wicked
2004-02-24 17:34
2004.03.14
Новый вирус?


1-43574
Delph
2004-02-27 16:29
2004.03.14
Alignment и TEdit


14-43814
Soft
2004-02-20 23:37
2004.03.14
Принципы эзотерического подхода к литературе.


3-43349
Drozdov A
2004-02-16 14:13
2004.03.14
Select * from table1 order by pole1





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский