본문 바로가기
kxLibrary

KxLibrary로 DLL 만들기

by 두루물 2010. 11. 19.

"KFC1.0 으로 윈도우즈 SDK 플랫폼 API 프로그램을 MFC 처럼 쉽게 하자"

먼저,DLL EntryPoint 를 선언해 주고 KFCApp 클래스를 파생시켜 Application class 를 구현한다.

DLLEntry.h
/*
$Id: DLLEntry.h 8 2009-11-18 15:37:02Z krkim $ $Revision: 8 $ $HeadURL: http://krkim-laptop/svn/DuruEdit/Src/Splash/SplashApp.h $ */ #pragma once #include "KFCApp.h" /* for available to dll has resources -if not needs resource,remove this class*/ class DLLEntry : public KFCApp { public: virtual BOOL InitInstance(); virtual BOOL ExitInstance(); DLLEntry(); virtual ~DLLEntry(); }; DLLEntry.cpp
#include "stdafx.h"
#include "DLLEntry.h"
#include "kxHookMenu.h"
//KFC DLL Entrypoint
KFC_DLL_ENTRYPOINT(DLLEntry)

DLLEntry::DLLEntry()
{

}

DLLEntry::~DLLEntry()
{
}

BOOL DLLEntry::InitInstance()
{
 
 return TRUE;
}

BOOL DLLEntry::ExitInstance()
{

 return TRUE;
}

이하 소스의 나머지는 MFC DLL 클래스 만들때와 똑같이 구현 해주면 된다.

 
1
2
3
4
5
6
7
8
9
10
#ifdef DEEDIT_EXPORTS
 #define DEEDITAPI __declspec(dllexport)
#else
 #define DEEDITAPI __declspec(dllimport)
#endif

class DEEDITAPI DETextCtrl : public KFCWnd //Export 할 DLL 클래스
{

}

프로젝트 빌드는 MFC 사용여부를 표준 Windows Library
전처리기 정의 : WIN32;_DEBUG;_WINDOWS;_USRDLL;DEEDIT_EXPORTS
링크에 KFCWndLib.Lib 를 추가후 빌드한다.