// 서버 연결 char __fastcall ServerConnect(void) { if(m_TcpClient->Connected()) m_TcpClient->Disconnect(); struct hostent *pHostEnt; unsigned char IP[4]; AnsiString Addr; // 도메인 이름으로 IP주소 알아오기 pHostEnt = gethostbyname(SERVER_HOST); memcpy(IP, pHostEnt->h_addr, 4); Addr.sprintf("%d.%d.%d.%d", IP[0], IP[1], IP[2], IP[3]); m_TcpClient->Host = Addr; m_TcpClient->Port = SERVER_PORT; try { m_TcpClient->Co..
#define MY_UNIQUE_MUTEXT ( "633741A7-2449-4209-804E-86E29BE36D23" ) HANDLE hMutexOneInstance; char bFound; //중복실행 체크 hMutexOneInstance = ::CreateMutex(NULL, TRUE, MY_UNIQUE_MUTEXT); // 만약 이미 만들어져 있다면 Instance가 이미 존재함 if(::GetLastError() == ERROR_ALREADY_EXISTS) bFound = TRUE; if(hMutexOneInstance) ::ReleaseMutex(hMutexOneInstance); // 이미 하나의 Instance가 존재하면 프로그램 종료 if(bFound) { MsgBox("프로그램이 이미 실..
#include AnsiString __fastcall GetLocalIP(void) { WSAData wsaData; if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) return ""; char slocal[256]; if (gethostname(slocal, 256) == SOCKET_ERROR) return ""; hostent *hos = gethostbyname(slocal); if(hos == NULL) return ""; char *addr = *(hos->h_addr_list); AnsiString LocalIP = AnsiString((unsigned char)addr[0]) + '.' + AnsiString((unsigned char)addr[1]) ..
void __fastcall GetExcel(void) { Variant XlApp; Variant XlBooks; Variant XlBook; Variant XlSheets; Variant XlSheet; Variant VCell; AnsiString CelValue; int ColCount; int RowCount; int Row, Col; AnsiString Data[3]; char StopFlag = FALSE; try { XlApp = Variant::CreateObject("Excel.Application"); XlBooks = XlApp.OlePropertyGet("Workbooks"); XlBooks.OleProcedure("Open", WideString(m_ExcelFile)); XlB..
#include void __fastcall TLoginDlg::SetAutoStart(void) { TRegistry *Reg = new TRegistry; Reg->RootKey = HKEY_LOCAL_MACHINE; Reg->OpenKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", TRUE); Reg->WriteString("제목", "C:\\경로\\프로그램.exe"); Reg->Free(); }
#define ENCODED_TYPE 0x00 #define DETOXICATION_TYPE 0x01 #define PWD_KEY 23 AnsiString __fastcall SecretWork(char SecretType, AnsiString Data) { unsigned int Len; char strData[512]; AnsiString RetStr; memset(strData, 0x00, sizeof(strData)); strcpy(strData, Data.c_str()); if(SecretType == ENCODED_TYPE) { for(Len = 0; Len < strlen(strData); Len ++) strData[Len] += PWD_KEY; } else { // DETOXICATION..
#include void __fastcall TLoginDlg::GetRegistry(void) { TRegistry *Reg = new TRegistry; Reg->RootKey = HKEY_CURRENT_USER; Reg->OpenKey(REG_PROGRAM, TRUE); if(Reg->ValueExists(REG_ID)) { EdtId->Text = Reg->ReadString(REG_ID); m_AutoLogin = TRUE; } if(Reg->ValueExists(REG_PW)) EdtPw->Text = SecretWork(DETOXICATION_TYPE, Reg->ReadString(REG_PW)); if(Reg->ValueExists(REG_SERVER)) RgSql->ItemIndex = ..
- Total
- Today
- Yesterday