クラス内のCALLBACK関数の呼び出し処理について
Posted: 2016年2月14日(日) 22:07
ウィンドウハンドルに対する操作関連をまとめた、
自作クラスを作成しています。
以下コードの★★の箇所で以下のコンパイルエラーとなります。
-------------------
error C3867: 'AutoOperation::EnumChildProc': 関数呼び出しには引数リストがありません。
メンバーへのポインターを作成するために '&AutoOperation::EnumChildProc' を使用してください
-------------------
public ref class AutoOperation{
strc_window^ main_window;//strc_windowは自作の構造体です
List<strc_window^>^ child_window_list;
AutoOperation(){
**this->main_windowに親ウィンド情報を代入する処理**
child_window_get();
}
BOOL CALLBACK EnumChildProc(HWND hw, LPARAM lParam ){
return true;
}
void child_window_get(){
this->child_window_list = gcnew List<strc_window^>;
long ans = EnumChildWindows( this->main_window->hw, EnumChildProc, NULL );//★★
}
};
エラー表記通り「&AutoOperation::EnumChildProc」に変えると、
今度は以下のコンパイルエラーとなります。
-------------------
error C3374: delegate インスタンスを作成する場合以外に、'AutoOperation::EnumChildProc' のアドレスを指定できません
-------------------
やりたい事はクラス内でCALLBACK関数の呼び出し処理EnumChildWindowsを完結させたいのです。
解決策をご教授下さい。
自作クラスを作成しています。
以下コードの★★の箇所で以下のコンパイルエラーとなります。
-------------------
error C3867: 'AutoOperation::EnumChildProc': 関数呼び出しには引数リストがありません。
メンバーへのポインターを作成するために '&AutoOperation::EnumChildProc' を使用してください
-------------------
public ref class AutoOperation{
strc_window^ main_window;//strc_windowは自作の構造体です
List<strc_window^>^ child_window_list;
AutoOperation(){
**this->main_windowに親ウィンド情報を代入する処理**
child_window_get();
}
BOOL CALLBACK EnumChildProc(HWND hw, LPARAM lParam ){
return true;
}
void child_window_get(){
this->child_window_list = gcnew List<strc_window^>;
long ans = EnumChildWindows( this->main_window->hw, EnumChildProc, NULL );//★★
}
};
エラー表記通り「&AutoOperation::EnumChildProc」に変えると、
今度は以下のコンパイルエラーとなります。
-------------------
error C3374: delegate インスタンスを作成する場合以外に、'AutoOperation::EnumChildProc' のアドレスを指定できません
-------------------
やりたい事はクラス内でCALLBACK関数の呼び出し処理EnumChildWindowsを完結させたいのです。
解決策をご教授下さい。