본문 바로가기

VisualStudio.C++.C#/코딩팁,함수활용,단편   ( 155 )


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 nMask, int nItem, LPCTSTR lpszItem, UIN.. 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 myCDS; /.. 2020. 8. 31.
Critical Section (크리티컬 섹션) 개요 Critical Section (크리티컬 섹션) 을 설정한 구간은 한 번에 하나의 "스레드"에서만 사용가능하다. - 프로세스 내에 여러 스레드가 있는 환경에서, 우리가 설정해둔 "크리티컬 영역" 에 어떤 스레드가 먼저 진입하여 크리티컬 영역을 벗어나지 않은 상태에서는 동일 프로세스의 다른 스레드에서 해당 크리티컬 영역에 진입하는 것을 금지한다. - 후발 스레드의 "크리티컬 섹션" 진입금지 방식에 "리턴" 혹은 "대기"를 설정할 수 있다. "대기"란 선 진입한 스레드가 해당영역을 벗어날때까지 후발 스레드는 "대기" 상태로 있다가 선진입한 스레드가 해당영역 벗어나면 대기중인 후발 스레드가 크리티컬 영역을 실행하는것. "리턴"이란 후발 스레드는 "대기"상태에 있지 않고 "리턴"되어 크리티컬 영역 실행 하.. 2020. 5. 13.
jsoncpp. Json::Value , Json::Reader, Json::CharReader, Json::CharReaderBuilder 개요 . Json형식 문자열을 Json::Value 로 변환 jsoncpp 기반 Json::Value , Json::Reader 는 Visual C++ 2017 에서는 정상작동하나, Visual C++ 2019 에서는 사용 불가. VC++2019 에서는 Json::CharReaderBuilder 와 Json::CharReader 활용. Json::Reader - VC++2017 에서는 정상작동. VC++2019 에서 컴파일오류. #include // jsoncpp . 1.9.2 . from vcpkg -> nuget -> in this project std::string str_json; // 이 변수에 json형식의 문자열이 있다고 치자. Json::Value value_json; // Json::Va.. 2020. 5. 12.
libcurl. curl_easy_perform. perform a blocking file transfer #include CURLcode curl_easy_perform(CURL *easy_handle); Description Invoke this function after curl_easy_init and all the curl_easy_setopt calls are made, and will perform the transfer as described in the options. It must be called with the same easy_handle as input as the curl_easy_init call returned. curl_easy_perform performs the entire request in a blocking manner and returns when done, or i.. 2020. 5. 5.
Event Object, CreateEvent.WaitForSingleObject 개요 CreateEvent 는 이벤트개체를 생성하는 함수이며, 이벤트 개체가 생성되면 함수 SetEvent, ResetEvent 로 이벤트 상태를 제어할 수 있다. 이벤트 상태를 점검하기 위하여 함수 WaitForSingleObject 이용가능하다. 이벤트 개체는 1개의 프로세스 내부뿐만 아니라, 다른 프로세스에서도 공유가능하다. HANDLE hEvent_WaitQRead_LOBDelta = NULL; //2번인자 : TRUE. signal 이후 non-signal로 하려면 ResetEvent 해줘야 함., FALSE : signal 이후 자동으로 non-signal로 됨. 3번인자 true : 초기 signaled 상태. hEvent_WaitQRead = CreateEvent(NULL, TRUE, TR.. 2020. 4. 20.
std::time_t tm gmtime localtime mktime asctime 헤더파일 #include std::time_t epoch (1970년 1월 1일 0시0분0초)이후 현재까지의 초단위 경과시간. std::tm 구조체 . 년,월,일,시,분,초 분리 처리시 용이. //UTC(=GMT) std::tm* gmtime( const std::time_t* time ); //로컬시 std::tm* localtime( const std::time_t *time ); 코드예-1. 현재시간 받고 년월일시분초 분리. std::time_t 로 epoch 이후의 초단위 시간을 tNow 로 받고, tNow로부터 현재의 년,월,일,시,분,초를 각각 구하기 위하여 std::localtime(&tNow) 함수이용하여 std::tm 구조체 형식으로 변경하여 각각의 멤버변수 tm_hour, tm_min,.. 2020. 3. 29.


 

비트코인




암호화폐       외환/나스닥/골드       암호화폐/외환/나스닥/골드 암호화폐/외환/나스닥/골드   암호화폐/외환/나스닥/골드
     
현물 |선물 인버스 |선물 USDT       전략매니저(카피트레이딩)     롤오버 이자 없는 스왑프리계좌
( 스왑프리 암호화폐도 거래 가능 )    
MT4, MT5 , cTrader 모두 지원     FTMO 계좌 매매운용. MT4,MT5