自己写的组件的安装问题!!!!!!!!(50分)

  • 主题发起人 主题发起人 cooldeer
  • 开始时间 开始时间
C

cooldeer

Unregistered / Unconfirmed
GUEST, unregistred user!
[:(]我自己写了一个控件,安装后显示have registered, 但在控件面板上不显示,
在控件面板上点右键,选properties,在palette properties中可以看到。
这是怎么回事呀?我用的是delphi6。是不是delphi有问题呢? 谢谢!!!!!!!
 
装到哪个包里了?
你试试看引用你的pas,然后动态创建,
如果能够正常使用的话就说明控件没问题.
 
安装在dclusr.dpk中
 
关键要看安装到哪个页去了
 
源码如下,各位高手帮忙看看。
unit QSelectDirectoryDialog;

interface

uses
Windows, Messages, SysUtils, Classes, QDialogs,shlobj,ActiveX,Forms;

type
TSelectDirectoryDialog = class(tdialog)
private
FCaption: String;
FDirectory: String;
FRoot: WideString;
{ Private declarations }
function BrowseCallbackProc(Handle: HWND; uMsg: UINT; lParam: Cardinal;
lpData: Cardinal): integer; stdcall;
function SelectDirectoryEx(const Caption: string; const Root: WideString;
out Directory: string): Boolean;
procedure SetCaption(const Value: String);
procedure SetDirectory(const Value: String);
procedure SetRoot(const Value: WideString);
protected
{ Protected declarations }
public
{ Public declarations }
property Directory: String read FDirectory write SetDirectory;
function Execute: Boolean;override;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
property Caption: String read FCaption write SetCaption;
property Root: WideString read FRoot write SetRoot;
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Samples', [TSelectDirectoryDialog]);
end;

{ TSelectDirectoryDialog }
procedure TSelectDirectoryDialog.SetCaption(const Value: String);
begin
FCaption := Value;
end;

procedure TSelectDirectoryDialog.SetDirectory(const Value: String);
begin
FDirectory := Value;
end;

procedure TSelectDirectoryDialog.SetRoot(const Value: WideString);
begin
FRoot := Value;
end;
function TSelectDirectoryDialog.BrowseCallbackProc(Handle: HWND;
uMsg: UINT; lParam, lpData: Cardinal): integer;
var
dirbuf: array[0..Max_Path-1] of Char;
begin
Result := 0;
if uMsg = BFFM_INITIALIZED then
begin
if GetCurrentDirectory(Max_path,@dirbuf) > 0 then
// WParam is TRUE since you are passing a path.
// It would be FALSE if you were passing a pidl.
SendMessage(Handle,BFFM_SETSELECTION,1,LongInt(@Dirbuf));
end
else if uMsg = BFFM_SELCHANGED then
begin

// Set the status window to the currently selected path.
if SHGetPathFromIDList(PItemIDList(lParam) ,@Dirbuf) then
SendMessage(Handle,BFFM_SETSTATUSTEXT,0,LongInt(@Dirbuf));
end;
end;


constructor TSelectDirectoryDialog.Create(AOwner: TComponent);
begin
inherited Create(Aowner);

end;

destructor TSelectDirectoryDialog.Destroy;
begin

inherited Destroy;
end;



function TSelectDirectoryDialog.SelectDirectoryEx(const Caption: string;
const Root: WideString; out Directory: string): Boolean;
var
WindowList: Pointer;
BrowseInfo: TBrowseInfo;
Buffer: PChar;
RootItemIDList, ItemIDList: PItemIDList;
ShellMalloc: IMalloc;
IDesktopFolder: IShellFolder;
Eaten, Flags: LongWord;
begin
Result := False;
Directory := '';
FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);
if (ShGetMalloc(ShellMalloc) = S_OK) and (ShellMalloc <> nil) then
begin
Buffer := ShellMalloc.Alloc(MAX_PATH);
try
RootItemIDList := nil;
if Root <> '' then
begin
SHGetDesktopFolder(IDesktopFolder);
IDesktopFolder.ParseDisplayName(Application.Handle, nil,
POleStr(Root), Eaten, RootItemIDList, Flags);
end;
with BrowseInfo do
begin
hwndOwner := Application.Handle;
pidlRoot := RootItemIDList;
pszDisplayName := Buffer;
lpszTitle := PChar(Caption);
ulFlags := BIF_RETURNONLYFSDIRS+16 or BIF_RETURNONLYFSDIRS+64 or BIF_STATUSTEXT;//包含 BIF_STATUSTEXT
lpfn := @TSelectDirectoryDialog.BrowseCallbackProc; //回调函数
end;
WindowList := DisableTaskWindows(0);
try
ItemIDList := ShBrowseForFolder(BrowseInfo);
finally
EnableTaskWindows(WindowList);
end;
Result := ItemIDList <> nil;
if Result then
begin
ShGetPathFromIDList(ItemIDList, Buffer);
ShellMalloc.Free(ItemIDList);
Directory := Buffer;
end;
finally
ShellMalloc.Free(Buffer);
end;
end;
end;

function TSelectDirectoryDialog.Execute: Boolean;
var TempDirect: string;
begin
result:=SelectDirectoryEx(Caption,Root,TempDirect);
SetDirectory(TempDirect);
end;


end.
 
去'Samples'下面找啦
 
to pipi:
找不到.在samples页看不见.
但在palette properties中的samples部分可以看到.
 
TDialog是什么东西啊,你继承它,它如果是个form好象是不行的
 
Tdialog 是对话框类呀。
 
你的类的父类不是一个设计态可视化控件!所以当然不行
你看过RXLIB一套的控件么?它有几个DIALOG控件,但它们都是直接从控件类继承的
我觉得如果你时间多,自己侃侃它们的代码,重新继承以下
如果不多,就动态创建你的控件类的实例//也就是运行态
 
接受答案了.
 
后退
顶部