// 생성 pthread_create(&thread_t, NULL, ProcessThread, (void *)ClntSock); // 쓰레드 함수 void *ProcessThread(void *arg) { // pthread_join 을 하지 않을것임으로 // detach 를 해줘서 쓰레드 종료시 // 쓰레드 자원을 정리할수 있도록 해줘야 한다. // 안그러면 자원을 다 쓰고 난 후 데몬이 죽어 버린다. pthread_detach(pthread_self()); while((strLen = read(clntSock, Buffer, sizeof(Buffer))) != 0) { // 작업내용 } ClientClose(clntSock); LogWrite("... End Thread"); }
// 헤더 파일 HANDLE m_CloseEvent; // 본문 #define CLOSE_WAIT_TIME 60000 // 생성자 m_CloseEvent = CreateEvent(NULL, FALSE, FALSE, NULL); // 스레드 내부 // _beginthreadex() unsigned int __stdcall TMainFrm::SendThread(void *pParam) { TMainFrm *Dlg = (TMainFrm *)pParam; while(Dlg->m_bActive) { if(WaitForSingleObject(m_CloseEvent, CLOSE_WAIT_TIME) == WAIT_TIMEOUT) { // CLOSE_WAIT_TIME 만큼 기다렸다 동작하게 된다. } } return 0..
1. 클래스 헤더안에 static으로 선언 class TestDlg { public : static DWORD WINAPI ThreadHandler(LPVOID lpParam); // CreateThread static unsigned int __stdcall ThreadHandler(void *pParam); // _beginthreadex } 2. 클래서 내용안에 정의 // CreateThread DWORD WINAPI TestDlg::ThreadHandler(LPVOID lpParam) { TestDlg *Dlg = (TestDlg *)lpParam; while(TRUE) { ... } return 0; } // _beginthreadex() unsigned int __stdcall TestDlg:..
ui->LblText->setStyleSheet("QLabel { color : white; }");
png 이미지를 리소스에 넣은 후 ui->BtnOk->setStyleSheet("QPushButton{background:url(:image/22/006_782x578.png);border:0px;}" "QPushButton:hover{background:url(:image/22/006_782x578.png);border:0px}" "QPushButton:pressed{background:url(:image/22/007_782x578.png); position: relative;top: 1px; left: 1px;}");
QPixmap pixmap("/mirae/img/test.png"); QIcon TestIcon(pixmap); QPalette palette; palette.setBrush(ui->BtnTest->backgroundRole(), QBrush(pixmap)); ui->BtnTest->setIcon(TestIcon); ui->BtnTest->setIconSize(QSize(pixmap.width(), pixmap.height())); ui->BtnTest->setGeometry(ui->BtnTest->x(), ui->BtnTest->y(), pixmap.width(), pixmap.height()); ui->BtnTest->setFlat(true); ui->BtnTest->setAutoFillBackgro..
- Total
- Today
- Yesterday