다음을 통해 공유


CWinApp::WriteProfileInt

레지스트리는 응용 프로그램의 지정 된 섹션에 지정 된 값을 기록 하려면이 멤버 함수를 호출 하거나.INI 파일입니다.

BOOL WriteProfileInt( 
   LPCTSTR lpszSection, 
   LPCTSTR lpszEntry, 
   int nValue  
);

매개 변수

  • lpszSection
    항목을 포함 하는 섹션을 지정 하는 null로 끝나는 문자열을 가리킵니다. 섹션을 존재 하지 않으면 만들어집니다. 이름 섹션의 경우 독립적입니다. 문자열에는 대 문자와 소문자 수 있습니다.

  • lpszEntry
    값에 쓸 수 있는 항목을 포함 하는 null로 끝나는 문자열을 가리킵니다. 지정한 섹션에 항목이 존재 하지 않는 경우 만들어집니다.

  • nValue
    쓸 값을 포함 합니다.

반환 값

성공 하면 0이 아닌. 그렇지 않으면 0입니다.

예제

이 예제를 사용 하 여 CWinApp* pApp = AfxGetApp(); 가져올 방법을 보여주는 CWinApp 클래스에는 WriteProfileString, WriteProfileInt, GetProfileString, 및 GetProfileInt MFC 응용 프로그램의 모든 함수에서 사용할 수 있습니다.

CWinApp* pApp = AfxGetApp();

CString strSection       = _T("My Section");
CString strStringItem    = _T("My String Item");
CString strIntItem       = _T("My Int Item");

pApp->WriteProfileString(strSection, strStringItem, _T("test"));

CString strValue;
strValue = pApp->GetProfileString(strSection, strStringItem);
ASSERT(strValue == _T("test"));

pApp->WriteProfileInt(strSection, strIntItem, 1234);

int nValue;
nValue = pApp->GetProfileInt(strSection, strIntItem, 0);
ASSERT(nValue == 1234);

예를 들어 다른 예제를 보려면 CWinApp::GetProfileInt.

요구 사항

헤더: afxwin.h

참고 항목

참조

CWinApp 클래스

계층 구조 차트

CWinApp::GetProfileInt

CWinApp::WriteProfileString

CWinApp::SetRegistryKey