본문 바로가기
반응형

MFC90

[개발/MFC] 웹 페이지 <form 태그의 input 태그 값 채우기 // 웹 페이지 get_Document (&pHtmlDocDispatch); if (SUCCEEDED (hr) && (pHtmlDocDispatch != NULL)) { hr = pHtmlDocDispatch->QueryInterface (IID_IHTMLDocument2, (void**)&pHtmlDoc); if (SUCCEEDED (hr) && (pHtmlDoc != NULL)) { IHTMLElementCollection* pColl = NULL; hr = pHtmlDoc->get_all (&pColl); if (SUCCEEDED (hr) && (pColl != NULL)) { // Obtained the Anchor Collection... long nLength = 0; pColl->get_le.. 2011. 9. 27.
[개발/MFC] 새 브라우저 생성 HRESULT hr; IWebBrowser2* pWebBrowser = NULL; hr = CoCreateInstance (CLSID_InternetExplorer, NULL, CLSCTX_SERVER, IID_IWebBrowser2, (LPVOID*)&pWebBrowser); if (SUCCEEDED (hr) && (pWebBrowser != NULL)) { m_pWebBrowser->put_Visible (VARIANT_TRUE); // OK, we created a new IE Window and made it visible // You can use pWebBrowser object to do whatever you want to do! } else { // Failed to create a ne.. 2011. 9. 27.
[개발,MFC] 숫자를 문자열 로 문자열을 숫자로 상호 변환 1. 숫자를 문자열로 바꿀때 int a = 100; CString str; str.Format(_T("%d"), i); 즉, CString 의 맴버 함수에는 Format() 이라는 함수가 존재하고 이는 C에서 printf 처럼 출력 가능하게 해줍니다. 이를 통해 문자열로 바꾸면 됩니다. 2. 문자열을 숫자로 바꿀때 int a; CString str = "100"; a = _tstoi(str); _tstoi() 함수는 String To Integer 즉, 문자열을 정수형으로 바꾸는 함수입니다 [출처] [MFC] 숫자를 문자열 로 문자열을 숫자로 상호 변환|작성자 사예 2011. 9. 22.
[개발/MFC] HINSTANCE 구하기 1. hWnd를 알면, 그걸로 hInstance를 얻어올 수 있습니다. GetWindowLong / GetWindowLongPtr에서 GWLP_HINSTANCE 2. AfxGetApp() 를 통해서 App 의 포인터를 얻어온 다음에 m_instance 멤버변수 3. HINSTANCE hInst= GetModuleHandle(NULL); 콘솔에서 윈도 뛰울때 자주 씁니다. 4. HINSTANCE AfxGetInstanceHandle( ); 5. dll의 메모리를 이용한 HINSTANCE 구하기 종종 DLL 내부에서 window를 띄워야하시겠다는 분이 있어서 찾던중에 Detecting a HMODULE/HINSTANCE Handle Within the Module You're Running In 이라는 co.. 2011. 9. 20.
[개발/MFC] 중복실행 방지하기 [개발/MFC] 중복실행 방지하기 TCHAR szAppName[] = _T("sbrich"); HANDLE hMutex = NULL; bool IsSecondInstance() { bool isSecondInstance= false; hMutex= CreateMutex(NULL, NULL, szAppName); int iLastError = GetLastError(); if(hMutex && (ERROR_ACCESS_DENIED == iLastError || ERROR_ALREADY_EXISTS == iLastError)) { ReleaseMutex(hMutex); hMutex= NULL; isSecondInstance= true; } return isSecondInstance; } int main() .. 2011. 9. 20.
[개발/MFC] GetLastError(), System Error Codes (0-999) GetLastError()함수로 얻게 되는 에러코드로 아래으 에러코드에 대한 에러 메세지의 의미를 알 수 있다. **System Error Codes (0-499) The following table provides a list of system error codes ( errors 0 to 499). They are returned by the GetLastError function when many functions fail. To retrieve the description text for the error in your application, use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag. Table with 2 c.. 2011. 9. 20.
반응형