📄 hq_cl.c
字号:
SendMessage(hWnd, WM_KEYDOWN, VK_ESCAPE, 0L); break; case WM_KEYDOWN: GetClientRect(hWnd, &rc); DrawSelRect(hWnd, NULL, HqPaintData.curSelRec, TRUE); switch(wParam) { case VK_ESCAPE: DrawSelRect(hWnd, NULL, HqPaintData.curSelRec, FALSE); TrackPopupMenu(ghMenuHq, TPM_LEFTALIGN, 0,STATUS_HEIGHT -2, 0, ghWndMain, NULL); return 0L; case VK_ADD: //if(FontHight<24) { FontHight-=2; lf.lfHeight=FontHight; PostMessage(hWnd,WM_USER+1,NULL,NULL); SetWindowText(hWndInput, ""); InvalidateRect(hWnd, NULL, TRUE); } return 0L; case VK_SUBTRACT: //if(FontHight>14) { FontHight+=2; lf.lfHeight=FontHight; PostMessage(hWnd,WM_USER+1,NULL,NULL); SetWindowText(hWndInput, ""); InvalidateRect(hWnd, NULL, TRUE); } return 0L; case VK_F1: if(!IsSzRead||!IsShRead) return 0L; if(!IsWindowVisible(ghWndHelp)) ShowWindow(ghWndHelp,SW_SHOW); else SetFocus(ghWndHelp); sprintf(tmp,"%s\\help.txt",szDataPath); i=LoadFile(tmp,0,"帮助/[ESC]退出"); if(i>0) SendMessage(ghWndHelp,WM_USER+1,NULL,i); break; case VK_F2: if(!IsSzRead||!IsShRead) return 0L; SendMessage(ghWndMain,WM_COMMAND,IDM_JY,NULL); return 0L; break; case VK_F3: if(!IsSzRead||!IsShRead) return 0L; SendMessage(ghWndXlt,WM_KEYDOWN,VK_F3,0L); return 0L; case VK_F4: if(!IsSzRead||!IsShRead) return 0L; if(HqPaintData.jys==0) SendMessage(hWnd, WM_COMMAND, IDM_HQ_SH, 0L); else SendMessage(hWnd, WM_COMMAND, IDM_HQ_SZ, 0L); return 0L; case VK_F5: if(!IsSzRead||!IsShRead) return 0L; switch(HqPaintData.type) { case HQ_SZALL: case HQ_SHALL: SendMessage(hWnd, WM_COMMAND, IDM_HQSEL_1, 0L); break; case HQ_SEL_1: SendMessage(hWnd, WM_COMMAND, IDM_HQSEL_2, 0L); break; case HQ_SEL_2: SendMessage(hWnd, WM_COMMAND, IDM_HQSEL_3, 0L); break; case HQ_SEL_3: SendMessage(hWnd, WM_COMMAND, IDM_HQSEL_4, 0L); break; case HQ_SEL_4: SendMessage(hWnd, WM_COMMAND, IDM_HQSEL_5, 0L); break; case HQ_SEL_5: SendMessage(hWnd, WM_COMMAND, IDM_HQSEL_1, 0L); break; } return 0L; case VK_F7: SendMessage(hWnd, WM_COMMAND, IDM_HQSEL_SET_1, 0L); return 0L; case VK_F8: SendMessage(hWnd, WM_COMMAND, IDM_HQ_FLD_SEL, 0L); return 0L; case VK_F9: if(!IsSzRead||!IsShRead) return 0L; i =HqPaintData.sortData.key[HqPaintData.curSelRec+HqPaintData.curRecNum]; GraphData.jys =MmpData.jys =HqPaintData.jys; GraphData.recNum =MmpData.recNum =i; UDP_Send_Gra00(GraphData.jys, i); ShowWindow(ghWndLitHq, SW_SHOW); SendMessage(ghWndLitHq, WM_READ_OK, GraphData.jys, GraphData.recNum); if(IsZsRec(GraphData.jys, i)) { ShowWindow(ghWndMmp, SW_HIDE); ShowWindow(ghWndCj, SW_HIDE); ShowWindow(ghWndZs, SW_SHOW); ShowWindow(ghWndMaxMin, SW_SHOW); } else { ShowWindow(ghWndZs, SW_HIDE); ShowWindow(ghWndMaxMin, SW_HIDE); ShowWindow(ghWndMmp, SW_SHOW); ShowWindow(ghWndCj, SW_SHOW); } SendMessage(ghWndXlt, WM_KEYDOWN, VK_RETURN, 0L); ShowWindow(hWnd, SW_HIDE); return 0L; case VK_F11: if(!IsSzRead||!IsShRead) break; if(gfConnecting) { ErrMsg(ghWndMain,"正在连接券商...!"); break; } if(Addr[0][0]==0) InitQsInfo(); if(Addr[0][0]==0) break; if(Qsxx.zqsid[0]!=0&&Qsxx.zqsid[1]==0) //单券商 { curChkUsrData.zqsid =Qsxx.zqsid[0]; i=1; } else { //多券商 if((i=DlgSelectZqs())==0) { ErrMsg(ghWndMain,"选择证券商出错,不能交易!"); break; } } if(JyQs!=i) { Msg("正在连接证券部,请您稍候...",MSG_VERT); gfConnecting =TRUE; JyQs =0; SeleQs =i; if(ConnectToJyHost(Addr[i -1])!=0) { Msg("",MSG_HIDE); gfConnecting =FALSE; Msg("连接证券部出错,请您重试...",MSG_VERT); JyQs =0; DispQsName(JyQs,0); break; } gfConnecting =FALSE; } break; case VK_F12: if(!IsSzRead||!IsShRead) return 0L; SendMessage(ghWndXlt, WM_KEYDOWN, VK_F12, 0L); return 0L; case VK_F6: case VK_RETURN: if(!IsSzRead||!IsShRead) return 0L; if(HqPaintData.recCount <=0) break; tmp[0] =0; GetWindowText(hWndInput, &tmp[0], sizeof(tmp)); if(tmp[0] ==0) SendMessage(hWnd, WM_COMMAND, IDM_GRAPH, 0L); else { if(!strcmp("01", tmp)) { //if(HqPaintData.jys!=0) { HqPaintData.filter =HQ_ALL; SendMessage(hWnd, WM_COMMAND, IDM_HQ_SZ, 0L); HqSort(); InvalidateRect(hWnd, NULL, TRUE); } SetWindowText(hWndInput, ""); break; } if(!strcmp("02", tmp)) { //if(HqPaintData.jys!=1) { HqPaintData.filter =HQ_ALL; SendMessage(hWnd, WM_COMMAND, IDM_HQ_SH, 0L); HqSort(); InvalidateRect(hWnd, NULL, TRUE); } SetWindowText(hWndInput, ""); break; } if(!strcmp("03",tmp)) { SetWindowText(hWndInput, ""); SendMessage(hWnd, WM_COMMAND, IDM_GRAPH, 3L); break; } if(!strcmp("04",tmp)) { SetWindowText(hWndInput, ""); SendMessage(hWnd, WM_COMMAND, IDM_GRAPH, 4L); break; } if(!strcmp("05",tmp)) { HqPaintData.filter =HQ_A; HqSort(); InvalidateRect(hWnd, NULL, TRUE); SetWindowText(hWndInput, ""); break; } else if(!strcmp("06",tmp)) { HqPaintData.filter =HQ_B; HqSort(); InvalidateRect(hWnd, NULL, TRUE); SetWindowText(hWndInput, ""); break; } else if(!strcmp("07",tmp)) { HqPaintData.filter =HQ_BOND; HqSort(); InvalidateRect(hWnd, NULL, TRUE); SetWindowText(hWndInput, ""); break; } else if(HqPaintData.type==HQ_SZALL&&strlen(tmp)==6) { SendMessage(hWnd, WM_COMMAND, IDM_HQ_SH, 0L); InvalidateRect(hWnd, NULL, TRUE); } else if(HqPaintData.type==HQ_SHALL&&strlen(tmp)==4) { SendMessage(hWnd, WM_COMMAND, IDM_HQ_SZ, 0L); InvalidateRect(hWnd, NULL, TRUE); } for(i =0; i<HqPaintData.recCount; i++) { j =HqPaintData.sortData.key[i]; if(!strcmp(HqData[HqPaintData.jys].lpPreData[j].zqdm, tmp)) break; } if(i <HqPaintData.recCount) { if(HqPaintData.type==HQ_SZALL||HqPaintData.type==HQ_SHALL) { HqPaintData.curRecNum =i-i%HqPaintData.curRecCount; HqPaintData.curSelRec =i%HqPaintData.curRecCount; if(HqPaintData.curRecNum+HqPaintData.curRecCount >=HqPaintData.recCount) { HqPaintData.curRecNum = HqPaintData.recCount-HqPaintData.curRecCount; for(i=0;i<HqPaintData.curRecCount;i++) if(!strcmp(HqData[HqPaintData.jys].lpPreData[i+HqPaintData.curRecNum].zqdm, tmp)) break; HqPaintData.curSelRec=i; } } else HqPaintData.curSelRec=i; InvalidateRect(hWnd, NULL, TRUE); } KillTimer(hWnd, 5); SetTimer(hWnd,5,1000,NULL); SetWindowText(hWndInput, ""); } break; case VK_LEFT: DrawSelRect(hWnd, NULL, HqPaintData.curSelRec, FALSE); if(HqPaintData.curFldNum ==0) break; HqPaintData.curFldNum --; rc.left =X0_TITLE; x =HqPaintData.x0; if(HqPaintData.curFldNum >0) { HqPaintData.x0 += HqPaintData.rcTitles[HqPaintData.curFldNum].right -HqPaintData.rcTitles[HqPaintData.curFldNum-1].right; } else HqPaintData.x0 += HqPaintData.rcTitles[HqPaintData.curFldNum].right -X0_TITLE; ScrollWindow(hWnd, HqPaintData.x0-x, 0, &rc, &rc); SetScrollPos(hWnd,SB_HORZ,(int)(HqPaintData.curFldNum*R_HORZ/HqPaintData.fldCount),TRUE); break; case VK_RIGHT: if(HqPaintData.rcTitles[HqPaintData.fldCount-1].right==0) { x =X0_TITLE; for(j =0; j<HqPaintData.fldCount; j++) { HqPaintData.rcTitles[j].left =x; HqPaintData.rcTitles[j].right = x+tm.tmAveCharWidth*HqPaintFldLens[HqPaintData.fldNum[j]]; HqPaintData.rcTitles[j].top =0; HqPaintData.rcTitles[j].bottom =tm.tmHeight; x =HqPaintData.rcTitles[j].right+ITEM_SPACE_X; } } DrawSelRect(hWnd, NULL, HqPaintData.curSelRec, FALSE); if(HqPaintData.rcTitles[HqPaintData.fldCount-1].right +HqPaintData.x0<rc.right) break; if(HqPaintData.curFldNum>=HqPaintData.fldCount-1) break; rc.left =X0_TITLE; x =HqPaintData.x0; if(HqPaintData.curFldNum >0) { HqPaintData.x0 -= HqPaintData.rcTitles[HqPaintData.curFldNum].right -HqPaintData.rcTitles[HqPaintData.curFldNum-1].right; } else HqPaintData.x0 -= HqPaintData.rcTitles[HqPaintData.curFldNum].right -X0_TITLE; HqPaintData.curFldNum ++; ScrollWindow(hWnd, HqPaintData.x0-x, 0, &rc, &rc); SetScrollPos(hWnd,SB_HORZ,(int)(HqPaintData.curFldNum*R_HORZ/HqPaintData.fldCount),TRUE); break; case VK_UP: HqPaintData.curSelRec--; if(HqPaintData.curSelRec <0) { HqPaintData.curSelRec =HqPaintData.curRecCount-1; //0 if(HqPaintData.curSelRec >=HqPaintData.recCount) HqPaintData.curSelRec =HqPaintData.recCount-1; } SetScrollPos(hWnd,SB_VERT,(int)((long)(HqPaintData.curRecNum+HqPaintData.curSelRec)*(long)R_VERT/(long)HqPaintData.recCount),TRUE); break; case VK_DOWN: if(HqPaintData.curSelRec+HqPaintData.curRecNum >=HqPaintData.recCount-1) { HqPaintData.curSelRec =0; break; } HqPaintData.curSelRec++; if(HqPaintData.curSelRec >=HqPaintData.curRecCount) HqPaintData.curSelRec =0;//HqPaintData.curRecCount-1; SetScrollPos(hWnd,SB_VERT,(int)((long)(HqPaintData.curRecNum+HqPaintData.curSelRec)*(long)R_VERT/(long)HqPaintData.recCount),TRUE); break; case VK_PRIOR: if(HqPaintData.rcTitles[HqPaintData.fldCount-1].right==0) { x =X0_TITLE; for(j =0; j<HqPaintData.fldCount; j++) { HqPaintData.rcTitles[j].left =x; HqPaintData.rcTitles[j].right = x+tm.tmAveCharWidth*HqPaintFldLens[HqPaintData.fldNum[j]]; HqPaintData.rcTitles[j].top =0; HqPaintData.rcTitles[j].bottom =tm.tmHeight; x =HqPaintData.rcTitles[j].right+ITEM_SPACE_X; } } if(HqPaintData.curRecNum ==0) break; i =HqPaintData.curRecNum; HqPaintData.curRecNum-=HqPaintData.curRecCount-1; if(HqPaintData.curRecNum <0) HqPaintData.curRecNum =0; HqPaintData.curSelRec =0; rc.top =HqPaintData.itemHeight; rc.bottom =HqPaintData.itemHeight*(HqPaintData.curRecCount+1); ScrollWindow(hWnd, 0, +(HqPaintData.curRecCount-1)*HqPaintData.itemHeight, &rc, &rc); SetScrollPos(hWnd,SB_VERT,(int)((long)(HqPaintData.curRecNum+HqPaintData.curSelRec)*(long)R_VERT/(long)HqPaintData.recCount),TRUE); if(HqPaintData.curRecCount <HqPaintData.recCount) { KillTimer(hWnd, 5); SetTimer(hWnd,5,500,NULL); } break; case VK_NEXT: if(IsSzRead&&IsShRead) { if(HqPaintData.rcTitles[HqPaintData.fldCount-1].right==0) { x =X0_TITLE; for(j =0; j<HqPaintData.fldCount; j++) { HqPaintData.rcTitles[j].left =x; HqPaintData.rcTitles[j].right = x+tm.tmAveCharWidth*HqPaintFldLens[HqPaintData.fldNum[j]]; HqPaintData.rcTitles[j].top =0; HqPaintData.rcTitles[j].bottom =tm.tmHeight; x =HqPaintData.rcTitles[j].right+ITEM_SPACE_X; } } if(HqPaintData.curRecNum+HqPaintData.curRecCount >=HqPaintData.recCount) break; i =HqPaintData.curRecNum; HqPaintData.curRecNum+=HqPaintData.curRecCount-1; if(HqPaintData.curRecNum+HqPaintData.curRecCount >=HqPaintData.recCount) HqPaintData.curRecNum =HqPaintData.recCount-HqPaintData.curRecCount; HqPaintData.curSelRec =0; rc.top =HqPaintData.itemHeight; rc.bottom =HqPaintData.itemHeight*(HqPaintData.curRecCount+1); ScrollWindow(hWnd, 0, -(HqPaintData.curRecCount-1)*HqPaintData.itemHeight, &rc, &rc); SetScrollPos(hWnd,SB_VERT,(int)((long)(HqPaintData.curRecNum+HqPaintData.curSelRec)*(long)R_VERT/(long)HqPaintData.recCount),TRUE); if(HqPaintData.curRecNum+HqPaintData.curRecCount >=HqPaintData.recCount) InvalidateRect(hWnd, NULL, TRUE); if(HqPaintData.curRecCount <HqPaintData.recCount) { KillTimer(hWnd, 5); SetTimer(hWnd,5,500,NULL); } } break; case VK_HOME: HqPaintData.curRecNum =HqPaintData.curSelRec =0; InvalidateRect(hWnd, NULL, TRUE); if(HqPaintData.recCount >HqPaintData.curRecCount) { KillTimer(hWnd, 5); SetTimer(hWnd,5,500,NULL); } SetScrollPos(hWnd,SB_VERT,(int)((long)(HqPaintData.curRecNum+HqPaintData.curSelRec)*(long)R_VERT/(long)HqPaintData.recCount),TRUE); return 0L; case VK_END: if(IsSzRead&&IsShRead) { if(HqPaintData.recCount <HqPaintData.curRecCount) { HqPaintData.curRecNum =0; HqPaintData.curSelRec =HqPaintData.recCount-1; } else { HqPaintData.curSelRec =HqPaintData.curRecCount-1; HqPaintData.curRecNum =HqPaintData.recCount -HqPaintData.curRecCount; KillTimer(hWnd, 5); SetTimer(hWnd,5,500,NULL); } InvalidateRect(hWnd, NULL, TRUE); } SetScrollPos(hWnd,SB_VERT,(int)((long)(HqPaintData.curRecNum+HqPaintData.curSelRec)*(long)R_VERT/(long)HqPaintData.recCount),TRUE); return 0L; default: break; } UpdateWindow(hWnd); DrawSelRect(hWnd, NULL, HqPaintData.curSelRec, FALSE); break; case WM_LBUTTONDBLCLK: PostMessage(hWnd,WM_KEYDOWN,VK_RETURN,NULL); break; case WM_LBUTTONDOWN: SetFocus(hWnd); x=LOWORD(lParam); y=HIWORD(lParam); DrawSelRect(hWnd, NULL, HqPaintData.curSelRec, TRUE); i=(int)((y)/(HqPaintData.rcTitles[0].bottom+ITEM_SPACE_Y)) -1; if(i>=HqPaintData.recCount) i=HqPaintData.recCount -1; if(i<0) i=0; HqPaintData.curSelRec=i; DrawSelRect(hWnd, NULL, HqPaintData.curSelRec, FALSE); if(clock()-MouDownClk<240) PostMessage(hWnd,WM_KEYDOWN,VK_RETURN,NULL); MouDownClk=clock(); break; case WM_PAINT: if(HqPaintData.type<2&& HqPaintData.curRecCount>0&&HqPaintData.recCount>0) { if(HqPaintData.curRecNum+HqPaintData.curRecCount >=HqPaintData.recCount) HqPaintData.curRecNum =HqPaintData.recCount-HqPaintData.curRecCount; } if(HqData[HqPaintData.jys].recCount <=0) break; GetClientRect(hWnd, &rc); BeginPaint(hWnd, &ps); SelectObject(ps.hdc,hHqFont); GetClientRect(hWnd, &rc); // draw title rc.left =DrawTitle(hWnd, ps.hdc); rc.top =HqPaintData.itemHeight; rc.bottom =HqPaintData.itemHeight*(HqPaintData.curRecCount+1); IntersectClipRect(ps.hdc, rc.left, rc.top, rc.right, rc.bottom); SetTextAlign(ps.hdc, TA_TOP|TA_RIGHT); SetBkMode(ps.hdc, OPAQUE); i =HqPaintData.curRecNum; SetBkColor(ps.hdc, RGB(0, 0, 0));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -