怎么在Delphi的IDE界面上放上自己的按钮。。。基本解决 (200分)

  • 主题发起人 主题发起人 savenight
  • 开始时间 开始时间
S

savenight

Unregistered / Unconfirmed
GUEST, unregistred user!
(分数只给提供关键答案的人-----赏罚分明[:D][:D][:D])
基本已经解决了:
GreenLight说的 “首先用ToolApi的接口,加到菜单上,然后在菜单栏上点右键,
选Customize,在Command栏中将该命令托到快捷栏就行了” 只要看GExperts的源码
就可以实现,另外我在codecentral.borland.com找到了在IDE增加一个Toolbar的源码,
可以看下面。
 
注意不是控件栏上的,而是像“新建“,“运行”这样的按钮。
 
看看gxpert的源码,不知borland留接口了没有[?]
 
gxcooo:
好像上次在别人的帖子里你也是这样回答的。。。
 
关注,也学点新东西!
 
似乎ToolAPI管这事?
 
今日无高手? 算了,不等了,明天再来吧。[:(]
 
关注,学点东西!
 
I am waiting, I am waiting,
till the night comes,
till supper comes,
I will eating,I will eating,
till old hand comes,
till savior comes,
...
 
实现加到菜单里,点击Unit中出现文字了,但是怎样作为一个按钮加到IDE上还是没办法。

unit EditUnit;
interface
uses ToolsAPI, windows, messages;
type
TEditUnit = class(TNotifierObject, IOTAMenuWizard, IOTAWizard)
public
function GetIDString: string;
function GetName: string;
function GetState: TWizardState;
procedure Execute;
function GetMenuText: string;
end;

function EnumerateChildWindows(hWnd: HWND; lParam: LPARAM): BOOL; stdcall;

procedure Register;

var
UnitHandle: hwnd;
implementation

uses Dialogs;

procedure Register;
begin
RegisterPackageWizard(TEditUnit.Create);
end;
//自定义的函数
/////////////////////////////////////////////////////

procedure sendkey(focushld: hwnd; ssend: string);
var
i: integer;
ch: byte;
begin
i := 1;
while i <= length(ssend) do
begin
ch := byte(ssend);
if windows.isDBCSLeadByte(ch) then
begin
inc(i);
sendmessage(focushld, WM_IME_CHAR, makeword(byte(ssend), ch), 0);
end
else
sendmessage(focushld, WM_IME_CHAR, word(ch), 0);
inc(i);
end;
PostMessage(focushld,WM_KEYDOWN,VK_RETURN,0);

end;
/////////////////////////////////////////////////////

function EnumerateChildWindows(hWnd: HWND; lParam: LPARAM): BOOL;
var
ClassName: array[0..255] of char; // this holds the class name of our child windows
begin
{get the class name of the given child window}
GetClassName(hWnd, ClassName, 255);
if ClassName = 'TEditControl' then
UnitHandle := hWnd;
{continue enumeration}
Result := TRUE;
end;
/////////////////////////////////////////////////////

procedure TEditUnit.Execute;
var
FoundWindow: hwnd;
begin
FoundWindow := FindWindowEx(0, 0, 'TEditWindow', nil);
{enumerate all child windows belonging to Form1}
EnumChildWindows(FoundWindow, @EnumerateChildWindows, 0);
if UnitHandle <> 0 then
begin
SetForegroundWindow(UnitHandle);
sendkey(UnitHandle, '//hello, welcome to delphibbs.com ! ');
keybd_event(vk_return, 1, 0, 0);
end
else
showmessage('can''t find UnitHandle,sorry sir.');
end;

function TEditUnit.GetIDString: string;
begin
Result := 'Save night';
end;

function TEditUnit.GetMenuText: string;
begin
Result := '&Save night';
end;

function TEditUnit.GetName: string;
begin
Result := 'Save night';
end;

function TEditUnit.GetState: TWizardState;
begin
Result := [wsEnabled];
end;
end.

 
you are on the wrong way
 
hubdog:
sure, frankly ,I know it should be resolved by OTA,but limited knowledge about it...
help me[:(]
 
加到IDE的菜单中就行了嘛,干吗偏要加到工具栏,[:)]
 
小人物:
重在技巧,而非结果[:D]
 
后退
顶部