hf_waj,bubble两们大侠在吗?DFW怎么没有给人留言的功能.......有点不方便吧..:( (100分)

  • 主题发起人 主题发起人 youou
  • 开始时间 开始时间
Y

youou

Unregistered / Unconfirmed
GUEST, unregistred user!
因为搜索到贴子,你们已经实现了....希望能帮个忙...<br><br>======================<br>搜索了老半天,还是没搜索到:我使任务栏中的快速启动无效,但是&gt;&gt;后的一直有效,如何也使它无效呢?<br>var<br>&nbsp;wndHandle: THandle;<br>begin<br>wndHandle := FindWindow('Shell_TrayWnd', nil);<br>wndHandle := FindWindowEx(wndHandle,0,'RebarWindow32',nil);<br>wndHandle := FindWindowEx(wndHandle,0,'Toolbarwindow32',nil);<br><br>EnableWindow(wndHandle,CheckBox1.Checked);<br>end;<br>=========<br>这个代码不会快速启动中&gt;&gt;后的无效?怎么办?请大家帮帮忙....<br>这个该如何实现?是用到钩子吗?<br><br>===============<br><br>上面的我不会,所以又想到用代替的办法..屏bi后的右边有时会出现一小块,如果shu标点<br>击时感觉有点死机的现象,希望大家copy代码..试试吧..<br><br><br>unit ut_ToolBar;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; btnRestore: TButton;<br>&nbsp; &nbsp; btnNew: TButton;<br>&nbsp; &nbsp; procedure btnNewClick(Sender: TObject);<br>&nbsp; &nbsp; procedure btnRestoreClick(Sender: TObject);<br>&nbsp; &nbsp; procedure FormDestroy(Sender: TObject);<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; &nbsp; FNewButton : Boolean; // Check whether new start button had been created.<br>&nbsp; &nbsp; procedure NewButtonMsg (Var Msg : TMessage); &nbsp;// new button events.<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br>&nbsp; OldProc, NewProc : Pointer;<br>&nbsp; ToolBarHwnd, TrayHwnd,ReBarHandle,ReplaceBtnHwnd : Hwnd;<br><br>implementation<br><br>{$R *.DFM}<br><br><br><br>procedure TForm1.btnNewClick(Sender: TObject);<br>var<br>&nbsp; Rct : TRect;<br>&nbsp; fnt : HFont;<br>begin<br>&nbsp; TrayHwnd := FindWindow('Shell_TrayWnd', nil);<br>&nbsp; ReBarHandle := FindWindowEx( TrayHwnd,0,'RebarWindow32',nil);<br>&nbsp; ToolBarHwnd := FindWindowEx(ReBarHandle,0,'ToolbarWindow32',nil);<br><br>&nbsp; // Create New Button to replace start button!<br>&nbsp; if FNewButton then Exit; &nbsp; // Don't create when new button had been created.<br><br>&nbsp; Windows.GetWindowRect(ToolBarHwnd,Rct); &nbsp; &nbsp;//获得开始按钮的矩形区域<br><br>&nbsp; ReplaceBtnHwnd := CreateWindowEx(WS_EX_WINDOWEDGE,<br>&nbsp; &nbsp; &nbsp; &nbsp;'ToolbarWindow32','Toolbar',WS_Child or WS_Visible,<br>&nbsp; &nbsp; &nbsp; &nbsp;0,0,rct.right - rct.left, Rct.bottom - Rct.top,<br>&nbsp; &nbsp; &nbsp; &nbsp;ReBarHandle,0,0,nil); &nbsp;// Create a button, which parent is windows's Tray.<br><br>&nbsp; if ReplaceBtnHwnd &gt; 0 then<br>&nbsp; begin<br>&nbsp; &nbsp; // Hide old Start button. &nbsp; &nbsp; &nbsp; HWND_BOTTOM<br>&nbsp; &nbsp; SetWindowPos(ToolBarHwnd,HWND_BOTTOM,<br>&nbsp; &nbsp; &nbsp; &nbsp;Rct.left,rct.top,rct.right - rct.left, Rct.bottom - Rct.top,<br>&nbsp; &nbsp; &nbsp; &nbsp;SWP_HIDEWINDOW {OR SWP_NOREDRAW});<br><br>&nbsp; &nbsp; // Set New button's font and caption.<br>&nbsp; &nbsp; SetWindowText(ReplaceBtnHwnd, 'Start');<br><br>&nbsp; &nbsp; fnt := CreateFont(0,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,0,0,0,0,'Time New Romans');<br>&nbsp; &nbsp; SendMessage(ReplaceBtnHwnd, WM_SETFONT,fnt,MAKELPARAM(0,0));<br>&nbsp; &nbsp; // Show New start button.<br>&nbsp; &nbsp; SetWindowPos(ReplaceBtnHwnd,HWND_TOPMOST,<br>&nbsp; &nbsp; &nbsp; &nbsp; Rct.left,rct.top,rct.right - rct.left, Rct.bottom - Rct.top,<br>&nbsp; &nbsp; &nbsp; &nbsp; SWP_NOACTIVATE); //SWP_SHOWWINDOW<br><br>&nbsp; &nbsp; ShowWindow(ReplaceBtnHwnd,SW_ShowNormal);<br><br><br>&nbsp; &nbsp; UpdateWindow(ReplaceBtnHwnd);<br><br>&nbsp; &nbsp; // To handle the new messages.<br>&nbsp; &nbsp; NewProc := Pointer(LongInt(MakeObjectInstance(NewButtonMsg)));<br><br>&nbsp; &nbsp; OldProc := Pointer(SetWindowLong(ReplaceBtnHwnd,GWL_WNDPROC,LongInt(NewProc)));<br><br>&nbsp; &nbsp; if NewProc = nil then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Showmessage('Can not grab new button''s message!');<br>&nbsp; &nbsp; &nbsp; Exit;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; FNewButton := True;<br>&nbsp; end;<br><br>end;<br><br>procedure TForm1.btnRestoreClick(Sender: TObject);<br>var<br>&nbsp; Rct: TRect;<br>begin<br>&nbsp; if FNewButton then &nbsp; &nbsp;// Restore Old Start button.<br>&nbsp; begin<br>&nbsp; &nbsp; Windows.GetWindowRect(ToolBarHwnd,Rct); &nbsp; &nbsp;//获得开始按钮的矩形区域<br>&nbsp; &nbsp; SetWindowLong(ToolBarHwnd,GWL_WNDPROC,LongInt(OldProc));<br>&nbsp; &nbsp; DestroyWindow(ReplaceBtnHwnd);<br>&nbsp; &nbsp; ReplaceBtnHwnd := 0;<br>&nbsp; &nbsp; ShowWindow(ToolBarHwnd,SW_ShowNormal);<br>&nbsp; &nbsp; SetWindowPos(ToolBarHwnd,HWND_TOPMOST,0,0,Rct.Right - Rct.Left,Rct.Bottom - Rct.Top,SWP_SHOWWINDOW);<br>&nbsp; &nbsp; FNewButton := False;<br>&nbsp; end;<br>end;<br><br>procedure TForm1.NewButtonMsg(var Msg: TMessage);<br>begin<br>&nbsp; if Msg.Msg = WM_LBUTTONUP then<br>&nbsp; &nbsp;exit<br><br>&nbsp; else<br>&nbsp; &nbsp; Msg.Result := CallWindowProc(OldProc,ReplaceBtnHwnd,Msg.msg, msg.wParam, msg.lParam);<br>end;<br><br>procedure TForm1.FormDestroy(Sender: TObject);<br>begin<br>&nbsp; if FNewButton then<br>&nbsp; &nbsp; btnRestoreClick(self); &nbsp;//Restore button when form exiting.<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>&nbsp; btnNewClick(Sender);<br>end;<br><br>end.<br>
 
大伙帮帮忙呀...我已经调了快一天了...好惨哦..:(
 
人气这么差,只好发送短消息给大家..若有打拢了请不要骂我呀.........:)
 
试了一下,感觉还可以,“感觉有点死机的现象”不常出现<br>程序上看不出来,只好关注吧。。
 
to ZRWeng:<br>嘻.up了这么久.终于有人说话句话了..谢谢..<br><br>你打开几个程序,后关掉,然后点击快速启动栏左边一点位置..就会觉得了..<br>
 
后退
顶部