C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[64164] Re:callback 함수 관련 입니다. 도와주세요
14 [] 1822 읽음    2011-04-14 18:58
아래와 같이 하면 될텐데요...
EnumWindows((WNDENUMPROC)CloseExplorer, 0);

암흑사제 님이 쓰신 글 :
: 제가 하려는 것은 작업관리자에 잇는 응용프로그램에 실행되고 있는 실행파일명들을 가져오려고 하거든요
: 그래서 진행을 하려고 보니 콜백함수를 사용하여 나타나게 되었습니다.
: 콜백함수를 사용하는데 계속 오류가 나오네요
: //---------------------------------------------------------------------------
: // ==============================Unit1.cpp===================================
: #include <vcl.h>
: #include <stdio.h>
: #pragma hdrstop
: #include <DateUtils.hpp>
: #include "Unit1.h"
: //---------------------------------------------------------------------------
: #pragma package(smart_init)
: #pragma resource "*.dfm"
: TForm1 *Form1;
: //---------------------------------------------------------------------------
: __fastcall TForm1::TForm1(TComponent* Owner)
:     : TForm(Owner)
: {
:     EnumWindows(CloseExplorer, 0);
: }
: //---------------------------------------------------------------------------
: BOOL CALLBACK TForm1 ::CloseExplorer(HWND hwnd, LPARAM lParam)
: {
:      CHAR buf[100];
:      AnsiString     szMsg;
:      szMsg = "test";
:      GetClassName (hwnd, (LPTSTR)&buf, 100);
:      if ( strcmp( buf, szMsg.c_str() ) != 0 )
:         PostMessage(hwnd, WM_CLOSE, 0, 0);  //ExplorerwClass는 스파이+에서 찾으셈..
:      return true;
: }
:
:
: //---------------------------------------------------------------------------
: // ==============================Unit1.h===================================
: #ifndef Unit1H
: #define Unit1H
: //---------------------------------------------------------------------------
: #include <Classes.hpp>
: #include <Controls.hpp>
: #include <StdCtrls.hpp>
: #include <Forms.hpp>              
: //---------------------------------------------------------------------------
: class TForm1 : public TForm
: {
: __published:    // IDE-managed Components
:     TButton *Button1;
: private:    // User declarations
: public:        // User declarations
:     __fastcall TForm1(TComponent* Owner);
:     static BOOL CALLBACK CloseExplorer(HWND hwnd, LPARAM lParam);//선언
: };
: //---------------------------------------------------------------------------
: extern PACKAGE TForm1 *Form1;
: //---------------------------------------------------------------------------
: #endif
:
: 오류
: [C++ Error] Unit1.cpp(16):E2034 Cannot convert 'int (__stdcall *)(void*,long)'to'int(__stdcall*)()'
: [C++ Error] Unit1.cpp(16):E2342 Type mismatch in parameter 'lpEnumFunc'(wanted 'int(__stdcall *)()', got 'int (__stdcall *)(void *,long)') 
: 해결좀 해주세요

+ -

관련 글 리스트
64162 callback 함수 관련 입니다. 도와주세요 암흑사제 1567 2011/04/14
64164     Re:callback 함수 관련 입니다. 도와주세요 14 1822 2011/04/14
64168         Re:Re:callback 함수 관련 입니다. 도와주세요 암흑사제 1615 2011/04/15
64163     Re:callback 함수 관련 입니다. 도와주세요 kylix 1502 2011/04/14
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.