TC官方合作论坛

 找回密码
 立即注册
查看: 294|回复: 3
打印 上一主题 下一主题

[讨论] 界面

[复制链接]
跳转到指定楼层
楼主
发表于 2015-6-2 17:45:35 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
大部分的游戏登陆器是嵌套的网页来做界面研究大半天了

终于搞出来了
过些日子抽时间研究TC的写法
然后就可以把界面完全使用简单华丽的HTML了


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

沙发
 楼主| 发表于 2015-6-2 20:10:05 | 只看该作者
本帖最后由 q273814 于 2015-6-2 20:12 编辑

  1. unit Unit2;
  2. interface
  3. uses Windows, Classes;
  4. type
  5. TDHTMLEvent = class (TObject, IUnknown, IDispatch)
  6. private
  7. FRefCount: Integer;
  8. FOldEvent: IDispatch;
  9. FElementEvent: TNotifyEvent;
  10. // IUnknown
  11. function QueryInterface(c**t IID: TGUID; out Obj): Integer; stdcall;
  12. function _AddRef: Integer; stdcall;
  13. function _Release: Integer; stdcall;
  14. // IDispatch
  15. function GetTypeInfoCount(out Count: Integer): HResult; stdcall;
  16. function GetTypeInfo(Index, LocaleID: Integer; out TypeInfo): HResult; stdcall;
  17. function GetIDsOfNames(c**t IID: TGUID; Names: Pointer;
  18. NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; stdcall;
  19. function Invoke(DispID: Integer; c**t IID: TGUID; LocaleID: Integer;
  20. Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult; stdcall;
  21. public
  22. { Public declarati** }
  23. function HookEventHandler(CallerHandler: TNotifyEvent): IDispatch;
  24. property ElementEvent: TNotifyEvent read FElementEvent write FElementEvent;
  25. end;
  26. implementation
  27. { TDHTMLEvent }
  28. function TDHTMLEvent._AddRef: Integer;
  29. begin
  30. Inc(FRefCount);
  31. Result := FRefCount;
  32. end;
  33. function TDHTMLEvent._Release: Integer;
  34. begin
  35. Dec(FRefCount);
  36. Result := FRefCount;
  37. end;
  38. function TDHTMLEvent.GetIDsOfNames(c**t IID: TGUID; Names: Pointer;
  39. NameCount, LocaleID: Integer; DispIDs: Pointer): HResult;
  40. begin
  41. if FOldEvent <> nil then
  42. Result := FOldEvent.GetIDsOfNames(IID, Names, NameCount, LocaleID, DispIDs)
  43. else
  44. Result := E_NOTIMPL;
  45. end;
  46. function TDHTMLEvent.GetTypeInfo(Index, LocaleID: Integer;
  47. out TypeInfo): HResult;
  48. begin
  49. if FOldEvent <> nil then
  50. Result := FOldEvent.GetTypeInfo(Index, LocaleID, TypeInfo)
  51. else begin
  52. Pointer(TypeInfo) := nil;
  53. Result := E_NOTIMPL;
  54. end
  55. end;
  56. function TDHTMLEvent.GetTypeInfoCount(out Count: Integer): HResult;
  57. begin
  58. if FOldEvent <> nil then
  59. Result := FOldEvent.GetTypeInfoCount(Count)
  60. else begin
  61. Count := 0;
  62. Result := S_OK;
  63. end;
  64. end;
  65. function TDHTMLEvent.QueryInterface(c**t IID: TGUID; out Obj): Integer;
  66. begin
  67. if GetInterface(IID, Obj) then
  68. Result := S_OK
  69. else
  70. Result := E_NOINTERFACE;
  71. end;
  72. function TDHTMLEvent.Invoke(DispID: Integer; c**t IID: TGUID;
  73. LocaleID: Integer; Flags: Word; var Params; VarResult, ExcepInfo,
  74. ArgErr: Pointer): HResult;
  75. begin
  76. try
  77. if Assigned(FElementEvent) then FElementEvent(Self);
  78. finally
  79. if FOldEvent <> nil then
  80. Result := FOldEvent.Invoke(DispID, IID, LocaleID, Flags, Params,
  81. VarResult, ExcepInfo, ArgErr)
  82. else
  83. Result := E_NOTIMPL;
  84. end;
  85. end;
  86. function TDHTMLEvent.HookEventHandler(CallerHandler: TNotifyEvent): IDispatch;
  87. begin
  88. FOldEvent:=nil;
  89. ElementEvent:=CallerHandler;
  90. Result:=Self;
  91. end;
  92. end.
复制代码
回复 支持 反对

使用道具 举报

板凳
 楼主| 发表于 2015-6-2 20:12:58 | 只看该作者
本帖最后由 q273814 于 2015-6-2 20:14 编辑

复制代码
回复

使用道具 举报

地板
发表于 2015-6-3 07:59:32 | 只看该作者
腻害
回复

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /2 下一条

关闭

小黑屋|TC官方合作论坛 (苏ICP备18043773号

GMT+8, 2025-9-22 20:27 , Processed in 0.180867 second(s), 23 queries .

Powered by 海安天坑软件科技有限公司

© 2001-2013 Comsenz Inc.

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