본문 바로가기

MFC7

[MFC] Log 생성. #include #include // for PathIsDirectory() #include // for std::put_time #include // for std::time_t and std::tm #include CString logfileDirectory = CurPath + "\\log"; if (!PathIsDirectory(logfileDirectory)) { CreateDirectory(logfileDirectory, NULL); } // get current date and time std::time_t now = std::time(nullptr); std::tm now_tm = *std::localtime(&now); std::stringstream ss1, ss2; ss1 2023. 1. 12.
[MFC] 현재 실행중인 프로그램 경로 구하기 #define MAX_PATH = 200 CString curPath; char szBuf[MAX_PATH]; ZeroMemory(szBuf, _countof(szBuf)); GetModuleFileName(NULL, szBuf, MAX_PATH); char *pBuf = strrchr(szBuf, '\\'); if(pBuf) { *pBuf = '\0'; curPath.Format("%s", szBuf); } 2023. 1. 12.
[MFC] Exception handle, try catch, event viewer try { int i; i++; AfxThrowUserException(); } catch (CException* ce) { CString strExceptionMessage; TCHAR szMsg[1024]; memset(szMsg, 0x00, sizeof(szMsg)); if (ce->GetErrorMessage(szMsg, 1024)) { CString strErrorMessage = szMsg; strExceptionMessage.Format( //_T("Url - %s\n") _T("Error Code - %d\n") _T("Error Message - %s\n") _T("Error Line - %d\n") _T("test") , GetLastError() , strErrorMessage , _.. 2022. 11. 4.
[MFC] DPI Scale Windows SDK 8.1 미만 코드. 그 이상으로 필요시 https://learn.microsoft.com/ko-kr/windows/win32/api/winuser/nf-winuser-getdpiforwindow 해당 함수 사용. GetDpiForWindow function (winuser.h) - Win32 apps Returns the dots per inch (dpi) value for the specified window. learn.microsoft.com void CTestDlg::InitializeDPIScale(HWND hwnd) { CDC* pDC = GetDC(); m_fDPIScaleX = GetDeviceCaps(pDC->GetSafeHdc(), LOGPIXELSX) / 96.0.. 2022. 9. 21.
[MFC] C# 클래스 인스턴스화 하기 C# 클래스 DLL 사용시 C++ 클래스에서 평상시처럼 선언시 비 관리 클래스의 멤버는 표준 핸들일 수 없습니다. 오류 발생 #include using namespace System; gcroot 변수명; 객체 할당시 변수명 = gcnew 프로젝트::클래스명; #include using namespace System; // CMFCApplicationChromiumApp: // 이 클래스의 구현에 대해서는 MFCApplication_Chromium.cpp을(를) 참조하세요. // class CMFCApplicationChromiumApp : public CWinApp { public: CMFCApplicationChromiumApp(); // 재정의입니다. public: virtual BOOL InitI.. 2021. 7. 13.
[MFC] C# Windows Forms 컨트롤 라이브러리와 SendMessage 주고 받기 (C++ ↔ C#) 작성 했던 방법과 동일한 방식으로 프로젝트 생성 및 빌드 [MFC] Dialog에서 C# Winform 불러오기 및 Chromium 사용, Dynamic Control Resize (tistory.com) [MFC] Dialog에서 C# Winform 불러오기 및 Chromium 사용, Dynamic Control Resize * Visual Studio 2019 16.9 * .NET Framework 4.8 * Nuget Package : CefSharp 제목에 있는 내용들이 섞여 있기에 차근차근 봐주시길 바랍니다. 1. C# Windows Forms 컨트롤 라이브러리 프로젝트 생성 2. .NET Fr.. jcoder1.tistory.com 1. C# Windows Forms 컨르롤 라이브러리 publ.. 2021. 3. 15.
[MFC] Dialog에서 C# Winform 불러오기 및 Chromium 사용, Dynamic Control Resize * Visual Studio 2019 16.9 * .NET Framework 4.8 * Nuget Package : CefSharp 제목에 있는 내용들이 섞여 있기에 차근차근 봐주시길 바랍니다. 1. C# Windows Forms 컨트롤 라이브러리 프로젝트 생성 2. .NET Framework 4.8 선택 3. Nuget Package - CefSharp.winform 설치 4. UserControl1.cs 수정 5. x86 또는 x64로 반드시 지정 컴파일 (AnyCPU XXXX). 본인은 32비트로 컴파일. 6. 빌드 참고 MSDN : How to: Create the User Control and Host in a Dialog Box | Microsoft Docs How to: Create the .. 2021. 3. 12.