검색결과 리스트
Afx에 해당되는 글 2건
- 2011.07.21 [MFC] MFC에서 Token 분리
- 2011.01.24 [MFC] 현재 프로그램의 Instance Handle을 구하는 API
글
* This global function can be used to extract a substring from a given source string.
BOOL AFXAPI AfxExtractSubString ( CString& rString, LPCTSTR lpszFullString, int iSubString, TCHAR chSep = '\n' );
* Sample Source// The following example extracts a series of name, value pairs from a // given source string: // Input string consisting of a number of name, value pairs LPCTSTR lpszSource = _T("\"Name\"=\"John Smith\"\n") _T("\"Company\"=\"Contoso, Ltd\"\n\"Salary\"=\"25,000\""); CString strNameValue; // an individual name, value pair int i = 0; // substring index to extract while (AfxExtractSubString(strNameValue, lpszSource, i)) { // Prepare to move to the next substring i++; CString strName, strValue; // individual name and value elements // Attempt to extract the name element from the pair if (!AfxExtractSubString(strName, strNameValue, 0, _T('='))) { // Pass an error message to the debugger for display OutputDebugString(_T("Error extracting name\r\n")); continue; } // Attempt to extract the value element from the pair if (!AfxExtractSubString(strValue, strNameValue, 1, _T('='))) { // Pass an error message to the debugger for display OutputDebugString(_T("Error extracting value element\r\n")); continue; } // Pass the name, value pair to the debugger for display CString strOutput = strName + _T(" equals ") + strValue + _T("\r\n"); OutputDebugString(strOutput); } |
'C/C++ > VC++ / MFC' 카테고리의 다른 글
[COM] WebBrowser Customization (0) | 2012.12.29 |
---|---|
[VC++] visual studio 2008 Excel Automation "\excel.tlh(1219) : error C2371: 'FontPtr' : redefinition; different basic types" (0) | 2011.08.05 |
[MFC] CListCtrl 현재 행 선택하기 (0) | 2011.03.20 |
COM Automation 에서 옵션인자 설정 방법 (0) | 2011.03.03 |
#pragma message (0) | 2011.02.25 |
트랙백
댓글
글
MFC를 사용 할 때 전역적으로 사용할수 있는 API 앞머리에 Afx가 붙습니다.
그중 현재 프로그램의 Instance Handle을 구할수 있는 API입니다.
AfxGetInstanceHandle();
그런데 이걸 Winapi로 하면 어떻게 될까요? 우선 GetWindowLong API를 이용하면 해결됩니다.
아래와 같이 호출해 주시면 됩니다. hWnd는 호출하는 쪽의 윈도우 핸들 입니다.
// 원형 LONG GetWindowLong( HWND hWnd, int nIndex );
아래와 같이 호출해 주시면 됩니다. hWnd는 호출하는 쪽의 윈도우 핸들 입니다.
GetWindowLong(hWnd, GWL_HINSTANCE);
'C/C++ > VC++ / MFC' 카테고리의 다른 글
[MFC] Ansi -> Unicode 형변환 (0) | 2011.02.08 |
---|---|
PathIsDirectory 유효한 폴더명인지 확인 할 수 있는 API (0) | 2011.01.24 |
WINDOWS API 폴더 선택 (0) | 2011.01.21 |
VC++에서 ADO를 사용하는 방법 (0) | 2011.01.20 |
Visual Studio 2008 Release 모드에서 디버깅 하기 (0) | 2010.10.03 |
RECENT COMMENT