掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
コールバック関数からクラスメンバにアクセスするには? (ID:31611)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
他人の作ったDLLを簡単に使えるようにコンポーネント化したいのですが、 そのDLLにコールバックして通知する関数を使う際にクラス内の変数が 見えないみたいなのです。 unit uTest; interface uses Windows, SysUtils, Classes, ExtCtrls , StdCtrls; Function TESTLIB(pfnCallback:pointer):Cardinal; stdcall; external 'TEST.Dll'; type TTest = class(TObject) private FTag : integer; protected procedure TestCallback(item:Integer); public constructor Create; destructor Destroy;override; function Start():boolean; property Tag : integer read FTag write FTag; published end; implementation procedure TTest.TestCallback(item:Integer); begin Tag:=item; <---このTestのプロパティFTagが拒絶される。 end; function TTest.Start():boolean; begin TESTLIB(addr(TTest.TestCallback)); end; constructor TTest.Create; begin inherited Create; end; destructor TTest.Destroy; begin inherited Destroy; end; 過去ログ等色々調べたのですが、うまい解決作が見つかりませんでした。 よろしくお願いします。
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.