起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 143|回复: 1

[请求]怎么解决下面的错误?**

[复制链接]
发表于 2009-5-12 09:21:30 | 显示全部楼层 |阅读模式
unit WZWSTXJK;

interface

uses
  Business.System.CommCtrl,Business.System, Business.Forms,Borland.Delphi.Messages,
  Borland.Delphi.Windows;

type
  TWZWSTXJK = class(TForm)
    Image1: TImage;
    Timer1: TTimer;
    Shape1: TShape;
    procedure Timer1Timer(Sender: TObject);
  private
    {private declarations}
  public
    {public declarations}
  end;
  const
    TTS_BALLOON    = $40;
    TTM_SETTITLE = (WM_USER + 32);

  var
    hTooltip: Cardinal;
    ti: TToolInfo;
    buffer : array  of char;

implementation
{static function CreateWindowEx(dwExStyle: Longword; lpClassName: string; lpWindowName: string;
dwStyle: Longword; X: Longint; Y: Longint; nWidth: Longint; nHeight: Longint; hWndParent:
Longword; hMenu: Longword; hInstance: Longword; lpParam: Business.System.TObject): }

procedure CreateToolTips(hWnd: Cardinal);
begin
  hToolTip := CreateWindowEx(0, 'Tooltips_Class32', nil, TTS_ALWAYSTIP or TTS_BALLOON,
   Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT),Integer(CW_USEDEFAULT),
   Integer(CW_USEDEFAULT), hWnd, 0, hInstance, nil);
if hToolTip <> 0 then
   begin
     SetWindowPos(hToolTip, HWND_TOPMOST, 0,0, 0, 0, SWP_NOMOVE or  SWP_NOSIZE or SWP_NOACTIVATE);
     ti.cbSize := SizeOf(TToolInfo);
     ti.uFlags := TTF_SUBCLASS or TTF_TRANSPARENT;
     ti.hInst := hInstance;
   end;
end;

procedure AddToolTip(hwnd: dword; lpti: PToolInfo; IconType: Integer; Text, Title: PChar;
BackColor,TextColor:TColor);
//BackColor,TextColor分别是背景颜色和文本颜色,如果是0则取默认值.
var
  Rect: TRect;
begin
  SetLength(buffer,255);
  if (hwnd <> 0) AND (GetClientRect(hwnd, Rect)) then
    begin
      lpti.hwnd := hwnd;
      lpti.Rect := Rect;
      lpti.lpszText := Text;
      SendMessage(hToolTip, TTM_ADDTOOL, 0, Integer(lpti));
      FillChar(buffer, sizeof(buffer), #0);
      lstrcpy(buffer, Title);
      if (IconType > 3) or (IconType < 0) then IconType := 0;
      if BackColor<>0 then SendMessage(hToolTip, TTM_SETTIPBKCOLOR, BackColor, 0);
      if TextColor<>0 then SendMessage(hToolTip, TTM_SETTIPTEXTCOLOR, TextColor, 0);
     // SendMessage(hToolTip, TTM_SETTITLE, IconType, Integer(@buffer));
    end;
end;

procedure TWZWSTXJK.Timer1Timer(Sender: TObject);
begin
//
end;

end.

[错误]Biz:\SPACE_SYGLXXXT\FOLDER_YWZX\TXGL\WZWS\WZWSJK.FUNC.DIR\WZWSTXJK.Form.pas(38, 37): Undeclared identifier "hInstance"
[错误]Biz:\SPACE_SYGLXXXT\FOLDER_YWZX\TXGL\WZWS\WZWSJK.FUNC.DIR\WZWSTXJK.Form.pas(44, 18): Undeclared identifier "hInstance"
[错误]Biz:\SPACE_SYGLXXXT\FOLDER_YWZX\TXGL\WZWS\WZWSJK.FUNC.DIR\WZWSTXJK.Form.pas(60, 53): Incompatible types: "Int32" and "tagTOOLINFOA*"
[错误]Biz:\SPACE_SYGLXXXT\FOLDER_YWZX\TXGL\WZWS\WZWSJK.FUNC.DIR\WZWSTXJK.Form.pas(61, 7): Undeclared identifier "FillChar"
[错误]Biz:\SPACE_SYGLXXXT\FOLDER_YWZX\TXGL\WZWS\WZWSJK.FUNC.DIR\WZWSTXJK.Form.pas(62, 15): Incompatible types: "String" and "Char[]"
回复

使用道具 举报

发表于 2009-5-12 09:48:00 | 显示全部楼层
你这个功能最好用第三方控件的形式引入进平台。windowsapi里面太多的指针操作。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-21 06:30 , Processed in 0.037373 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表