AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Move taskbar

Ein Thema von Razor · begonnen am 30. Jan 2009 · letzter Beitrag vom 2. Feb 2009
Antwort Antwort
Seite 1 von 2  1 2      
Razor
(Gast)

n/a Beiträge
 
#1

Move taskbar

  Alt 30. Jan 2009, 18:59
Ok here we go i want to move the whole taskbar from 1280x30 cordinates(found by winspy 2008) to about 1280x80.But it looks like its not working i can change other stuff like tray,running applications etc.But not whole taskbar.Explain what i am doing wrong.


I currently got this code but it changes size of
Delphi-Quellcode:
var
  MyHandle: THandle;
  WinRect: TRect;
begin
MoveWindow(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, '', nil),
             1280, 80, 80, 22, true);
  Mit Zitat antworten Zitat
ken_jones

Registriert seit: 16. Mai 2005
Ort: Luzern
154 Beiträge
 
Delphi 10 Seattle Enterprise
 
#2

Re: Move taskbar

  Alt 30. Jan 2009, 20:14
I'm not sure if your code snippet really finds the taskbar...
Take a look at this code (part of amaTaBaSo, OpenSource, use DelphiPraxis Search to locate the whole Sourcecode):

Delphi-Quellcode:
function GetToolbarWindowHandle:HWND;
var
 hDesktop : HWND;
 hTray : HWND;
 hReBar : HWND;
 hTask : HWND;
 hToolbar : HWND;
begin
  hDesktop := GetDesktopWindow;

  hTray := FindWindowEx( hDesktop, 0, 'Shell_TrayWnd', nil );

  hReBar := FindWindowEx( hTray, 0, 'ReBarWindow32', nil );

  hTask := FindWindowEx( hReBar, 0, 'MSTaskSwWClass', nil );

  hToolbar := FindWindowEx( hTask, 0, 'ToolbarWindow32', nil );

  if ( hToolbar = 0 ) then
    MessageDlg(
      'Taskbar konnte nicht gefunden werden',
      mtError,
      [mbOK],
      0);

  Result := hToolbar;
end;
  Mit Zitat antworten Zitat
Razor
(Gast)

n/a Beiträge
 
#3

Re: Move taskbar

  Alt 31. Jan 2009, 15:45
Okay i've found a complete solution by myself using my knowledge however,the code is still not perfect.Can anybody tell me how to erase background of a window via his handle.

Btw i need this for a sidebar if anybody is interested why so much stuff.I want icons on my sidebar.


Delphi-Quellcode:
procedure TForm3.Button1Click(Sender: TObject);
var
myhandle:hwnd;
handle2:hwnd;
handle3:hwnd;
begin



myhandle:=FindWindowEx(FindWindow('shell_traywnd', nil), 0, 'traynotifywnd', nil) ;
if myhandle>0 then begin
windows.SetParent(myhandle,0);
MoveWindow(myhandle,0, -9,TaskBarwidth(myhandle), TaskBarheight(myhandle), true)
       end
   else
showmessage('wont work handle is zero');
end;
Miniaturansicht angehängter Grafiken
untitled_554.jpg  
  Mit Zitat antworten Zitat
Razor
(Gast)

n/a Beiträge
 
#4

Re: Move taskbar

  Alt 31. Jan 2009, 18:25
Somebody?I am sorry to bump but atleast give me a feedback.If am going the right way..
  Mit Zitat antworten Zitat
quendolineDD

Registriert seit: 19. Apr 2007
Ort: Dresden
781 Beiträge
 
Turbo Delphi für Win32
 
#5

Re: Move taskbar

  Alt 1. Feb 2009, 05:51
#2 has all answers you're needing to deal with it.
In your code you're just moving the tray around, leaving all others at their place.
Lars S.
Wer nicht mit der Zeit geht, geht mit der Zeit.
  Mit Zitat antworten Zitat
Razor
(Gast)

n/a Beiträge
 
#6

Re: Move taskbar

  Alt 1. Feb 2009, 10:49
i need to remove the taskbar so its transparent is it possible?
  Mit Zitat antworten Zitat
mr_emre_d
(Gast)

n/a Beiträge
 
#7

Re: Move taskbar

  Alt 1. Feb 2009, 15:00
i dont get it, whats your problem exactly ?

do you want to remove the taskbar or just adjust the size of it ?

for removing(making it invisible) use this:
Delphi-Quellcode:
procedure ShowShellTrayWindow(Show: Boolean);
begin
  ShowWindow( FindWindow( 'shell_traywnd', 0 ), Integer(Show) );
end;
for makin it transparent:
Delphi-Quellcode:
procedure TransparentTrayWindow(Percent: Byte);
var
  hWnd: Cardinal;
begin
  hWnd := FindWindow( 'shell_traywnd', 0 );
  if Percent in [1..100] then
  begin
    SetWindowLong( hWnd, GWL_EXSTYLE,
      GetWindowLong( hWnd, GWL_EXSTYLE ) or WS_EX_LAYERED );
    SetLayeredWindowAttributes( hWnd, 0, Round($FF/$64*Percent), LWA_ALPHA );
  end;
end;
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#8

Re: Move taskbar

  Alt 1. Feb 2009, 15:37
What are we talkig about now? Moving the taskbar or erasing a window's background?
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
Razor
(Gast)

n/a Beiträge
 
#9

Re: Move taskbar

  Alt 1. Feb 2009, 22:21
I erased the background so thats done.We are talking about moving.

I got it in X=1280 in Y=0 but cant move it anywhere else.
I can't move it anywhere why is that??

Delphi-Quellcode:
unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm3 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    Edit2: TEdit;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Timer1: TTimer;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

{$R *.dfm}


 function TaskBarwidth(handle:hwnd): integer;
var
  hTB: HWND; // taskbar handle
  TBRect: TRect; // taskbar rectangle
begin
  hTB:= handle;
  if hTB = 0 then
    Result := 0
  else begin
    GetWindowRect(hTB, TBRect);
    Result := TBRect.Left- TBRect.Right;
  end;
end;



function TaskBarHeight(handle:hwnd): integer;
var
  hTB: HWND; // taskbar handle
  TBRect: TRect; // taskbar rectangle
begin
  hTB:= handle;
  if hTB = 0 then
    Result := 0
  else begin
    GetWindowRect(hTB, TBRect);
    Result := TBRect.Bottom - TBRect.Top;
  end;
end;




procedure TForm3.Button1Click(Sender: TObject);
var
myhandle:hwnd;
handle2:hwnd;
handle3:hwnd;
begin



myhandle:=FindWindow('shell_traywnd', nil);

if myhandle>0 then

MoveWindow(myhandle,strtoint(edit1.Text), strtoint(edit2.Text),TaskBarwidth(myhandle), TaskBarheight(myhandle), true)

else
showmessage('wont work handle is zero');
end;


procedure TForm3.Button2Click(Sender: TObject);
var
myhandle:hwnd;
begin
myhandle:=FindWindowEx(FindWindow('shell_traywnd', nil), 0, 'traynotifywnd', nil) ;
windows.SetParent(myhandle,0);
end;

procedure TForm3.Timer1Timer(Sender: TObject);
var
miska:tmouse;
begin

  label3.Caption:=inttostr(miska.CursorPos.X);
  label4.Caption:=inttostr(miska.CursorPos.y);
end;

end.
  Mit Zitat antworten Zitat
Razor
(Gast)

n/a Beiträge
 
#10

Re: Move taskbar

  Alt 1. Feb 2009, 23:03
Sorry again,after i setparent(myhandle,0) i can't really move the window anymore why is that?
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:01 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz