본문 바로가기
반응형

VC12

[개발/MFC] LPSTR LPCTSTR 위험 CStrgin -> char 으로 변환 LPSTR LPCTSTR 위험 CStrgin -> char 으로 변환 (LPSTR)(LPCTSTR)csTest은 위험하다.!! -. 유니코드를 고려하지 않았을뿐 아니라 -. 위험하게 내부데이터를 접근합니다. CString strPP; char * chNN = (LPSTR)(LPCSTR)strPP;이렇게 해서 chNN을 CString의 포인터로 가져 옵니다. (LPSTR)(LPCSTR)strPP 이 부분 에서 이유는 MSDN을 찾아보시면 아시겠지만 CString은 const char * 으로 만 받을수 있답니다. 그래서 (LPCTSTR)strPP 이런 형식으로도 사용합니다. 물론 const char *으로 return되겠죠.. 다시 char *을 필요하신다면 char * chNN = (char *)(LPC.. 2016. 2. 4.
[개발/VC] xdebug, xlocale 관련 error [개발/VC] xdebug, xlocale 관련 error 컴파일이나 빌드를 하면 xdebug, xlocale 관련 에러가 무지하게 많이 발생하는 경우가 생긴다. 이 에러는 다음과 같이 해결할 수 있다. 단 번에 해결이 안되더라도 꼼꼼하게 소스파일을 찾아서 수정해야한다. #ifdef _DEBUG #define new DEBUG_NEW #endif 항상 .cpp 파일에서 위의 3줄 위에 #include 나 #pragma comment(lib, ...)를 선언해야 한다 2012. 2. 29.
[개발/VC] 웹페이지 로드될 때까지 기다리기 [개발/VC] 웹페이지 로드될 때까지 기다리기 m_pWebBrowser->Navigate(...); 로 페이지 호출 후 페이지가 로딩 완료될 때까지 기다리는 함수이다. bool CMyInternetExplorer::WaitTillLoaded (int nTimeout) { READYSTATE result; DWORD nFirstTick = GetTickCount (); do { m_pWebBrowser->get_ReadyState (&result); if (result != READYSTATE_COMPLETE) Sleep (250); if (nTimeout > 0) { if ((GetTickCount () - nFirstTick) > nTimeout) break; } } while (result != RE.. 2011. 9. 27.
[개발/VC] ActiveX에서 키, 탭키등을 먹게 하기 [개발/VC] 엑티브엑스에서 키, 탭키등을 먹게 하기 //////////////////////////////////////////////////////////////////////// // ActiveX Control내 키 이벤트 문제 // 1. OnCreate에서 // OnActivateInPlace (TRUE, NULL); // == UI-Activate the control // 2. PreTranslateMessage 추가 // 3. OnMouseActivate 추가 BOOL CActiveApprovalCtrl::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class swit.. 2011. 9. 27.
[개발/VC] ActiveX 컨트롤에서 자신을 로딩한 웹브라우저 포인터 구하기 [개발/VC] ActiveX 컨트롤에서 자신을 로딩한 웹브라우저 포인터 구하기 웹브라우저 컨트롤의 포인터를 넘깁니다.. IWebBrowser2* CActiveXGetIETestCtrl::GetIWebPointer() { // TODO: Replace the following code with your own drawing code. HRESULT hr ; IOleContainer *pIContainer = NULL ; IWebBrowser2 *pIWeb = NULL ; IServiceProvider *pISP = NULL ; // Get IOleClientSite interface pointer. LPOLECLIENTSITE pIClientSite = GetClientSite() ; // Get IOle.. 2011. 9. 27.
[개발/VC] 클릭했을때 이벤트 얻기 클릭했을때 이벤트 얻기 You may also have to include an entry in the dispatch map: (CHtmlEditView is a class I have derived from CHtmlView ) BEGIN_DISPATCH_MAP(CHtmlEditView, CCmdTarget) DISP_FUNCTION_ID(CHtmlEditView, "onclick", DISPID_HTMLDOCUMENTEVENTS_ONCLICK, OnClick, VT_BOOL, VTS_NONE) END_DISPATCH_MAP() VARIANT_BOOL CHtmlEditView::OnClick() { MSHTML::IHTMLWindow2Ptr spWin2; MSHTML::IHTMLEventObjPtr .. 2011. 9. 27.
[개발/VC] 웹페이지 마우스 위치에 있는 엘리먼트 얻어오기 [개발/VC] 웹페이지 마우스 위치에 있는 엘리먼트 얻어오기 if (SUCCEEDED(hr)) { IHTMLEventObj* pEvtObj; hr = pParentWindow->get_event(&pEvtObj); pParentWindow->Release(); if (SUCCEEDED(hr)) { long clientX = 0L, clientY = 0L; pEvtObj->get_clientX(&clientX); pEvtObj->get_clientY(&clientY); pEvtObj->Release(); IHTMLElement* pHTMLElement = NULL; hr = pDocument->elementFromPoint(clientX, clientY, &pHTMLElement); .... ... } 2011. 9. 27.
[개발/VC] 인터넷 연결체크 // 인터넷 연결체크 // #include // #pragma comment(lib, "wininet.lib") BOOL IsConnectedInternet() { DWORD dwFlag; BOOL bChkInternet = InternetGetConnectedState(&dwFlags, 0); if (!bChkInternet) { AfxMessageBox("It is not conntected to internet"); return FALSE; } return TRUE; } 2011. 9. 27.
[개발/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.
반응형