'개소리 왈왈' 카테고리의 다른 글
조현아 vs 탑 (0) | 2017.06.09 |
---|---|
19대 대선 유권자 수 (0) | 2017.05.09 |
대전 현충원 안장자 검색 (0) | 2017.01.07 |
경기가 안좋긴 하나보네 (0) | 2016.12.10 |
이상하다 꿈을 꾼건가.. (0) | 2016.05.14 |
조현아 vs 탑 (0) | 2017.06.09 |
---|---|
19대 대선 유권자 수 (0) | 2017.05.09 |
대전 현충원 안장자 검색 (0) | 2017.01.07 |
경기가 안좋긴 하나보네 (0) | 2016.12.10 |
이상하다 꿈을 꾼건가.. (0) | 2016.05.14 |
GetLBText() 로 해당 인덱스의 문자열을 받아올 수 있다.
[링크 : http://six605.tistory.com/250]
Gets a string from the list box of a combo box. int GetLBText( int nIndex, LPTSTR lpszText ) const;
void GetLBText( int nIndex, CString& rString ) const; |
[링크 : https://msdn.microsoft.com/en-us/library/zcy9kze7(v=vs.110).aspx]
MFC 시간측정(msec) (0) | 2017.04.18 |
---|---|
MFC 다이얼로그 자세히(접기) (0) | 2017.04.14 |
MFC 라디오버튼 사용하기 (0) | 2017.04.05 |
mfc cstring 문자열 관련(유니코드) (0) | 2017.04.04 |
bit field와 컴파일러별 byte align (0) | 2017.03.27 |
귀찮아서 대충 구현했는데..
char 배열을 써야지 CString::GetBuffer(n) 으로 버퍼를 받아오니 이상해지네..
설정은 좀더 찾아 봐야겠지만, 자동으로timeout 걸리면서 최대 20자 까지 읽도록 설정이 된 것 같다.
{ CString port; port = _T("\\\\.\\") + port; HANDLE m_hCommPort = ::CreateFile(port, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0/*FILE_FLAG_OVERLAPPED*/, 0); DCB dcb = {0}; dcb.DCBlength = sizeof(DCB); if (!::GetCommState (m_hCommPort,&dcb)) { TRACE ("CSerialCommHelper : Failed to Get Comm State Reason: %d", GetLastError()); return E_FAIL; }
dcb.BaudRate = 115200 dcb.ByteSize = 8; dcb.Parity = 0; dcb.StopBits = ONESTOPBIT;
if (!::SetCommState (m_hCommPort,&dcb)) { ASSERT(0); TRACE ( "CSerialCommHelper : Failed to Set Comm State Reason: %d", GetLastError()); return E_FAIL; } CString hex_query="ffeeddccbbaa00";
DWORD iolen; int iRet = WriteFile (m_hCommPort, hex_query, hex_query.GetLength(),&iolen ,NULL); char temp[20]; int abRet = ReadFile(m_hCommPort, &temp ,20, &iolen, NULL) ; temp[iolen] = '0x00'; CloseHandle(m_hCommPort); return 0; } |
[링크 : http://blog.daum.net/chowood/8039404]
[링크 : http://forum.falinux.com/zbxe/index.php?document_srl=572257]
[링크 : http://forum.falinux.com/zbxe/index.php?document_srl=572404]
[링크 : http://forum.falinux.com/zbxe/index.php?document_srl=572588]
[링크 : http://forum.falinux.com/zbxe/index.php?document_srl=572862]
[링크 : https://www.codeproject.com/Articles/2682/Serial-Communication-in-Windows]
win10 시리얼 포트 사용 문제(시리얼 마우스 인식) (0) | 2017.04.11 |
---|---|
mfc readfile timeout 설정 (0) | 2017.04.06 |
시리얼 baudrate 목록 (0) | 2017.04.05 |
win32 시리얼 포트 목록 얻기 (0) | 2017.04.05 |
mfc CreateFile com10 이상 열기 (0) | 2017.04.04 |
1200 미만으로는 생소하고...
56000이냐 57600이냐는 좀 헷갈리네..
아무튼 가끔 쓸데 있으니 일단 링크!
|
[링크 : http://digital.ni.com/public.nsf/allkb/D37754FFA24F7C3F86256706005B9BE7]
mfc readfile timeout 설정 (0) | 2017.04.06 |
---|---|
mfc win32 시리얼 (0) | 2017.04.05 |
win32 시리얼 포트 목록 얻기 (0) | 2017.04.05 |
mfc CreateFile com10 이상 열기 (0) | 2017.04.04 |
시리얼 baudrate별 1바이트 당 전송시간 (0) | 2017.03.17 |
MFC 에서 쓸려면
Group을 설정해야 하는데
여러개를 묶을때 처음 녀석을 Group True로 설정
그리고 나머지는 False로 하고
가장 처음 Group True로 된 녀석에게 변수를 추가해주는데
대개는 DDX 사용하도록 권장하는 듯
[링크 : http://armcc.tistory.com/67]
수작업(!)으로 하려면
라디오 버튼은 CButton을 사용하기 때문에
GetCheckedRadioButton(first, last); 메소드를 이용해서 체크된 녀석의 ID를 받아오거나
[링크 : http://toring92.tistory.com/137]
여러개의 그룹을 수작업으로
((CButton*)GetDlgItem(IDC_RADIO1))->GetCheck() 이런식으로 일일이 체크해야 할 듯 하다.
[링크 : http://stackoverflow.com/questions/1165619/mfc-radio-buttons-ddx-radio-and-ddx-control-behavior]
MFC 다이얼로그 자세히(접기) (0) | 2017.04.14 |
---|---|
mfc ccombobox 문자열 받아오기 (0) | 2017.04.05 |
mfc cstring 문자열 관련(유니코드) (0) | 2017.04.04 |
bit field와 컴파일러별 byte align (0) | 2017.03.27 |
MFC CButton 마우스 클릭시 작동하기 (0) | 2017.03.08 |
c#이나 .net framework을 쓰면 간편한데
win32로는 영 복잡할수 밖에 없는 듯?
그런데 QueryDosDevice()를 쓰면 0ms 라는데
|
[링크 : http://stackoverflow.com/.../how-do-i-get-a-list-of-available-serial-ports-in-win32]
m_MyPort 변수만 다른걸로 바꿔써주면 잘 작동 하는 듯
단, unicode 기반에서는 (LPSTR)대신 (LPWSTR)로 해주어야 에러가 나지 않는다.
void SelectComPort() //added function to find the present serial
{
TCHAR lpTargetPath[5000]; // buffer to store the path of the COMPORTS
DWORD test;
bool gotPort=0; // in case the port is not found
for(int i=0; i<255; i++) // checking ports from COM0 to COM255
{
CString str;
str.Format(_T("%d"),i);
CString ComName=CString("COM") + CString(str); // converting to COM0, COM1, COM2
test = QueryDosDevice(ComName, (LPSTR)lpTargetPath, 5000);
// Test the return value and error if any
if(test!=0) //QueryDosDevice returns zero if it didn't find an object
{
m_MyPort.AddString((CString)ComName); // add to the ComboBox
gotPort=1; // found port
}
if(::GetLastError()==ERROR_INSUFFICIENT_BUFFER)
{
lpTargetPath[10000]; // in case the buffer got filled, increase size of the buffer.
continue;
}
}
if(!gotPort) // if not port
m_MyPort.AddString((CString)"No Active Ports Found"); // to display error message incase no ports found
}
[링크 : http://stackoverflow.com/.../what-is-proper-way-to-detect-all-available-serial-ports-on-windows]
mfc win32 시리얼 (0) | 2017.04.05 |
---|---|
시리얼 baudrate 목록 (0) | 2017.04.05 |
mfc CreateFile com10 이상 열기 (0) | 2017.04.04 |
시리얼 baudrate별 1바이트 당 전송시간 (0) | 2017.03.17 |
시리얼 포트 관련 trouble shotting (0) | 2010.02.08 |
GCC G++ 공식문서를 찾지 못했는데
아무튼.. wchar_t 로 wide character형이 추가된것 외에는 차이가 없는듯
kldp 쪽을 봐도 gcc에서는 UTF-32 4byte 로 된다는 정도만 있는것 봐서는
MSVC에 비해 유니코드 대응이 미진하긴 미진 한 듯.
wchar_t
type for wide character representation (see wide strings). Required to be large enough to represent any supported character code point (32 bits on systems that support Unicode. A notable exception is Windows, where wchar_t is 16 bits and holds UTF-16 code units) It has the same size, signedness, and alignment as one of the integral types, but is a distinct type.
gcc variadic macro (0) | 2017.06.20 |
---|---|
문자열에 escape 로 특수문자 넣기 (0) | 2017.06.19 |
gcc 매크로 확장 define stringfication (0) | 2017.01.02 |
gcc make CFLAGS=-D 관련 (0) | 2016.11.17 |
gcc -fPIC (0) | 2016.06.22 |
음.. CString에서 제공하는 메소드는 아래뿐이네.. GetData() 나 다른것들은 상속에 의해서 다른 클래스에서 온 듯
operator LPCTSTR GetBuffer() |
[링크 : https://msdn.microsoft.com/en-us/library/aa315043(v=vs.60).aspx]
GetString()은 누구꺼냐.. CObject의 스멜이 나긴 한다만...
(LPCTSTR)로 캐스팅하는 것과 거의 구현이 같은 GetString() 이란 메소드도 있습니다. |
[링크 : https://indidev.net/forum/viewtopic.php?f=5&t=92]
음.. 걍 void* 형으로 캐스팅?
CString str = L"английский"; //Russian Language DWORD dwWritten=0; WriteFile(pHandle , (void*) str, str.GetLength()*sizeof(TCHAR),&dwWritten , NULL); |
[링크 : https://social.msdn.microsoft.com/.../how-to-send-unicode-characters-to-serial-port?forum=vcgeneral]
LPSTR - Long Pointer STRing
LPCSTR - LP Const STRing
LPTSTR - LP Tchar STRing
LPCTSTR - LPC Tchar STRing
LPWSTR - LP Wchar STRing
LPCWSTR - LP Const Wchar STRing
[링크 : http://pelican7.egloos.com/v/1768951]
char 형식의 좁은 문자 리터럴(예: 'a') wchar_t 형식의 와이드 문자 리터럴(예: L'a') char16_t 형식의 와이드 문자 리터럴(예: u'a') char32_t 형식의 와이드 문자 리터럴(예: U'a') |
[링크 : https://msdn.microsoft.com/ko-kr/library/69ze775t.aspx]
TEXT("")과 _T("")의 차이점은 TEXT("")는 WinNT.h에서 #define했고 _T("")는 tchar.h에서 TEXT가 4글자라서 _T이렇게 2글자로 #define했다. |
[링크 : http://x108zero.blogspot.kr/2013/12/text-t-l.html]
+
tchar.h
#define __T(x) L ## x
#define _T(x) __T(x)
음.. L 이야 Long에 대한 prefix literal 이니...까?
mfc ccombobox 문자열 받아오기 (0) | 2017.04.05 |
---|---|
MFC 라디오버튼 사용하기 (0) | 2017.04.05 |
bit field와 컴파일러별 byte align (0) | 2017.03.27 |
MFC CButton 마우스 클릭시 작동하기 (0) | 2017.03.08 |
GetHttpConnection() (0) | 2017.03.03 |
시리얼포트 10번 이후 열기라는 글이 있어서 보니
버그가 있어서 COM9 까진 그냥 여는데, 그 이후에는
\\.\COM%d 식으로 표현을 해야 하는데 escape 문자를 넣어주어야 하니 이렇게 미친듯이 길어진다.
hPort = CreateFile("\\\\.\\COM10", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); |
[링크 : http://stackoverflow.com/questions/11775185/open-a-com-port-in-c-with-number-higher-that-9]
시리얼 baudrate 목록 (0) | 2017.04.05 |
---|---|
win32 시리얼 포트 목록 얻기 (0) | 2017.04.05 |
시리얼 baudrate별 1바이트 당 전송시간 (0) | 2017.03.17 |
시리얼 포트 관련 trouble shotting (0) | 2010.02.08 |
MFC 프로젝트(SDI)에서 CSerial 사용하기 예제 (0) | 2009.06.15 |
심심해서 계산을 해보니
많이 차이나는데?
소주 360ml 20~16.5도 59.4ml~72ml(알콜함량)
병맥 500ml 4.5도 22.5ml(알콜함량)
알콜양으로도 맥주 두병은 먹어야 소주 한병 될까 말까네?
아.. 큐팩은
1800ml 4.5도 81ml 이니까 소주보다 많아지는군 ㅋ
연휴 끝 (0) | 2017.05.07 |
---|---|
망할 실손보험 !!! (0) | 2017.04.11 |
대한통운 택배 스미싱? (0) | 2017.03.27 |
AMD 라이젠(zen) 프로세서 발표 (0) | 2017.03.05 |
환공어묵 (0) | 2017.02.23 |