본문 바로가기

Programming/MFC

[MFC] 전역변수 선언하기

~App 클래스에서 선언하면 theApp와 같이 전역변수로 선언할 수 있다.


//~App.cpp파일에서는,

// App200.cpp : CApp200App 및 DLL 등록의 구현입니다.

#include "stdafx.h"
#include "App200.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


CApp200App NEAR theApp;

const GUID CDECL BASED_CODE _tlid =
  { 0x96038C72, 0xFA1A, 0x4F26, { 0xB5, 0x24, 0xD6, 0xF6, 0x1E, 0x8D, 0x34, 0x8F } };
const WORD _wVerMajor = 1;
const WORD _wVerMinor = 0;


CString _sessionID;//이런 식으로 적어준다.

 

 

~App.h 파일에서는 맨 밑에줄에 추가해주면 된다.

 

extern CString _sessionID;

 

이러면 끝!