VisualStudio.C++.C#/코딩팁,함수활용,단편 ( 160 ) MFC. Extension DLL. 확장 DLL . 인스턴스핸들 . 리소스 아이디 충돌 해결 MFC extension dll- // dllmain.cpp : Defines the initialization routines for the DLL.static AFX_EXTENSION_MODULE CLibCyMetaTraderDLL = { false, nullptr };extern "C" int APIENTRYDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved){ // Remove this if you use lpReserved UNREFERENCED_PARAMETER(lpReserved); if (dwReason == DLL_PROCESS_ATTACH) { // Extension DLL one-time initialization if.. 2020. 10. 4. MFC. CFileDialog . 파일열기, 쓰기 공통대화상자 CFileDialog 생성자 인자들. explicit CFileDialog( BOOL bOpenFileDialog, // TRUE 읽기, FALSE 쓰기. LPCTSTR lpszDefExt = NULL, // 파일확장자 LPCTSTR lpszFileName = NULL, // 파일명 DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, // 모드 LPCTSTR lpszFilter = NULL, // 파일형식. 예 _T("*.cfs") CWnd* pParentWnd = NULL, DWORD dwSize = 0, BOOL bVistaStyle = TRUE ); 코드예. void CCyManager_CyDiagram::File_SaveAs() { CFileDial.. 2020. 10. 2. MFC. 스크롤바 제거 스크롤바 제거할려면 상황별로 다른 방식 적용해야함. 상황1. CView 나 CFormView 의 ChildFrame 에서 CSplitterWndEx 적용한 경우. - childframe 의 OnCreateClient 내부의 Create 의 dwStyle 에서 WS_HSCROLL, WS_VSCROLL 을 제외시켜야 함. // childframe 스크롤바 제거 BOOL CCyFinCreatorChildFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext) { return m_wndSplitter.Create(this, //2, 2,// TODO: adjust the number of rows, columns 1, 1, CSize(10.. 2020. 10. 2. MFC. CWnd::PreTranslateMessage . WM_KEYDOWN 핸들러로 수신못할 때. CWnd::PreTranslateMessage - CWnd 메시지 큐에서 메시지 정보 읽어들인 시점 호출됨. - CWnd 에 속한 다른 컨트롤러 들에 메시지 배포하기전에 메시지 정보 받을 수 있는것. - Used by class CWinApp to translate window messages before they are dispatched to the TranslateMessage and DispatchMessage Windows functions. virtual BOOL PreTranslateMessage(MSG* pMsg); typedef struct tagMSG { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT p.. 2020. 9. 30. MFC. 드래그 드롭 시 텍스트 안보이는 문제 해결 . 폰트 설정 오류증상. - 트리컨롤에서 아이템 드래그 하는데 글자 안보임. (아래 그림) 오류해결코드 - 드래그 이미지 생성 CreateDragImage 전에 임시폰트 설정하고, 이미지 생성후 원래 폰트로 복구. CFont * m_pFontDrag = NULL; CFont * m_pFontDefault = NULL; m_pFontDrag = new CFont(); m_pFontDrag->CreateFont(9,0,0,0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET , OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, _T("MS Sans Serif") ); m_pFontDefault = new CF.. 2020. 9. 26. C++. Win32 API. MFC. SetCapture(), ReleaseCapture() SetCapture() , ReleaseCapture()는 win32 api , MFC CWnd 멤버함수 모두 제공됨. 기능 : 마우스가 활성 윈도우 영역을 벗어난 경우에도 마우스 이벤트 받을 수 있게 하는것. HWND SetCapture( HWND hWnd ); Sets the mouse capture to the specified window belonging to the current thread.SetCapture captures mouse input either when the mouse is over the capturing window, or when the mouse button was pressed while the mouse was over the capturing window and .. 2020. 9. 25. CWnd::OnNotify, OnCommand CWnd::OnNotify virtual BOOL OnNotify( WPARAM wParam, LPARAM lParam, LRESULT* pResult ); Parameters wParam Identifies the control that sends the message if the message is from a control. Otherwise, wParam is 0. lParam Pointer to a notification message (NMHDR) structure that contains the notification code and additional information. For some notification messages, this parameter points to a larger.. 2020. 9. 24. MFC. 컨트롤 동적 생성시 이벤트 핸들링 MFC 의 컨트롤을 동적 생성한 경우 버튼 클릭등의 이벤트핸들링은 정적 생성한 경우와는 달리, OnCommand 와 OnNotify 에서 수신하며, 이를 위한 컨트롤 생성시 동적 생성한 컨트롤의 owner 가 이벤트 수신할 CWnd* 로 설정되어야 한다. OnCommand, OnNotify 의 wParam 으로 Create 시 기록한 nID 가 전달된다. OnNotify 인 경우에는 nID가 wParam 과 동시에 lParam 으로 전달되는 구조체 NMHDR 의 멤버 idFrom에도 nID가 기록되어 전달된다. 아래 코드는 CListCtrl 의 경우의 동적 생성시 이벤트 핸들링을 위한 코드 예를보인다. CTreeCtrl 뿐만 아니라 모든 컨트롤의 동적 생성한 것들은 이와 동일한 방식으로 이벤트 핸들링한다.. 2020. 9. 24. MFC. CListCtrl. 리스트 컨트롤. InsertColumn int InsertColumn( int nCol, const LVCOLUMN* pColumn);int InsertColumn( int nCol, LPCTSTR lpszColumnHeading, int nFormat = LVCFMT_LEFT, int nWidth = -1, int nSubItem = -1); InsertItem int InsertItem(const LVITEM* pItem);int InsertItem( int nItem, LPCTSTR lpszItem);int InsertItem( int nItem, LPCTSTR lpszItem, int nImage);int InsertItem( UINT nM.. 2020. 9. 24. MFC. Understanding CDockablePane. 최고의 설명글. 아래 링크에서 설명하는 CDockablePane 설명글 구글 검색에서 보이는 최고의 정보 품질. Understanding CDockablePane A good reference for CDockablePane www.codeproject.com 연관 MS 사 설명글. CDockablePane Class CDockablePane 클래스에 대해 자세히 알아보기 docs.microsoft.com MFC. CDockablePane 에 CDialog 표현하기. CDockablePane 에서 CDialog m_pDlg; CDockablePane::OnCreate() { m_pDlg.Create(IDD_DLG, this); m_pDlg.ShowWindow(SW_SHOW); } CDockablePane::OnPaint.. 2020. 9. 20. MFC. 컴파일 경고 무시 #pragma, 속성설정. #pragma warning(disable: 번호) - 해당 소스파일 에 번호 에 해당하는것은 컴파일시 경고 발생하지 않는다. 예. 컴파일시 경고 아이디 C26812 가 있다면 #pragma warning(disable: 26812) - 1개의 소스파일에서 무시하려면 해당파일의 최상단 에 기록. - 헤더파일에 의 최상단에 기록하면 헤더파일 모든 소스파일에 경고무시 적용됨. 속성창에서 Disable Specific Warnings 설정. - 설정방법 : 프로젝트 속성창 : C/C++ -> Advanced -> Disable Specific Warnungs 란에 경고 번호 추가. - 프로젝트 전체에서 해당 경고 무시됨. 첫 등록 : 2020.09.14 최종 수정 : 단축 주소 : https://igotit... 2020. 9. 14. MFC. pch.h precompiled header 사용하지 않음 설정 프로젝트 속성 에서 C/C++ -> Precompiled Header 의 오른쪽 리스트 항목중 Precompiled Header 를 Not Using Precompiled Headers 를 선택. 아래그림. 2020. 9. 13. Visual C++ 2019 . WebSocket 구현 골격. cpprestsdk 기반. 개요 Visual C++ 2019 에서 웹소켓 구현하기 위한 라이브러리로 4종( cpprestsdk , libwebsocket, websocket++ , boost websocket) 정도의 후보가 있다. websocket ++ : www.zaphoyd.com/projects/websocketpp/ boost의 beast::websocket : www.boost.org/doc/libs/1_70_0/libs/beast/doc/html/beast/using_websocket.html 예제 : www.boost.org/doc/libs/1_70_0/libs/beast/doc/html/beast/quick_start/websocket_client.html stackoverflow.com/questions/9528.. 2020. 9. 9. std::function<R(Args...)>::target std::function::target Returns a pointer to the stored callable function target. Return value A pointer to the stored function if target_type() == typeid(T), otherwise a null pointer. #include #include int f(int, int) { return 1; } int g(int, int) { return 2; } void test(std::function const& arg) { std::cout const T* target() const noexcept; (2) (since C++11) Returns a pointer to the stored calla.. 2020. 9. 8. Fixed width integer types C99표준. stdint.h 에 정의 있음. uint8_t, uint64_t 등. Fixed width integer types (since C99) Types Defined in header int8_t int16_t int32_t int64_t signed integer type with width of exactly 8, 16, 32 and 64 bits respectively with no padding bits and using 2's complement for negative values (provided only if the implementation directly supports the type) int_fast8_t int_fast16_t int_fast32_t int_fast64_t fastest signed integer type with width of at l.. 2020. 9. 7. win API . FindWindow , FindWindowEx // activate an application with a window with a specific class name BOOL CMyApp::FirstInstance() { CWnd *pWndPrev, *pWndChild; // Determine if a window with the class name exists... pWndPrev = CWnd::FindWindow(_T("MyNewClass"), NULL); if (NULL != pWndPrev) { // If so, does it have any popups? pWndChild = pWndPrev->GetLastActivePopup(); // If iconic, restore the main window if (pWndPrev->IsIconic.. 2020. 9. 5. MFC.대화상자. x버튼 그레이처리 BOOL CCyFinMetaMain_UITDlg::OnInitDialog() { CDialogEx::OnInitDialog(); ModifyStyle(WS_SYSMENU, 0);// 우상단 최소화, 최대화, x 3개 모두 안보이게 하는것 // x버튼 그레이 처리하는것. CMenu *p_menu = this->GetSystemMenu(FALSE); p_menu->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND | MF_GRAYED); return TRUE; } 첫 등록 : 2020.08.31 최종 수정 : 단축 주소 : https://igotit.tistory.com/2561 2020. 8. 31. WM_COPYDATA . OnCopyData . CWnd * pWnd . WPARAM 개요2개의 프로세스 사이에 SendMessage 함수로 메시지 송/수신과 동시에 구조체자료형 COPYDATASTRUCT 를 전송가능한 것. 즉 메시지 송신측에서 SendMessage 함수인자를 아래처럼 호출하면 HWND(윈도우핸들) 에 해당하는 다른 프로세스에서 COPYDATASTRUCT 로 정의된 데이터 myCDS 를 수신가능하다. SendMessage (HWND, WM_COPYDATA, 0,(LPARAM)&myCDS); // 메시지 전송.myCDS 로 전송하기 위한 간단한 예.typedef struct { int a; int b;} MySTData; MySTData my_stdata; // 이 구조체를 COPYDATASTRUCT 의 lpData 로 송신하고자한다.COPYDATASTRUCT myCD.. 2020. 8. 31. 이전 1 2 3 4 5 6 ··· 9 다음