본문 바로가기

개발관련/MFC

레지스트리 등록

 아웅.. 거의 4달만에 .net으로 오니 툴이 왜이렇게 낯설은지...ㅋ

 머리속에 남아 있는것두 없는것 같고.. MSDN 과 함께 막 헤메고...ㅋ

 까먹기 전에 잘 안쓰는 것들은 좀 메모 해 놔야 겠다..

 CWinApp::WriteProfileInt

in MSDN...

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

Parameters

lpszSection
Points to a null-terminated string that specifies the section containing the entry. If the section does not exist, it is created. The name of the section is case independent; the string may be any combination of uppercase and lowercase letters.
lpszEntry
Points to a null-terminated string that contains the entry into which the value is to be written. If the entry does not exist in the specified section, it is created.
nValue
Contains the value to be written.

Return Value

Nonzero if successful; otherwise 0.

 머.. 해당 레지스터에 값을 쓰는거다..

 사용자가 특별히 지정 하지 않는 이상 HKEY_CURRENT_USER\Software\Local AppWizard-

 Generated Applications에 프로젝트 이름 폴더에 생성이 된다.

 ex) AfxGetApp()->WriteProfileInt("BROWSE", "serial_number", 1);

 이라고 할 경우에 프로젝트 이름 폴더의 BROWSE 폴더에 serial_number 란 값에 1이 저장이 된다.

 레지스터 에서 값을 읽어 올 경우에는

 AfxGetApp()->GetProfileInt("BROWSE", "serial_number", -1) 을 사용하면 된다.

사용자 삽입 이미지

 이 함수는 읽어 온 값을 리턴 해주고, -1의 의미는 "serial_number이 없을 경우 리턴 되는 값이다.

 자세한 것은 msdn을 참조 하면 된다.

 레지스터에 Int 속성만 넣을 수 있는게 아니고 binary, string 등 다양한 값을 넣을 수 있으니 필요한

 데이타에 맞게 함수를 사용해 주면 좋을 것이다.

 일반적으로 doModal() 함수를 이용한 파일 열기에서 많이 사용한다..

 이것에 관계해서는 전에 기록한 것에 남아 있으므로 pass..