본문 바로가기

Windows

(14)
[Visual Studio Code] CMake tools Visual studio code cannot find kits 간혹 scan for kit을 해도 정상적으로 kit 목록이 업데이트 되지 않은 경우가 있다. 아래 파일을 열고 직접 수정하면 된다. [MacOS] /Users//.local/share/CMakeTools/cmake-tools-kits.json [Windows ] C:\Users\\AppData\Local\CMakeTools\cmake-tools-kits.json [Ubuntu] /home//.local/share/CMakeTools/cmake-tools-kits.json [ { "name": "Clang 14.0.0 x86_64-apple-darwin21.6.0", "compilers": { "C": "/usr/bin/clang", "CXX": "/usr/bin/clang++" }, "isTrusted..
Obtaining the title of another application It's very easy to get pointer of CWnd instance. Just use CWnd::FindWindow function. and we can find the title using GetWindowText member function This is an example code to get a title of VLC player. The class of VLC player is 'QWidget' CString str; CWnd* pWnd = CWnd::FindWindow(_T("QWidget"), 0); if (pWnd) { pWnd->GetWindowText(str); } if (str.Find(_T("VLC")) >= 0) { MessageBox(str); }
[MFC] Directory Dialog Directory 경로 얻기 초기화 경로를 lParam으로 전달하고 Callback함수를 등록하면 SHBrowseForFolder 함수 호출 후 Callback 함수가 호출된다. 경로는 callback의 lParam으로 전달되고 그 전달된 값을 BFFM_SETSELECTION 메시지 이용해 보낸다. 이렇게 해야 초기 진입 시 원하는 디렉토리가 선택된 모습을 볼 수 있다. int CALLBACK CDialog_BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) { switch (uMsg) { case BFFM_INITIALIZED: SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData); brea..
[VisualStudio] Image watch Visual Studio에 다양한 extension 프로그램 중 이미지 버퍼의 내용을 확인하기에 좋은 것을 발견했고 이름은 Image watch https://visualstudiogallery.msdn.microsoft.com/e682d542-7ef3-402c-b857-bbfba714f78d 문서는 상당히 잘 되어있다. https://imagewatch.azurewebsites.net/ImageWatchHelp/ImageWatchHelp.htm 아래 코드는 test하기 위해 수정한 것이다. Visual studio 2013의 경우 C:\Users\XXX\AppData\Local\Microsoft\VisualStudio\12.0\Extensions\3jpgz45l.bxx 와 같은 경로에 설치가 된다. 이..
[VisualStudio] stl::map insert vs operator[]. Which is faster? I was wondering which was faster. So I made a test code and tested. static int nCDCreated = 0; static int nCDDestoryed = 0; static int nCDCopied = 0; class CD { public: CD() { ++nCDCreated; } virtual ~CD() { ++nCDDestoryed; } void operator = (const CD& src) { i = src.i; ++nCDCopied; } int i; }; int main(int argc, char* argv[]) { std::map tm; std::map tma; unsigned long long start; const int repe..
VC6 Static control double click 처리하기 Visual Studio 6.0 class wizard에서는 CStatic control의 Click event handler 추가 기능만 있다.그래서 double click과 같은 것은 수동으로 핸들러를 등록해주어야 한다.그리고 구현 전 control 속성에서 Styles tab > Notify 체크해주어야 한다. 우선 핸들러 함수를 선언 및 구현// XXX.h afx_msg void OnStaticTestDblClicked(); // XXX.cpp void CTest1Dlg::OnStaticTestDblClicked() {// TODO: Add your control notification handler code here } Message map에 STN_DBLCLK 메시지 받을 수 있도록 등록// ..
[MFC] Double buffering // In XXX.hclass XXX {...CDCm_memDC;CBitmap m_bitmap;... }; // In XXX.cpp void XXX::OnPaint(){CPaintDC dc(this); // device context for paintingCBitmap *pOldBitmap;CRect rc; GetClientRect(&rc);if (!m_memDC.GetSafeHdc()) {m_memDC.CreateCompatibleDC(&dc);if (m_bitmap.GetSafeHandle()) {m_bitmap.DeleteObject();}m_bitmap.CreateCompatibleBitmap(&dc, rc.Width(), rc.Height());} pOldBitmap = m_memDC.Selec..
[MFC] Draw Text // In XXX.h class XXX {...CFont m_font;CBrush m_brushBG;} // In XXX.cpp void XXX::OnPoint(){CDC* pDC;... if (!m_font.GetSafeHandle()) {m_font.CreateFont(15, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, _T("Consolas"));}CFont *pOldFont = pDC->SelectObject(&m_font);int nOldBkMode = pDC->SetBkMode(OPAQUE); pDC->SetTextColor(RGB(255, 255, 255));pDC->SetBkColor(RGB(0, 0, 0));pDC->DrawText(m_strM..