void child_process_recv(int sockfd) { char buf[N]; struct sockaddr_in serveraddr, clientaddr; socklen_t addrlen = sizeof(struct sockaddr); DLinkList* list=DLinkList_Create(); while(1) { if(recvfrom(sockfd, &buf, N, 0, (struct sockaddr*)&clientaddr, &addrlen) < 0) { err_log("fail to recvfrom\n"); } printf("%s\n",buf); switch(buf[0]) { case 'C': we_chat(sockfd, list,buf,clientaddr); break; case 'Q': user_quit(sockfd, list,clientaddr); break; case 'L': user_login(sockfd, list,buf,clientaddr); break; } } }
int main() { struct sockaddr_in peeraddr; socklen_t addrlen; pid_t pid; sockfd = network_init(); if (-1 == pipe(pipefd)) error_exit("pipe"); mesgbuff = (mesgpack_st *)malloc(sizeof(mesgpack_st)); userlist = (linknode_st *)malloc(sizeof(linknode_st)); userlist->next = NULL; if (-1 == (pid = fork())) error_exit("fork"); /* ============== child, process client message ===============*/ if (0 == pid) { close(pipefd[1]); signal(SIGUSR1, sigusr1_handler); while (1) { if( 0 >= recvfrom(sockfd, mesgbuff, sizeof(mesgpack_st),0, (struct sockaddr *)&peeraddr, &addrlen)) perror("child:recvfrom"); printf("[%d]%s:%d\n", addrlen, inet_ntoa(peeraddr.sin_addr), ntohs(peeraddr.sin_port)); switch (mesgbuff->type) { case CMD_CHAT: broadcast(sockfd, userlist, mesgbuff); break; case CMD_LOGIN: user_login(sockfd, userlist, (struct sockaddr *)&peeraddr, mesgbuff); break; case CMD_LOGOUT: user_logout(sockfd, userlist, (struct sockaddr *)&peeraddr, mesgbuff); break; default: break; } } } else { /* ================ father process local data ============= */ close(pipefd[0]); strcpy(mesgbuff->user, "system"); setbuf(stdout, NULL); while (1) { printf(">"); fgets(mesgbuff->data, DATA_BUFF_LEN, stdin); write(pipefd[1], mesgbuff->data, DATA_BUFF_LEN); kill(pid, SIGUSR1); } } return 0; }
static void start_client() { extern struct commands_t cmdlist[]; int nreg; /* system init */ currmode = 0; signal(SIGHUP, abort_bbs); signal(SIGTERM, abort_bbs); signal(SIGPIPE, abort_bbs); signal(SIGINT, abort_bbs_debug); signal(SIGQUIT, abort_bbs_debug); signal(SIGILL, abort_bbs_debug); signal(SIGABRT, abort_bbs_debug); signal(SIGFPE, abort_bbs_debug); signal(SIGBUS, abort_bbs_debug); signal(SIGSEGV, abort_bbs_debug); signal_restart(SIGUSR1, talk_request); signal_restart(SIGUSR2, write_request); dup2(0, 1); do_term_init(); signal(SIGALRM, abort_bbs); alarm(600); login_query(); /* Ptt 加上login time out */ user_login(); m_init(); #if FORCE_PROCESS_REGISTER_FORM if (HAS_PERM(PERM_SYSOP) && (nreg = dashs(fn_register)/163) > 100) { char cpu_load[30]; if(cpuload(cpu_load) > MAX_CPULOAD*2/3) /* DickG: 根據目前的 load 來 */ scan_register_form(fn_register, 1, nreg/20); /* 決定要審核的數目 */ else scan_register_form(fn_register, 1, nreg/10); } #endif if(HAVE_PERM(PERM_SYSOP | PERM_BM)) b_closepolls(); if(!(cuser.uflag & COLOR_FLAG)) showansi = 0; #ifdef DOTIMEOUT /* init_alarm();*/ // cause strange logout with saving post. signal(SIGALRM, SIG_IGN); #else signal(SIGALRM, SIG_IGN); #endif if(chkmailbox()) m_read(); domenu(MMENU, "主功\能表", (chkmail(0) ? 'M' : 'C'), cmdlist); }
MusicWindow::MusicWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MusicWindow) { ui->setupUi(this); playNum = 1; last_PlayNum = 0; search_Last = 0; player = new QMediaPlayer; lyric = new MyLyric(this); playMode = "order"; ui->volumeSlider->setValue(player->volume()); thread = new Thread(this); //线程实例化 //窗口初始化 setElement_BackGround(); //检测音乐播放进度,同时调整播放滑块 connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(updateTime(qint64))); connect(player, SIGNAL(durationChanged(qint64)), this, SLOT(setPlayRange(qint64))); connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(setPlayPosition(qint64))); connect(player, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(lyric_Sync(QMediaPlayer::State))); //调整播放进程 connect(ui->timeSlider, SIGNAL(sliderMoved(int)), this, SLOT(setSliderPosition())); connect(ui->volumeSlider, SIGNAL(sliderMoved(int)), this, SLOT(adjustVolume())); connect(ui->browserHideButton, SIGNAL(clicked()), this, SLOT(browserSet())); connect(ui->setApearenceButton, SIGNAL(clicked()), this, SLOT(setApearence())); connect(ui->addButton, SIGNAL(clicked()), this, SLOT(load_again())); connect(ui->lyricButton, SIGNAL(clicked()), this, SLOT(show_Hide_Lyric())); connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextSong())); connect(ui->lastButton, SIGNAL(clicked()), this, SLOT(lastSong())); connect(ui->playButton, SIGNAL(clicked()), this, SLOT(playEvent())); connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(doubleClickedPlay(QListWidgetItem *))); connect(ui->quitButton, SIGNAL(clicked()), this, SLOT(warning())); connect(ui->markButton, SIGNAL(clicked()), this, SLOT(markSong())); connect(ui->setApearenceButton, SIGNAL(clicked()), this, SLOT(setApearence())); connect(ui->muteButton, SIGNAL(clicked()), this, SLOT(set_Mute())); connect(ui->storeButton, SIGNAL(clicked()), this, SLOT(store_Show())); connect(ui->favoriteButton, SIGNAL(clicked()), this, SLOT(favoriteSongs_Show())); connect(ui->browserButton, SIGNAL(clicked()), this, SLOT(browser_Show())); connect(ui->loginButton, SIGNAL(clicked()), this, SLOT(user_login())); connect(ui->downloadButton, SIGNAL(clicked()), this, SLOT(download_File())); connect(ui->modeButton, SIGNAL(clicked()), this, SLOT(playMode_Change())); connect(ui->smallButton, SIGNAL(clicked()), this, SLOT(showMinimized())); connect(ui->searchEdit, SIGNAL(textChanged(QString)), this, SLOT(songs_Search(QString))); //子线程 connect(thread, SIGNAL(upgrade_Signal(int, QStringList, QStringList, QFileInfoList)), this, SLOT(upgradeData(int, QStringList, QStringList, QFileInfoList)), Qt::DirectConnection ); //载入音乐 musicLoad(); Sleep(1000); }
Json::Value WykopSDK::authenticate(std::string login, std::string accountkey, std::string password){ std::string login_ = (login == "" ? this->login:login); std::string accountkey_ = (accountkey == "" ? this->accountkey:accountkey); std::string password_ = (password == "" ? this->password:password); Json::Value value; if(login_ != "" and accountkey_ != ""){ value = user_login(login_, accountkey_); }else if (login_ != "" and password_ != ""){ value = user_login_password(login_, password_); } return value; }
extern "C" void handle_login(const char* request,char* feedback){ Json::Value feedback_root; char username[32],password[32],real_name[32]; get_user(request,username,password,real_name); bool result = user_login(username, password, real_name); if (result) { feedback_root["result"] = "pass"; feedback_root["message"] = "login seccess!"; feedback_root["real_name"] = real_name; } else { feedback_root["result"] = "fail"; feedback_root["message"] = "wrong username or password!"; } strcpy(feedback,feedback_root.toStyledString().c_str()); }
static void* handleThread(int *fd) { int sockfd; char buff[MAXSIZE]; int rwsize; USER usermsg; sockfd = *fd; rwsize = epoll_read(sockfd, buff, MAXSIZE); //printf("receve:%s\n", buff); //epoll_write(sockfd, buff); memcpy(&usermsg, buff, sizeof(buff)); usermsg.From_sockfd = sockfd; switch(usermsg.MsgType) { /*登陆*/ case 1: user_login(&usermsg); memcpy(buff, &usermsg, sizeof(usermsg)); epoll_write(sockfd, buff); break; /*注册*/ case 2: user_register(&usermsg); memcpy(buff, &usermsg, sizeof(usermsg)); epoll_write(sockfd, buff); break; /*找回密码*/ case 3: break; } return (void*)0; }
void start_client(void) { extern char currmaildir[]; initialize_mdb(); #ifndef ENABLE_SSH initialize_db(); #endif initialize_convert_env(); system_init(); if (setjmp(byebye)) { system_abort(); } strlcpy(BoardName, BBSNAME, sizeof(BoardName)); if (login_query() == -1) { terminal_flush(); sleep(3); exit(1); } #ifndef ENABLE_SSH screen_negotiate_size(); #endif // ENABLE_SSH screen_init(0); user_login(); setmdir(currmaildir, currentuser.userid); RMSG = NA; screen_clear(); editor_restore(); #ifdef TALK_LOG tlog_recover(); #endif if (strcmp(currentuser.userid, "guest")) { if (check_maxmail()) pressanykey(); screen_move(9, 0); screen_clrtobot(); if (!DEFINE(DEF_NOLOGINSEND)) if (session_visible()) login_msg(); screen_clear(); set_numofsig(); } active_board_init(false); fill_date(); if (DEFINE(DEF_LOGFRIEND) && session_count_online_followed(!HAS_PERM(PERM_SEECLOAK)) > 0) show_online_followings(); menu_load("menu.img"); while (1) { if (DEFINE(DEF_NORMALSCR)) menu_loop("TOPMENU"); else menu_loop("TOPMENU2"); Goodbye(); } }
void server_parse_input(char * message){ //if query is empty... do nothing if(strlen(message)==0)return; //if query is type 1 - login user if(message[0]=='1'){ //skip first 2 characters "1|" message+=2; //alocate memory for user user_t * user = malloc(sizeof(user_t)); //copy username char * separator = strchr(message,'|'); separator[0]='\0'; user->username = malloc((strlen(message)+1)*sizeof(char)); strcpy(user->username, message); //erase copied characters from message message = separator+1; //copy password user->password = malloc((strlen(message)+1)*sizeof(char)); strcpy(user->password, message); //authentificate used if(user_auth(user)){ //and log in if(!user_login(user)){ message_send(user,"Server is full !!!\n"); free(user->username); free(user->password); free(user); } } //wrong credentials else{ message_send(user,"Login incorrect\n"); free(user->username); free(user->password); free(user); } } //if query is of type 2 - send online users else if(message[0]=='2'){ //print to server console printf("Sending online users\n"); //skip first 2 characters - 2| message+=2; //call function with given name of named pipe print_online(message); } //query is of type 3 - send message //query format is 3|from|to|message else if(message[0]=='3'){ //skip first 2 characters - 3| message+=2; //copy "from" char * separator = strchr(message,'|'); separator[0]='\0'; char * from = malloc((strlen(message)+1)*sizeof(char)); strcpy(from, message); //erase copyied characters message = separator+1; //copy "to" separator = strchr(message,'|'); separator[0]='\0'; char * to = malloc((strlen(message)+1)*sizeof(char)); strcpy(to, message); //erase copied characters message = separator+1; //find user "to" user_t * user=NULL; for(int i=0; i<SERVER_CAPACITY; i++){ if(users_logged[i] && !strcmp(users_logged[i]->username,to)){ user=users_logged[i]; } } //if we have found user "to" if(user){ //compose message char tmp[BUFFER_SIZE]; tmp[0]='\0'; strcat(tmp,from); strcat(tmp," -> "); strcat(tmp,message); strcat(tmp,"\n"); //send message to user "to" message_send(user,tmp); //print message to server console printf("User %s sent a message to %s\n",from, to); } //free used memory free(from); free(to); } //query is of type 4 - logout user else if(message[0]=='4'){ //erase first 2 characters - 4| message+=2; //logout user user_logout(message); } }
int ParseKMP(char *cmd, REQUEST_REC *r) { char kmp[STRLEN], proto[STRLEN], data[STRLEN], arg1[STRLEN], arg2[STRLEN], arg3[STRLEN], arg4[STRLEN]; int result; *proto = *data = *arg1 = *arg2 = *arg3 = *arg4 = 0x00; sscanf(cmd, "%s\t%s\t%s\t%s\t%s\t%s", kmp, proto, arg1, arg2, arg3, arg4); #if 0 fprintf(fp_out, "[%s]\r\n", cmd); fprintf(fp_out, "arg1=%s, arg2=%s, arg3=%s, arg4=%s\r\n", arg1, arg2, arg3, arg4); fflush(fp_out); #endif if(!strcmp(proto, "USERNEW")) { sprintf(data, "ID=%s&PASSWORD=%s&PASSWORD1=%s&NICKNAME=%s&EMAIL=%s", arg1, arg2, arg2, arg3, arg4); result = NewUser(data, &curuser); if(result != WEB_OK) { if(strstr(WEBBBS_ERROR_MESSAGE, "帳號已存在") != NULL) fprintf(fp_out, "622 使用者帳號已存在\r\n"); else fprintf(fp_out, "721 註冊失敗\r\n"); } else fprintf(fp_out, "800 OK!!\r\n"); } else if(!strcmp(proto, "USERQUERY")) { if (!get_passwd(&curuser, arg1)) { bzero(&curuser, sizeof(USEREC)); fprintf(fp_out, "621 使用者帳號不存在\r\n"); } else { USER_INFO *quinf; char user_status[1024]; if ((quinf = search_ulist(cmp_userid, curuser.userid)) && !(quinf->invisible)) { sprintf(user_status, "線上狀態: %s, 呼喚鈴: %s.", modestring(quinf, 1), (quinf->pager != PAGER_QUIET) ? MSG_ON : MSG_OFF); } else sprintf(user_status, "目前不在線上"); fprintf(fp_out, "800 OK!!\r\n"); fprintf(fp_out, "%s\t%s\t%d\t%d\t%d\t%d\t%d\t%s\t%s\r\n", curuser.userid, curuser.username, curuser.userlevel, curuser.ident, curuser.numlogins, curuser.numposts, (int)curuser.lastlogin, curuser.lasthost, user_status); } } else if(!strcmp(proto, "USERDATA")) { if(!get_passwd(&curuser, arg1)) bzero(&curuser, sizeof(USEREC)); if(CheckUserPassword(arg1, arg2)!=Correct) fprintf(fp_out, "724 密碼錯誤\r\n"); else { fprintf(fp_out, "800 OK!!\r\n"); fprintf(fp_out, "%d\t%s\t%s\t%d\t%d\t%d\t%s\t%d\t%s\r\n", curuser.uid, curuser.userid, curuser.username, curuser.userlevel, curuser.numlogins, curuser.numposts, curuser.lasthost, curuser.lastctype, curuser.email); } } else if(!strcmp(proto, "USERPLAN")) { if (!get_passwd(&curuser, arg1)) { bzero(&curuser, sizeof(USEREC)); fprintf(fp_out, "621 使用者帳號不存在\r\n"); } else { char userfile[PATHLEN]; sethomefile(userfile, curuser.userid, UFNAME_PLANS); if(isfile(userfile)) { fprintf(fp_out, "800 OK!!\r\n"); ShowArticle(userfile, FALSE, FALSE); } else { fprintf(fp_out, "761 使用者無名片檔\r\n"); } } } else if(!strcmp(proto, "USERLIST")) { int start = 0, end = 0; if(*arg1) start = atoi(arg1); if(*arg2) end = atoi(arg2); #if 0 fprintf(fp_out, "%p %p", post_file, &post_file); fflush(fp_out); #else post_file->list_start = start; post_file->list_end = end; ShowUserList("KMP", post_file); #endif } #if 0 else if(!strcmp(proto, "USERLOGIN")) { result = user_login(&cutmp, &curuser, CTYPE_WEBBBS, arg1, arg2, r->fromhost); if (result == ULOGIN_OK) { memcpy(&uinfo, cutmp, sizeof(USER_INFO)); break; } else if (result == ULOGIN_PASSFAIL) { outs(_msg_formosa_27); continue; } outs(_msg_formosa_44); } #endif return WEB_OK; }
// INT 80h Handler, kernel entry. void int_80() { if(krn) { return; } krn++; int systemCall = kernel_buffer[0]; int fd = kernel_buffer[1]; int buffer = kernel_buffer[2]; int count = kernel_buffer[3]; int i, j; Process * current; Process * p; int inode; int _fd; // Yeah, wanna know why we don't access an array directly? ... Because of big bugs we might have. switch(systemCall) { case READY: kernel_buffer[KERNEL_RETURN] = kernel_ready(); break; case WRITE: current = getp(); kernel_buffer[KERNEL_RETURN] = fd_write(current->file_descriptors[fd],(char *)buffer,count); break; case READ: current = getp(); kernel_buffer[KERNEL_RETURN] = fd_read(current->file_descriptors[fd],(char *)buffer,count); break; case MKFIFO: _fd = process_getfreefd(); fd = fd_open(_FD_FIFO, (void *)kernel_buffer[1],kernel_buffer[2]); if(_fd != -1 && fd != -1) { getp()->file_descriptors[_fd] = fd; kernel_buffer[KERNEL_RETURN] = _fd; } else { kernel_buffer[KERNEL_RETURN] = -1; } break; case OPEN: _fd = process_getfreefd(); fd = fd_open(_FD_FILE, (void *) kernel_buffer[1], kernel_buffer[2]); if(_fd != -1 && fd >= 0) { getp()->file_descriptors[_fd] = fd; kernel_buffer[KERNEL_RETURN] = _fd; } else { kernel_buffer[KERNEL_RETURN] = fd; } break; case CLOSE: kernel_buffer[KERNEL_RETURN] = fd_close(getp()->file_descriptors[fd]); break; case PCREATE: kernel_buffer[KERNEL_RETURN] = sched_pcreate(kernel_buffer[1],kernel_buffer[2],kernel_buffer[3]); break; case PRUN: kernel_buffer[KERNEL_RETURN] = sched_prun(kernel_buffer[1]); break; case PDUP2: kernel_buffer[KERNEL_RETURN] = sched_pdup2(kernel_buffer[1],kernel_buffer[2],kernel_buffer[3]); break; case GETPID: kernel_buffer[KERNEL_RETURN] = sched_getpid(); break; case WAITPID: kernel_buffer[KERNEL_RETURN] = sched_waitpid(kernel_buffer[1]); break; case PTICKS: kernel_buffer[KERNEL_RETURN] = (int) storage_index(); break; case PNAME: p = process_getbypid(kernel_buffer[1]); if(p == NULL) { kernel_buffer[KERNEL_RETURN] = (int) NULL; } else { kernel_buffer[KERNEL_RETURN] = (int) p->name; } break; case PSTATUS: p = process_getbypid(kernel_buffer[1]); if(p == NULL) { kernel_buffer[KERNEL_RETURN] = (int) -1; } else { kernel_buffer[KERNEL_RETURN] = (int) p->state; } break; case PPRIORITY: p = process_getbypid(kernel_buffer[1]); if(p == NULL) { kernel_buffer[KERNEL_RETURN] = (int) -1; } else { kernel_buffer[KERNEL_RETURN] = (int) p->priority; } break; case PGID: p = process_getbypid(kernel_buffer[1]); if(p == NULL) { kernel_buffer[KERNEL_RETURN] = (int) -1; } else { kernel_buffer[KERNEL_RETURN] = (int) p->gid; } break; case PGETPID_AT: p = process_getbypindex(kernel_buffer[1]); if (p->state != -1) { kernel_buffer[KERNEL_RETURN] = (int) p->pid; } else { kernel_buffer[KERNEL_RETURN] = -1; } break; case KILL: kernel_buffer[KERNEL_RETURN - 1] = kernel_buffer[1]; kernel_buffer[KERNEL_RETURN - 2] = kernel_buffer[2]; break; case PSETP: p = process_getbypid(kernel_buffer[1]); if(p == NULL) { kernel_buffer[KERNEL_RETURN] = (int) -1; } else { if(kernel_buffer[2] <= 4 && kernel_buffer[2] >= 0) { p->priority = kernel_buffer[2]; } kernel_buffer[KERNEL_RETURN] = (int) p->gid; } break; case SETSCHED: sched_set_mode(kernel_buffer[1]); break; case PWD: kernel_buffer[KERNEL_RETURN] = (int) fs_pwd(); break; case CD: kernel_buffer[KERNEL_RETURN] = (int) fs_cd(kernel_buffer[1]); break; case FINFO: fs_finfo(kernel_buffer[1], kernel_buffer[2]); break; case MOUNT: fs_init(); break; case MKDIR: kernel_buffer[KERNEL_RETURN] = (int) fs_mkdir(kernel_buffer[1],current_ttyc()->pwd); break; case RM: inode = fs_indir(kernel_buffer[1],current_ttyc()->pwd); if (inode) { kernel_buffer[KERNEL_RETURN] = (int) fs_rm(inode,0); } else { kernel_buffer[KERNEL_RETURN] = ERR_NO_EXIST; } break; case GETUID: if(kernel_buffer[1] == 0) { kernel_buffer[KERNEL_RETURN] = (int) current_ttyc()->uid; } else { kernel_buffer[KERNEL_RETURN] = (int) user_exists(kernel_buffer[1]); } break; case GETGID: if(kernel_buffer[1] == 0) { kernel_buffer[KERNEL_RETURN] = (int) user_gid(current_ttyc()->uid); } else { kernel_buffer[KERNEL_RETURN] = (int) user_gid(kernel_buffer[1]); } break; case MAKEUSER: kernel_buffer[KERNEL_RETURN] = user_create(kernel_buffer[1], kernel_buffer[2], user_gid(current_ttyc()->uid)); break; case SETGID: kernel_buffer[KERNEL_RETURN] = user_setgid(kernel_buffer[1], kernel_buffer[2]); break; case UDELETE: kernel_buffer[KERNEL_RETURN] = user_delete(kernel_buffer[1]); break; case UEXISTS: kernel_buffer[KERNEL_RETURN] = user_exists(kernel_buffer[1]); break; case ULOGIN: kernel_buffer[KERNEL_RETURN] = user_login(kernel_buffer[1], kernel_buffer[2]); break; case ULOGOUT: kernel_buffer[KERNEL_RETURN] = user_logout(); break; case CHOWN: kernel_buffer[KERNEL_RETURN] = fs_chown(kernel_buffer[1], kernel_buffer[2]); break; case CHMOD: kernel_buffer[KERNEL_RETURN] = fs_chmod(kernel_buffer[1], kernel_buffer[2]); break; case GETOWN: kernel_buffer[KERNEL_RETURN] = fs_getown(kernel_buffer[1]); break; case GETMOD: kernel_buffer[KERNEL_RETURN] = fs_getmod(kernel_buffer[1]); break; case CP: kernel_buffer[KERNEL_RETURN] = fs_cp(kernel_buffer[1], kernel_buffer[2], current_ttyc()->pwd, current_ttyc()->pwd); break; case MV: kernel_buffer[KERNEL_RETURN] = fs_mv(kernel_buffer[1], kernel_buffer[2], current_ttyc()->pwd); break; case LINK: kernel_buffer[KERNEL_RETURN] = fs_open_link(kernel_buffer[1], kernel_buffer[2], current_ttyc()->pwd); break; case FSSTAT: kernel_buffer[KERNEL_RETURN] = fs_stat(kernel_buffer[1]); break; case SLEEP: kernel_buffer[KERNEL_RETURN] = scheduler_sleep(kernel_buffer[1]); break; default: break; } krn--; }
void process_client() { char *argv[MAX_ARGV]; char buf[BUF_SIZE]; int argc = 0; set_signal(); print_greeting(); prompt(); while (1) { if (!fgets(buf, BUF_SIZE, stdin)) break; strtok(buf, "\r\n"); // Skip everything after "\r" or "\n" parse_argv(buf, argv, &argc); // It it sommand, so let's parse it char *cmd = argv[0]; // At least 1 token exists if (buf[0] != '\\') // If not command, then client wants to say something { say(buf); } else if (!strcmp(cmd, "\\quit")) { break; } else if (!strcmp(cmd, "\\help")) { print_help(); } else if (!strcmp(cmd, "\\list") && argc == 1) { list(); } else if (!strcmp(cmd, "\\register") && argc == 3) { user_create(argv[1], argv[2]); // args: user, pass } else if (!strcmp(cmd, "\\login") && argc == 3) { user_login(argv[1], argv[2]); // args: user, pass } else if (!strcmp(cmd, "\\create") && argc >= 2 && argc <= 3) { room_create(argv[1], argv[2]); // args: name, [pass] } else if (!strcmp(cmd, "\\join") && argc >= 2 && argc <= 3) { room_join(argv[1], argv[2]); // args: name, [pass] } else if (!strcmp(cmd, "\\leave")) { room_leave(); } else { WriteLn("Unknown command or wrong number of arguments (type '\\help' for commands list)"); } WriteLn(""); prompt(); } }
int main(int argc, char **args) { init_win(); int i = 0,flag = 0, x = 0; bug_msg_t *p = (bug_msg_t *)malloc(sizeof(bug_msg_t)); if(p == NULL) { return -1; } user_msg_t *p_1 = (user_msg_t *)malloc(sizeof(user_msg_t)); if(p_1 == NULL) { return -1; } head.next = &head; head.prev = &head; head_user.next = &head_user; head_user.prev = &head_user; overload_bugList(); joggle: overload_userList(); i = boot_screen(); switch(i){ case 0: create_frame(); create_msg_zone(); create_title_window("User Login"); x = user_login(); if(x == 1) { show_message("No user\nPlease register"); sleep(2); goto joggle; } if(x == 0) { core: flag = core_func(); switch(flag){ case 0: p = &head; if( Add_Bug() == 0) { File_bugList(p); goto core; }else { return 0; } case 1: if(Selection_Show_Bug() == -1){ goto core; }else { p = &head; File_bugList(p); } break; default: exit_win(); return 0; } } break; case 1: create_frame(); create_msg_zone(); create_title_window("User Register"); if(User_register() == 0) { p_1 = &head_user; File_userList(p_1); goto joggle; break; } break; default: exit_win(); return 0; } exit_win(); return 0; }
int main(int argc, const char * argv[]) { user_login(); return 0; }
//设置全局界面元素以及部件透明度 void MusicWindow::setElement_BackGround() { //文件夹下面的图片 QPixmap fit_Button; QPixmap small_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/small.png")); QPixmap mode_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/order.png")); QPixmap play_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/pause1.png")); QPixmap last_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/last1.png")); QPixmap next_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/next1.png")); QPixmap add_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/open.png")); QPixmap theme_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/theme1.png")); QPixmap mark_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/open.png")); QPixmap close_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/close.png")); QPixmap browser_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/browser.png")); QPixmap login_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/login.png")); QPixmap speaker_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/speaker.png")); QPixmap download_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/download.png")); //设置表格背景、初始化 titlePalette.setColor(QPalette::Base, Qt::gray); ui->storeView->setPalette(titlePalette); ui->favoriteView->setPalette(titlePalette); ui->storeView->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))"); ui->storeView->hide(); ui->webView->hide(); ui->favoriteView->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))"); ui->favoriteView->hide(); ui->browserButton->hide(); ui->storeButton->hide(); ui->favoriteButton->hide(); //设置界面按钮的图片以及图标大小 fit_Button = small_Button.scaled(163,163).scaled(21, 21, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->smallButton->setIcon(QIcon(fit_Button)); ui->smallButton->setIconSize(QSize(21, 21)); ui->smallButton->setFlat(true); ui->smallButton->setStyleSheet("border: 0px"); ui->smallButton->setToolTip(QString("最小化窗口")); fit_Button = mode_Button.scaled(163,163).scaled(31, 31, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->modeButton->setIcon(QIcon(fit_Button)); ui->modeButton->setIconSize(QSize(31, 31)); ui->modeButton->setFlat(true); ui->modeButton->setStyleSheet("border: 0px"); ui->modeButton->setToolTip(QString("顺序播放")); fit_Button = play_Button.scaled(163,163).scaled(41, 41, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->playButton->setIcon(QIcon(fit_Button)); ui->playButton->setIconSize(QSize(41, 41)); ui->playButton->setFlat(true); ui->playButton->setStyleSheet("border: 0px"); ui->playButton->setToolTip(QString("播放/暂停")); fit_Button = last_Button.scaled(163,163).scaled(41, 41, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->lastButton->setIcon(QIcon(fit_Button)); ui->lastButton->setIconSize(QSize(41, 41)); ui->lastButton->setFlat(true); ui->lastButton->setStyleSheet("border: 0px"); ui->lastButton->setToolTip(QString("上一曲Ctrl+L")); fit_Button = next_Button.scaled(163,163).scaled(41, 41, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->nextButton->setIcon(QIcon(fit_Button)); ui->nextButton->setIconSize(QSize(41, 41)); ui->nextButton->setFlat(true); ui->nextButton->setStyleSheet("border: 0px"); ui->nextButton->setToolTip(QString("下一曲Ctrl+R")); fit_Button = add_Button.scaled(163,163).scaled(36, 36, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->addButton->setIcon(QIcon(fit_Button)); ui->addButton->setIconSize(QSize(36, 36)); ui->addButton->setFlat(true); ui->addButton->setStyleSheet("border: 0px"); ui->addButton->setToolTip(QString("add songs")); fit_Button = theme_Button.scaled(163,163).scaled(36, 36, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->setApearenceButton->setIcon(QIcon(fit_Button)); ui->setApearenceButton->setIconSize(QSize(36, 36)); ui->setApearenceButton->setFlat(true); ui->setApearenceButton->setStyleSheet("border: 0px"); ui->setApearenceButton->setToolTip(QString("更换主题")); fit_Button = mark_Button.scaled(163,163).scaled(27, 27, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->markButton->setIcon(QIcon(fit_Button)); ui->markButton->setIconSize(QSize(27, 27)); ui->markButton->setFlat(true); ui->markButton->setStyleSheet("border: 0px"); ui->markButton->setToolTip(QString("move to favorite")); fit_Button = close_Button.scaled(163,163).scaled(29, 29, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->quitButton->setIcon(QIcon(fit_Button)); ui->quitButton->setIconSize(QSize(29, 29)); ui->quitButton->setFlat(true); ui->quitButton->setStyleSheet("border: 0px"); ui->quitButton->setToolTip(QString("close ")); fit_Button = browser_Button.scaled(163,163).scaled(34, 34, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->browserHideButton->setIcon(QIcon(fit_Button)); ui->browserHideButton->setIconSize(QSize(34, 34)); ui->browserHideButton->setFlat(true); ui->browserHideButton->setStyleSheet("border: 0px"); ui->browserHideButton->setToolTip(QString("浏览网页")); fit_Button = login_Button.scaled(163,163).scaled(39, 30, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->loginButton->setIcon(QIcon(fit_Button)); ui->loginButton->setIconSize(QSize(39, 30)); ui->loginButton->setFlat(true); ui->loginButton->setStyleSheet("border: 0px"); ui->loginButton->setToolTip(QString("登陆")); fit_Button = speaker_Button.scaled(163,163).scaled(35, 35, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ui->muteButton->setIcon(QIcon(fit_Button)); ui->muteButton->setIconSize(QSize(35, 35)); ui->muteButton->setFlat(true); ui->muteButton->setStyleSheet("border: 0px"); ui->muteButton->setToolTip(QString("静音")); fit_Button = download_Button.scaled(163,163).scaled(25,25,Qt::IgnoreAspectRatio,Qt::SmoothTransformation); ui->downloadButton->setIcon(QIcon(fit_Button)); ui->downloadButton->setIconSize(QSize(25,25)); ui->downloadButton->setFlat(true); ui->downloadButton->setStyleSheet("border:0px"); ui->downloadButton->setToolTip(QString(" 下载")); ui->lyricButton->setToolTip(QString("歌词")); titlePalette = ui->browserButton->palette(); titlePalette.setColor(QPalette::ButtonText, Qt::white); ui->browserButton->setToolTip(QString("网络")); ui->browserButton->setPalette(titlePalette); ui->browserButton->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))"); ui->storeButton->setToolTip(QString("mosic store")); ui->storeButton->setPalette(titlePalette); ui->storeButton->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))"); ui->favoriteButton->setToolTip(QString("我喜欢的歌曲")); ui->favoriteButton->setPalette(titlePalette); ui->favoriteButton->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))"); titlePalette = ui->musicTitle->palette(); titlePalette.setColor(QPalette::WindowText, Qt::white); ui->musicTitle->setPalette(titlePalette); ui->lyricButton->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))"); ui->volumeSlider->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))"); ui->volumeSlider->setTickPosition(QSlider::TicksRight); titlePalette = ui->label->palette(); titlePalette.setColor(QPalette::WindowText, Qt::white); ui->label->setPalette(titlePalette); titlePalette = ui->playStatusText->palette(); titlePalette.setColor(QPalette::WindowText, Qt::white); ui->playStatusText->setPalette(titlePalette); titlePalette = ui->listWidget->palette(); titlePalette.setColor(QPalette::Base, Qt::lightGray); ui->listWidget->setPalette(titlePalette); //StyleSheet字符串用来设置模版样式 ui->listWidget->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))"); //设置主窗口 this->setWindowOpacity(0.9); this->setWindowFlags(Qt::FramelessWindowHint); //无边框窗口 this->setWindowTitle("Qt MusicPlayer"); this->setWindowIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/title.png")); themeChoise = "pure_zise.png"; themeToUse = "C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Backgroud/" + themeChoise; QPixmap pixmap(/*QString::fromUtf8*/themeToUse);//文件夹下面的图片 titlePalette = this->palette(); titlePalette.setBrush(backgroundRole(), QBrush(pixmap)); this->setPalette(titlePalette); //设置全局快捷键动作 search = new QAction( QString("搜索歌曲"),this); search->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F)); search->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/search.png")); this->addAction(search); ui->searchEdit->hide(); this->connect(search, SIGNAL(triggered()), this, SLOT(songsSearch())); last_song = new QAction(ui->lastButton); last_song->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left)); ui->lastButton->addAction(last_song); ui->lastButton->connect(last_song, SIGNAL(triggered()), this, SLOT(lastSong())); next_song = new QAction(ui->nextButton); next_song->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right)); ui->nextButton->addAction(next_song); ui->nextButton->connect(next_song, SIGNAL(triggered()), this, SLOT(nextSong())); pause_song = new QAction(ui->playButton); pause_song->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Space)); ui->playButton->addAction(pause_song); ui->playButton->connect(pause_song, SIGNAL(triggered()), this, SLOT(playEvent())); small_window = new QAction(this); small_window->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down)); this->addAction(small_window); this->connect(small_window, SIGNAL(triggered()), this, SLOT(showMinimized())); full_window = new QAction(ui->browserHideButton); full_window->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up)); ui->browserHideButton->addAction(full_window); ui->browserHideButton->connect(full_window, SIGNAL(triggered()), this, SLOT(browserSet())); showMini = new QAction( QString("最小化"),this); showMini->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/mini.png")); connect(showMini, SIGNAL(triggered()), this, SLOT(showMinimized())); quit = new QAction(QString("close"), this); quit->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/close.png")); connect(quit, SIGNAL(triggered()), this, SLOT(warning())); login = new QAction(QString("登陆"), this); login->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/login.png")); connect(login, SIGNAL(triggered()), this, SLOT(user_login())); clearList = new QAction(QString("清空列表"), this); clearList->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/clear.png")); connect(clearList, SIGNAL(triggered()), this, SLOT(clear_List())); download = new QAction(QString("下载歌曲"), this); download->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/download.png")); connect(download,SIGNAL(triggered()), this, SLOT(download_File())); information = new QAction(QString("关于"), this); information->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/information.png")); connect(information, SIGNAL(triggered()), this, SLOT(about())); }
BOOL CT3000App::InitInstance() { try { // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); HRESULT hr;// if(!AfxInitRichEdit()) { AfxMessageBox(IDS_INIT_RICHEDIT_ERROR);// return FALSE;// } if (!AfxSocketInit())// { AfxMessageBox(IDP_SOCKETS_INIT_FAILED);// return FALSE;// } // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); #if 1 try { TCHAR exeFullPath[MAX_PATH+1]; // GetModuleFileName(NULL, exeFullPath, MAX_PATH); // (_tcsrchr(exeFullPath, _T('\\')))[1] = 0;// g_strDatabasefilepath=exeFullPath;// g_strExePth=g_strDatabasefilepath;// CreateDirectory(g_strExePth+_T("Database"),NULL);//creat database folder;// g_strOrigDatabaseFilePath=g_strExePth+_T("T3000.mdb");// g_strDatabasefilepath+=_T("Database\\T3000.mdb");// CString FilePath; HANDLE hFind;// WIN32_FIND_DATA wfd;// hFind = FindFirstFile(g_strDatabasefilepath, &wfd);// if (hFind==INVALID_HANDLE_VALUE)//说明当前目录下无t3000.mdb { //CopyFile(g_strOrigDatabaseFilePath,g_strDatabasefilepath,FALSE);// //没有找到就创建一个默认的数据库 FilePath=g_strExePth+_T("Database\\T3000.mdb"); HRSRC hrSrc = FindResource(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_T3000_DATABASE), _T("DB")); HGLOBAL hGlobal = LoadResource(AfxGetResourceHandle(), hrSrc); LPVOID lpExe = LockResource(hGlobal); CFile file; if(file.Open(FilePath, CFile::modeCreate | CFile::modeWrite)) file.Write(lpExe, (UINT)SizeofResource(AfxGetResourceHandle(), hrSrc)); file.Close(); ::UnlockResource(hGlobal); ::FreeResource(hGlobal); }// FindClose(hFind);// g_strDatabasefilepath=(CString)FOR_DATABASE_CONNECT+g_strDatabasefilepath;// g_strImgeFolder=g_strExePth+_T("Database\\image\\");// CreateDirectory(g_strImgeFolder,NULL);// JudgeDB(); //CString strocx=g_strExePth+_T("MSFLXGRD.OCX"); /*CStdioFile file; CString versionno; file. file.SetFilePath(_T("http://www.temcocontrols.com/ftp/software/T3000_Version.txt")); file.ReadString(versionno); file.Close();*/ //CFile file; // file.Open(_T("http://www.temcocontrols.com/ftp/software/T3000_Version.txt"),modeRead); InitModeName();// #if 0 CInternetSession session; CInternetFile *file=NULL; try { INTERNET_PROXY_INFO proxyinfo; proxyinfo.dwAccessType=INTERNET_OPEN_TYPE_PROXY; proxyinfo.lpszProxy=_T("192.168.0.4:8080 "); proxyinfo.lpszProxyBypass=NULL; if (!session.SetOption(INTERNET_OPTION_PROXY,(LPVOID)&proxyinfo,sizeof(INTERNET_PROXY_INFO))) { AfxMessageBox(_T("UserName")); } CString username=_T("alex"); if(!session.SetOption(INTERNET_OPTION_PROXY_USERNAME,username.GetBuffer(),username.GetLength()+ 1)){ AfxMessageBox(_T("UserName")); } CString password=_T("travel"); if(!session.SetOption(INTERNET_OPTION_PROXY_PASSWORD,password.GetBuffer(),password.GetLength()+ 1)){ AfxMessageBox(_T("Password")); } file=(CInternetFile*)session.OpenURL(_T("www.temcocontrols.com/ftp/software/T3000_Version.txt")); } catch (CInternetException* e) { file=NULL; e->Delete(); } CString version; if (file) { while(file->ReadString(version)!=NULL){ } AfxMessageBox(version); } #endif #endif // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Temco T3000 Application"));// LoadStdProfileSettings(); // Load standard INI file options (including MRU)// InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); #if 1 hr=CoInitialize(NULL);// if(FAILED(hr)) // { AfxMessageBox(_T("Error Initialize the COM Interface"));// return FALSE;// } #endif } catch (...) { AfxMessageBox(_T("Database operation to stop!")); } CString registerfilename; registerfilename=g_strExePth+_T("REG_msado15.bat"); // ::ShellExecute(NULL, _T("open"), registerfilename.GetBuffer(), _T(""), _T(""), SW_HIDE); registerfilename=g_strExePth+_T("REG_MSFLXGRD.bat"); //::ShellExecute(NULL, _T("open"), registerfilename.GetBuffer(), _T(""), _T(""), SW_HIDE); CString languagepath=g_strExePth+_T("\\Language"); m_locale.AddCatalogLookupPath(languagepath); m_locale.SetLanguage(CLanguageLocale::LANGUAGE_ENGLISH); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views #ifndef Fance_Enable_Test CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CT3000Doc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CT3000View)); #endif #ifdef Fance_Enable_Test CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CT3000Doc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CDialogCM5_BacNet)); #endif if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); //cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; //lsc // Dispatch commands specified on the command line. Will return FALSE if // app was launched with /RegServer, /Register, /Unregserver or /Unregister. if (!ProcessShellCommand(cmdInfo)) return FALSE; GdiplusStartupInput gdiplusStartupInput;// GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, NULL);// #if 1 //////////////////////////////////////////////////////// _ConnectionPtr m_pCon; _RecordsetPtr m_pRs; m_pCon.CreateInstance(_T("ADODB.Connection")); hr=m_pRs.CreateInstance(_T("ADODB.Recordset")); if(FAILED(hr)) { AfxMessageBox(_T("Load msado12.dll erro")); return FALSE; } m_pCon->Open(g_strDatabasefilepath.GetString(),"","",adModeUnknown); m_pRs->Open(_T("select * from Userlogin"),_variant_t((IDispatch *)m_pCon,true),adOpenStatic,adLockOptimistic,adCmdText); int nRecord=m_pRs->GetRecordCount(); if (nRecord<=0) { g_bPrivilegeMannage=FALSE; } else { int nUse; _variant_t temp_variant; temp_variant=m_pRs->GetCollect("USE_PASSWORD");// if(temp_variant.vt!=VT_NULL) nUse=temp_variant; else nUse=0; if(nUse==-1) { g_bPrivilegeMannage=TRUE; } else { g_bPrivilegeMannage=FALSE; } } m_pRs->Close(); m_pCon->Close(); if (g_bPrivilegeMannage) {//for just quick debug,only on this computer if(!user_login()) { AfxMessageBox(_T("Error password!")); return false; } } #endif ((CMainFrame*)m_pMainWnd)->InitViews();// m_pMainWnd->SetWindowText(_T("T3000 Building Automation System"));// m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); } catch (...) { // AfxMessageBox(_T("Double click 'REG_msado15.dll',Please!\nAt C:\\Program Files\\Temcocontrols\\T3000")); // CString strFilter = _T("hex File;bin File|*.hex;*.bin|all File|*.*||"); // CFileDialog dlg(true,_T("hex"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER,strFilter); // dlg.DoModal(); // CFileDialog dlg(true,NULL,_T("C:\Program Files\Common Files\System\ado")); //dlg.lpstrInitialDir = "..\\hisdata"; //dlg.op //// // OPENFILENAME // if (dlg.DoModal()==IDOK) // { // path = dlg.GetPathName(); // pLogFile = fopen("Log.txt", "wt+"); // fprintf(pLogFile, "%s", (LPCSTR)path); // fclose(pLogFile); // pLogFile = NULL; // } // CFileDialog fileDlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, // NULL,NULL);//_T("工作表(*.xls)|*.xls|文本文件(*.txt)|*.txt||") // fileDlg.m_ofn.lpstrInitialDir = _T("C:\\Program Files\\Temcocontrols\\T3000\\REG_msado15.dll.bat"); // fileDlg.DoModal(); //::ShellExecute(NULL, _T("open"), _T("C:\\Program Files\\Temcocontrols\\T3000\\REG_msado15.dll.bat"), _T(""), _T(""), SW_SHOW); //vcredist_x86.zip // ::ShellExecute(NULL, _T("open"), _T("C:\\Program Files\\Temcocontrols\\T3000\\vcredist_x86.zip"), _T(""), _T(""), SW_SHOW); //这个要先试试,当电脑没有安装这个文件时,如何捕获这个信息,然后再执行这个。 AfxMessageBox(_T("Open'T3000'Again,Please!")); return TRUE; } return TRUE; }