본문 바로가기

[MFC] 다양한 문자열 형식간 변환 출처: http://msdn.microsoft.com/ko-kr/library/ms235631.aspx 1) char * -> wchar_t*, _bstr_t, CComBSTR, CString, basic_string, System.String// convert_from_char.cpp // compile with: /clr /link comsuppw.lib #include #include #include #include "atlbase.h" #include "atlstr.h" #include "comutil.h" using namespace std; using namespace System; int main() { // Create and display a C style string, and then .. 더보기
[MFC] _RecordsetPtr RecordCount returns -1 출처: http://www.adopenstatic.com/faq/recordcounterror.asp RecordCount returns -1The use of the ADO Recordset's .RecordCount property requires either the use of:Static or Keyset server-side cursors orA client-side cursor (which returns a Static cursor)(Note: some OLEDB Providers will return the correct recordcount with an adOpenDynamic cursor, others will not).By default Recordsets are opened serv.. 더보기
[MFC] CListctrl, CTreectrl Drag And Drop 오류 (No Text Error) 리스트컨트롤이나, 트리컨트롤에서 드래그 앤 드랍을 사용할 경우 아래와같은 문제가 발생할 때가 있다.사진출처) 구글 검색 원인은 XP부터 생겨난 ClearType 글꼴의 안티앨러싱(?)설정 때문.. 해결방법은 드래그 이미지를 생성하는 CreateDragImage함수 호출전에 안티앨러싱을 제거한 폰트를 설정하고,호출이 종료되면 원설정의 폰트상태로 복구하는 것. 주의할 사항) Font는 지역변수가 아닌, 전역/멤버변수로 선언하여 프로그램이 실행되는 동안 객체가 유지되어야 한다.CFont설정 참조: http://ogoons.tistory.com/43 적용 코드) 현재 코드는 트리컨트롤일때를 가정했지만, 리스트컨트롤의 경우에도 몇몇 설정을 제외하고는 동일하다.//CFont 선언 CFont *m_pDragFont;.. 더보기
[스크랩] C언어 가변인자(가변파라미터)를 사용해보자 출처 : http://norus.tistory.com/19#comment12673780 printf의 원형을 찾아보신 분이 계실지 모르겠지만, printf의 원형을 찾아보면 다음과 같습니다. int Printf (const char* Format, ...)(실제 정의되어 있는 부분과 약간 차이가 있을 수 있습니다.) 위에 보이시는 "..." 이 부분이 가변 인자 혹은 가변 파라미터라고 불리우는 것입니다. printf를 쓸 때 느끼셨겠지만, 파라미터로 아무것도 넘겨주지 않을 수도 있고, 여러개를 넘겨줄 수도 있습니다. 가변 인자가 무엇인지 알았으니 이제 차근차근 설명해 드리도록 하겠습니다. 우선, 가변 인자 함수를 만들기 위해서는 stdarg.h 헤더가 필요합니다. 이 헤더에 가변인자함수를 만들 때 필요한.. 더보기
[MFC]기존 프로젝트에 WinSock(CSocket) 추가하기 초기화 함수에서 아래 코드 추가if(!AfxSocketInit()){AfxMessageBox("Socket Initialize Error");return false;} stdafx.h 파일에 아래 코드 추가#include 더보기