본문 바로가기

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


calling convention. __cdecl, __stdcall . 호출규약 __cdecl, __stdcall 함수 호출규약이라 부르는 것이며, 2개 의 가장 큰 차이점은 스택 지우기 처리 주체가 다르다는 점. __cdecl : 함수 호출한 곳에서 스택지움. __stdcall : 해당함수가 스택지움. /// __stdcall void __stdcall myFunction() { ... } /// __cdecl void __cdecl myFunction() { ... } //// 명시하지 않으면? __cdecl이 적용됨. void myFunction() { ... } DLL 노출함수에서 __stdcall 지정하는 코드. __declspec(dllexport) int __stdcall myFunction() { ... } /// __stdcall 을 기록하지 않으면 __cdecl 적.. 2019. 5. 13.
memcmp, memcpy, memset 헤더 : string.h int memcmp(주소1, 주소2, 바이트사이즈); 주소1과 주소2를 시작점으로 하여 바이트사이즈 만큼의 메모리 기록 된 값이 같으면 0 , 다르면 0 아닌값 반환. 주소1의 값 주소2의 값 이면 0보다 큰값 반환. void *memcpy(주소1,주소2,바이트사이즈); 주소2를 시작으로 하여 바이트사이즈 만큼의 데이터를 주소1에 복사. 반환값 : 주소1 void *memset(주소,바이트 데이터,바이트사이즈); 주소를 시작으로 바이트 사이즈 만큼 동일한 byte 데이터 기록. 반환값 : 주소 연관 memmove. 배열 시프트. memove(*dest, *src, bytesize) 1. src 를 시작으로 하여 bytes.. 2019. 3. 13.
float 형 변수에 할당된 4바이트 메모리의 각 바이트 단위로 접근하는법. 문제. 변수 선언이 float f_value; 처럼 float 으로 선언되어있어서, 통상적인 실수값을 이 변수에 대입(예 f_value = 3.789f )하여 실수로 활용하지 않고, f_value 에 할당된 메모리 4바이트들의 각 바이트들에 개별적으로 unsigned char 형의 값을 기록하고 각 바이트별로 저장된 값을 활용하고자 하는 경우. 즉, f_value 에 할당되어있는 메모리는 이렇게 생겼다 -> | 1번 바이트 | 2번 바이트 | 3번 바이트 | 4번 바이트 | 위 메모리의 각 바이트 접근하는법. float 형 변수 메모리의 각 바이트 별로 핸들링 하는법. unsigned char 형의 포인터 변수 생성 하고 여기에 f_value 의 주소를 (unsigned char*) 로 형변환한다. un.. 2019. 2. 20.
win32api. MessageBox int MessageBox( HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType ); Requirements. Header : winuser.h (include windows.h)Library : user32.lib DLL : user32.dll example codes int DisplayResourceNAMessageBox() { int msgboxID = MessageBox( NULL, (LPCWSTR)L"Resource not available\nDo you want to try again?", (LPCWSTR)L"Account Details", MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2 ); .. 2018. 9. 5.
HID driver for Windows OS. Human Interface Devices 윈도우에서의 HID driver 전체 개요. - HID : Human Interface Devices. TopicDescriptionWhat's New in HIDIntroduction to HID ConceptsThis section introduces Human Interface Devices (or HID). Typically, these are devices that humans use to directly control the operation of computer systems.HID ArchitectureThe architecture of the HID driver stack in Windows is built on the class driver named hidclass.sys.HID Cl.. 2018. 9. 5.
unreal. 기본 활용법. unreal 기본 활용법. 사전준비. 언리얼엔진 설치되어있고 새프로젝트 만들기 할 줄 아는 상태. 상세보기 : http://igotit.tistory.com/1382 unreal engine 기반 개발 위한 기초 지식 습득. 제조사에서 가이드 문서가 잘 되어있고, 아래 3개 따라하면서 숙지하면 기본 활용 지식 습득됨. 1. 레벨 디자이너 퀵스타트 : https://docs.unrealengine.com/latest/KOR/Engine/QuickStart/index.html 2. 아티스트 퀵스타트 : https://docs.unrealengine.com/latest/KOR/Engine/Content/QuickStart/index.html 3. 프로그래밍 퀵스타트 : https://docs.unrealeng.. 2017. 7. 26.
unreal. 언리얼엔진 새프로젝트 만들기. 개요 언리얼 엔진 에서 새프로젝트 만들기. 사전준비. 언리얼 엔진 설치된 상태. -> http://igotit.tistory.com/1380 상세 1. Unreal Engine Launcher 실행. 1. Epic Games Launcher 실행하고, 2. Launcher 실행화면 2. 언리얼 엔진 새프로젝트 만들기. 상기 Launchder 화면의 버튼 "실행" 클릭하면, Unreal Editor 가 실행되면서 프로젝트 생성 가능한 창 뜬다(아래 그림). C++ 템플릿, 블루프린트(스크립트) 템플릿 선택하여 프로젝트 생성가능하다. 탭 C++ 에서 기본코드 선택(가장 간단한것)하고 프로젝트 저장할 경로 지정하고 프로젝트명 기입후 버튼 "프로젝트 생성" 클릭. 프로젝트 생성진행률 창이 보이고 (약 3분 정도.. 2017. 7. 26.
MFC. RGB() 의 4바이트 정수 메모리 저장 바이트 순서. RGB( , , ) 에는 R,G,B 순으로 기록하며, RGB() 값을 정수형변수에 대입한 경우 즉, COLORREF refcolor = RGB(0xFA, 0xFB, 0xFC); // COLORREF 는 DWORD 혹은 uint32_t icolor = RGB(0xFA, 0xFB, 0xFC); icolor, refcolor 메모리 저장 바이트 오더링 : 0x 00 FC FB FA 로 저장됨. 즉, 4바이트 정수의 최상위 바이트에는 00, 그 다음 부터 R, G, B (최하위 바이트) 순으로 저장된다. ///1348 2017. 7. 11.
MFC. 클래스 위저드에서 커스텀 메시지 추가하기. 예: AFX_WM_PROPERTY_CHANGED 사용자 정의 메시지 클래스 위저드로 추가하는법. - 수동으로 타이핑 해도 되지만 클래스 위저드 이용하면 간단히 코드 자동 생성가능 . 등록하는 메시지 예 ; AFX 메시지 중 AFX_WM_PROPERTY_CHANGED 상세. Visual C++ 클래스 위저드 실행하여 뜬 창(아래 그림) 1번 : 이벤트 핸들러 추가할 클래스 지정하고, 2번 : 버튼 "Add Custom Message .." 클릭하여 뜬 창에서 메시지 아이디 기록부에 AFX_WM_PROPERTY_CHANGED 기록하면 (그림 붉은박스) 녹색부분에 메시지 핸들러 함수를 자동 생성해준다. 이 이름을 사용해도 되고 다른 이름으로 변경해도 된다. 본 예에서는 자동생성된 이름 그대로 이용. 체크 박스 Registered message 를 선택하면 .. 2017. 7. 10.
C++ 클래스. 인터페이스 클래스. interface. 개요 인터페이스 클래스정의 : 소멸자와 순수가상함수만 선언된 클래스. ( 순수가상함수, 추상클래스등의 기본 개념 보기 -> http://igotit.tistory.com/1325 ) 인터페이스 클래스 예. class ImyClass { public: virtual ~myClass() ; //소멸자. 꼭 선언하지 않아도 됨. virtual void myFunc1() = 0 ; // 순수가상함수. virtual void myFunc2() = 0 ; // 순수가상함수.}; 동영상. - 클래스위저드로 클래스 자동생성하여 생성자 제거하고 순수가상함수만 추가하면된다. Visual C++ 에서 제공되는 interface 자료형. Visual C++ 에서는 인터페이스 클래스 용도로 사용하기 위한 interface 자료.. 2017. 6. 25.
private . protected . public private - 다른 class 에서 접근 불가.- derived class 에서 접근불가. protected - 다른 class 에서 접근불가.- derived class 에서 접근가능. public - 모든 class 에서 접근가능. ///1324. 2017. 6. 22.
GetWindowsDirectory. 윈도우 설치된 경로가 c:\windows 라면 c:\windows 까지 받을 수 있음. 코드 작성예. TCHAR windows_path[MAX_PATH]; GetWindowsDirectory(windows_path,MAX_PATH); Retrieves the path of the Windows directory. This function is provided primarily for compatibility with legacy applications. New applications should store code in the Program Files folder and persistent data in the Application Data folder in the user's profile. For m.. 2017. 4. 16.
VerQueryValue. Retrieves specified version information from the specified version-information resource. To retrieve the appropriate resource, before you call VerQueryValue, you must first call the GetFileVersionInfoSize function, and then the GetFileVersionInfo function. SyntaxC++Copy BOOL WINAPI VerQueryValue( _In_ LPCVOID pBlock, _In_ LPCTSTR lpSubBlock, _Out_ LPVOID *lplpBuffer, _Out_ PUINT puLen ); Paramet.. 2017. 4. 15.
GetFileVersionInfo. Retrieves version information for the specified file. SyntaxC++Copy BOOL WINAPI GetFileVersionInfo( _In_ LPCTSTR lptstrFilename, _Reserved_ DWORD dwHandle, _In_ DWORD dwLen, _Out_ LPVOID lpData ); ParameterslptstrFilename [in]Type: LPCTSTRThe name of the file. If a full path is not specified, the function uses the search sequence specified by the LoadLibrary function. dwHandle Type: DWORDThis pa.. 2017. 4. 15.
Getting the System Version. The following example uses the Version API Helper functions to determine the version of the current operating system, if it is a Server or Client release, and then displays this information to the console. If compatibility mode is in effect, the example displays the operating system selected for application compatibility.To obtain the full version number for the operating system, call the GetFil.. 2017. 4. 15.
GetSystemInfo. Retrieves information about the current system.To retrieve accurate information for an application running on WOW64, call the GetNativeSystemInfo function.SyntaxC++Copyvoid WINAPI GetSystemInfo( _Out_ LPSYSTEM_INFO lpSystemInfo ); ParameterslpSystemInfo [out]A pointer to a SYSTEM_INFO structure that receives the information.Return valueThis function does not return a value.ExamplesFor an example.. 2017. 4. 15.
WM_USER, WM_APP. 메시지 번호 범위 용도. WM_USER, WM_APP WM_USER 와 WM_APP 는 각각 0x0400 (십진 1024), 0x8000 (십진 32768 ) 으로 선정의되어있다. WM_USER ~ WM_USER+31743 영역이나, WM_APP ~ WM_APP+16383 모두 사용자 정의 메시지로 활용가능하나, WM_USER ~ WM_USER+31743 영역은 MFC대화상자를 비롯하여 BUTTON. EDIT, LISTBOX등의 컨트롤러에서 사용될 수 도 있기 때문에 메시지 중복 발생 위험성 있다. 이런 컨트롤러들이 어떤 메시지 번호를 사용하는지 파악하여 이 번호를 피하면서 사용자 정의 메시지 번호 할당하는 작업은 비효율적이다. 한편, WM_APP ~ WM_APP+16383 영역은 MFC, Control등에서 메시지로 사용되지 .. 2017. 4. 6.
SendNotifyMessage. SendNotifyMessage 주요특징. 대상 윈도우로 메시지 전송하나, SendNotifyMessage 호출하는 윈도우 스레드와 대상 윈도우 스레드에 따라 다른 리턴 방식. 다른 스레드의 대상 윈도우인 경우 : 대상윈도우의 procedure 로 메시지 전달하고 즉시 리턴. 동일 스레드의 대상 윈도우인 경우 : 대상윈도우의 procedure 로 메시지 전달하고 대상윈도우의 procedure 가 처리 완료한 이후 리턴됨. SendNotifyMessage functionSends the specified message to a window or windows. If the window was created by the calling thread, SendNotifyMessage calls the windo.. 2017. 4. 6.


비트코인




            암호화폐/외환/나스닥/골드          
       
현물 |선물 인버스 |선물 USDT , bybit MT5               프랍 트레이딩. MT4,MT5