CMyWnd.cpp
上传用户:hyb6888
上传日期:2016-01-24
资源大小:5186k
文件大小:32k
源码类别:

输入法编程

开发平台:

Visual C++

  1. #include "stdafx.h"
  2. #include "stdio.h"
  3. #include "CMyWnd.h"
  4. #include "windows.h"
  5. #include "GIF.h"
  6. #include "string.h"
  7. #include "math.h" 
  8. CGIF m_Gif;
  9. POINT pst;
  10. int tt;
  11. int  EDIT1_NUM;
  12. char EDIT1_txt[200];
  13. char EDIT2_txt[200];
  14. #include "DllManager.h"
  15. extern DllManager ChLib;//定义在主DLL中
  16. BOOL WINAPI About(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam )
  17. {
  18. switch (message)
  19. {
  20. case WM_INITDIALOG:
  21. SetDlgItemText(hDlg,IDC_EDIT1,EDIT1_txt);
  22. SetDlgItemText(hDlg,IDC_EDIT2,EDIT2_txt);
  23. SetWindowPos(hDlg, 0, 400,300,0, 0, 21); //SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER  //16/1/4
  24. return TRUE;
  25. case WM_COMMAND:
  26. switch(wParam) {
  27. case IDOK:
  28. GetDlgItemText(hDlg,IDC_EDIT1,EDIT1_txt,2);
  29. EDIT1_NUM=GetDlgItemInt(hDlg,IDC_EDIT1,0,FALSE);
  30. EndDialog(hDlg,IDOK);
  31. break;
  32. case IDCANCEL:
  33. EndDialog(hDlg,IDCANCEL);
  34. break;
  35. default:
  36. break;
  37. }
  38. break;
  39. }
  40.     return FALSE;
  41. }
  42. //////////////////////////////////////////////////////////
  43. //   窗口的初始化
  44. //由于在类建立时还没有建立窗口,因此m_hWnd没有有效值。
  45. //  类建立时还不能初始化,只有调用了CREATE后才可以。
  46. CMyWnd::initalizeWin()
  47. {
  48. WindDC=GetDC(m_hWnd);
  49. myResM.InitResManager(WindDC,hInst,WinWidth, WinHeight);
  50. DeleteObject(SelectObject(WindDC, hUIFont));
  51. TextH=GetTabbedTextExtent(WindDC,"1",1,0,0)/0x10000; 
  52. SetWindowRgn(m_hWnd,WinRGN1,TRUE);
  53. Texthdc = CreateCompatibleDC(WindDC);
  54. Texthdcbmp=CreateCompatibleBitmap(WindDC,WinWidth,WinHeight);
  55. DeleteObject(SelectObject(Texthdc, hUIFont));
  56. DeleteObject(SelectObject(Texthdc,Texthdcbmp));
  57. SetBkMode(Texthdc,TRANSPARENT);
  58. }
  59. int  CMyWnd::ClearWin()
  60. {
  61. static int nullflag=0;
  62. stopflash=0;
  63. settxt("");
  64. inputWind->showtxt[0]=0;
  65. myPaintTxt(0,actSetstr);
  66. inputWind->myPaintTxt(0,actSetstr);
  67. return 0;
  68. }
  69. int  CMyWnd::SetShowString(char*MindleStr,char*InputStr)
  70. {
  71. static int nullflag=0;
  72. stopflash=0;
  73. settxt(MindleStr);
  74. {
  75. int i,len;
  76. if(InputStr!=NULL)
  77. {
  78. len=strlen(InputStr);
  79. for(i=0;i<len;i++)
  80. inputWind->showtxt[i]=InputStr[i];
  81. inputWind->showtxt[i]=0;
  82. }
  83. else
  84. inputWind->showtxt[0]=0;
  85. }
  86. /*
  87. if(InputStr!=NULL)
  88. strcpy(cmywnd->inputWind->showtxt,InputStr);
  89. else
  90. cmywnd->inputWind->showtxt[0]=0;
  91. */
  92. myPaintTxt(0,actSetstr);
  93. inputWind->myPaintTxt(0,actSetstr);
  94. if(inputWind->showtxt[0]==0)
  95. nullflag++;
  96. else
  97. nullflag=0;
  98. if(nullflag>1)
  99. {
  100. ShowWindow(m_hWnd,SW_HIDE);
  101. if(nullflag>2)
  102. ShowWindow(inputWind->m_hWnd,SW_HIDE);
  103. }
  104. else
  105. {
  106. ShowWindow(m_hWnd,SW_SHOWNOACTIVATE);
  107. ShowWindow(inputWind->m_hWnd,SW_SHOWNOACTIVATE);
  108. }
  109. return 0;
  110. }
  111. //键盘过滤,0为不过滤
  112. BOOL CMyWnd::myImeProcessKey(char *SendCH,char*Control,HIMC hIMC,UINT vKey,LPARAM lKeyData,CONST LPBYTE lpbKeyState)
  113. {
  114. LONG fRet;
  115. int mykey,lon;
  116. try{
  117. fRet=inmyImeProcessKey(SendCH,Control,hIMC,vKey,lKeyData,lpbKeyState);
  118. if(fRet==0)
  119. {
  120. mykey=(int)vKey;
  121. if(mykey>=32&&mykey<=126)
  122. myResM.Chtime.appnum(1);//计数一次
  123. }
  124. myQQWind->disabledailtimer();
  125. lon=strlen(SendCH);
  126. myResM.Chtime.appnum(lon/2);//计数一次
  127. if(lon==2)
  128. myResM.ChAutoword.AppOne(SendCH);
  129.   } catch (...) {
  130.        MessageBox(0,"myImeProcessKey","有错误发生",0);
  131.   }
  132.     return fRet;
  133. }
  134. //键盘过滤,0为不过滤
  135. BOOL CMyWnd::inmyImeProcessKey(char *SendCH,char*Control,HIMC hIMC,UINT vKey,LPARAM lKeyData,CONST LPBYTE lpbKeyState)
  136. {
  137. GENEMSG GnMsg;
  138. LONG lRet = 0L;
  139. int mykey;
  140.     BOOL fRet = FALSE, fCompStr = FALSE;
  141. static BOOL fPressOther = FALSE;
  142. char ss[1000]="";
  143. unsigned char kbByte[256];
  144. HWND hSoftKbdWnd=NULL;
  145.     mykey=(int)vKey;
  146. //sprintf(ss,"%d",mykey);
  147.     //MessageBox (0,ss,0,0);
  148.    if (ChLib.LoadErr!=0)
  149.    {
  150.    MessageBox(0,"请立即保存,系统可能崩溃!?","发生严重错误!",0);
  151.    return FALSE;
  152.    }
  153. GetKeyboardState(kbByte);
  154. //GetAsyncKeyState上一次调用以来,如键已被按过,则位0设为1;
  155.     //否则设为0。如键目前处于按下状态,则位8设为1;如抬起,则为0。
  156. //按住Ctrl 、Shift(10)或Alt时不进行编 VK_ATTN VK_CONTROL
  157. if (lpbKeyState[VK_ATTN] & 0x80)
  158.         return FALSE;
  159. ///////////////////////////////////////
  160. //  增词控制
  161. if (lpbKeyState[VK_CONTROL] & 0x80 ||ConWind->controlflag==1)
  162. {
  163. if ( mykey==192)
  164. {
  165. if(mydd.appdictbool==0)
  166. myQQWind->settxt("造 词 中");
  167. else
  168. myQQWind->settxt(" 词  语 ");
  169.  strcpy(ChLib.Control,"AppDict");
  170.  mydd.AppSetDict(hIMC);
  171.  ConWind->controlflag=0;
  172.  fRet=1;
  173. }
  174. else
  175. fRet=0;
  176. return fRet;
  177. }
  178.     //////////////////////////////////////////////
  179. //软键盘功能
  180. {
  181. hSoftKbdWnd=ConWind->keyboard->CIMEhSoftKbdWnd;//试探性取数据
  182. GetWindowText(hSoftKbdWnd,ss,2);
  183. if(ss[0]!=0)
  184. { //试探性取数据,正式获取数据
  185. GetWindowText(hSoftKbdWnd,ss,200);
  186. return SoftKbdProcess(ss,mykey,SendCH);
  187. }
  188. }
  189. if(kbByte[VK_CAPITAL]&1)//大写字母打开时将不进行输入处理
  190. return 0;
  191. //sprintf(ss,"%d",mykey);
  192.     //MessageBox (0,ss,0,0);
  193.     ////////////////////////////////////////////////////
  194. //以下为转换功能
  195. if(GetIsUpdate())                   //查看软件是否需要更新字库
  196. ChLib.DLLstart(1);
  197.  
  198. if(ChLib.Linputbuf[0]!=0)    //进行翻页功能
  199. {
  200. if(mykey==33)
  201. {
  202. ChLib.getnextpage(ChLib.LMidtems,0);
  203. SetShowString(ChLib.LMidtems,ChLib.Linputbuf);
  204.             //MessageBox (0,DllMns.LMidtems,0,0);
  205. return 1;
  206. }
  207. if(mykey==34)
  208. {
  209. ChLib.getnextpage(ChLib.LMidtems,1);
  210. SetShowString(ChLib.LMidtems,ChLib.Linputbuf);
  211. return 1;
  212. }
  213. }
  214. fRet=ChLib.keyprogress(mykey,ChLib.Linputbuf, ChLib.SendCH,ChLib.SendEN,ChLib.LMidtems,ChLib.Control);
  215. if(ChLib.Linputbuf[0]==0)
  216. SetShowString("","");
  217. else
  218. SetShowString(ChLib.LMidtems,ChLib.Linputbuf);
  219. //MessageBox(0,DllMns.LMidtems,DllMns.Linputbuf,0);
  220. if(mydd.appdictbool==1)
  221. {
  222. if(ChLib.SendCH[0]!=0)
  223. mydd.AppOne(ChLib.SendCH);
  224. }
  225.     /////////////////////////////////////////////////
  226. //   提示窗口控制功能
  227. //   下面为获得光标位置,并设置提示窗口位置
  228. if(fRet!=0)
  229. POINT ptSrc;
  230. LPINPUTCONTEXT lpIMC;
  231.  //告诉系统开始接收位置
  232. GnMsg.msg    = WM_IME_STARTCOMPOSITION;
  233. GnMsg.wParam = 0;
  234. GnMsg.lParam = 0;
  235. GenerateMessage(hIMC, 0,(LPGENEMSG)&GnMsg);
  236. //发结束消息,不然会出现ATL功能键的异常。
  237. GnMsg.msg    = WM_IME_ENDCOMPOSITION;
  238. GnMsg.wParam = 0;
  239. GnMsg.lParam = 0;
  240. GenerateMessage(hIMC, 0,(LPGENEMSG)&GnMsg);
  241. if (!(lpIMC = ImmLockIMC(hIMC)))//锁存数据
  242.    return fRet;
  243. ptSrc =  lpIMC->cfCompForm.ptCurrentPos;
  244. if(ptSrc.x<-10000||ptSrc.x>10000)
  245. {
  246. GetCaretPos(&ptSrc);
  247. }
  248. //char Lss[100];
  249. //sprintf(Lss,"%ld   y%ld",ptSrc.x,ptSrc.y);
  250. //MessageBox(0,Lss,0,0);
  251. MyMoveWinInput(lpIMC->hWnd,ptSrc.x,ptSrc.y);
  252. ImmUnlockIMC(hIMC);
  253. }   //位置测试结束
  254. strcpy(SendCH,ChLib.SendCH);
  255. ChLib.SendCH[0]=0;
  256. strcpy(Control,ChLib.Control);
  257. ChLib.Control[0]=0;
  258.     return fRet;
  259. }
  260. CMyWnd::CMyWnd(DWORD himc)
  261. {
  262. int i;
  263. POINT pp[10];
  264. void* vp=(void*)this;
  265. ChLib.SetIMEModle(myResM.CurModleNum);
  266. savehimc=himc;
  267. myQQWind =new QQHwnd(vp);
  268. //myQQtimer =new QQHwnd(vp);
  269. inputWind=new inputHwnd( vp );
  270. ConWind  =new ConHwnd( vp,himc);
  271. stopflash=0;
  272. x=y=50;
  273. resavehight=4;
  274. for(i=0;i<50;i++)
  275. Arrppc[i] =NULL;
  276. TimePPch=NULL;
  277. StartPPch=NULL;
  278. WinStartPos=myResM.ReadRegPos("CMyWnd");
  279. hUIFont = CreateFont(19, 0, 0, 0, FW_NORMAL,
  280. FALSE, FALSE, FALSE, ANSI_CHARSET,
  281. OUT_TT_PRECIS, CLIP_TT_ALWAYS, ANTIALIASED_QUALITY,
  282. DEFAULT_PITCH, "宋体");
  283.     strcpy(inputWind->showtxt,"");
  284. settxt("名称:极速五笔 1.;版权:王华 1.;发行:2006.12.28 1.;E-m:whln669@sohu.com 1.;版本:2.10 1.;");
  285. m_hWnd=NULL;
  286. WinHeight=100;
  287. WinWidth=170;
  288. conh=&(inputWind->ControlHeight);
  289. pp[0].x=0; pp[0].y=0;
  290. pp[1].x=WinWidth; pp[1].y=0;
  291. pp[2].x=WinWidth; pp[2].y=WinHeight;
  292. pp[3].x=20; pp[3].y=WinHeight;
  293. pp[4].x=20; pp[4].y=40;
  294. pp[5].x=0; pp[5].y=20;
  295. pp[6].x=0;      pp[6].y=0;
  296. //文本区
  297. TextRGN=CreatePolygonRgn(pp,7,1);
  298. WinRGN1=CreatePolygonRgn(pp,7,1);
  299. WinRGN2=CreatePolygonRgn(pp,7,1);
  300. fCanMove = FALSE;
  301. saveWM_LButton=0;
  302. saveCurLine=0;
  303. }
  304. CMyWnd::~CMyWnd()
  305. {
  306. //MessageBox(0,"~CMyWnd",0,0);
  307. try{
  308. //strcpy(showtxt,"");
  309. KillTimer(m_hWnd,1);
  310. KillTimer(m_hWnd,2);
  311. KillTimer(m_hWnd,3);
  312. delete inputWind;
  313. delete ConWind;//软键盘的释放也可能引起致使错误
  314. delete myQQWind;
  315. DeleteObject(hUIFont);
  316. DeleteDC (Texthdc);
  317. DeleteObject(Texthdcbmp);
  318. DeleteObject (WinRGN1);
  319. DeleteObject (WinRGN2);
  320. DeleteObject (TextRGN);
  321. //可能在窗口处理程序中本窗口已被删除。
  322. //让程序暂时进行处理,以防止无效访问已经退出的代码段
  323. if(IsWindow(m_hWnd)){
  324. ReleaseDC(m_hWnd,WindDC);
  325. //SetWindowLong(m_hWnd,GWL_WNDPROC,(long)endProc);
  326. DestroyWindow(m_hWnd); 
  327. //m_hWnd=NULL;
  328. }
  329.   } catch (...) {
  330.        MessageBox(0,"~CMyWnd","有错误发生",0);
  331.   }
  332. }
  333. BOOL CMyWnd::Create(LPCTSTR szClassName, LPCTSTR szTitle, HINSTANCE hInstance, HWND hWndParent , DWORD dwStyle ,DWORD dwExStyle, HMENU hMenu )
  334. {
  335. // 初始化全局字串
  336. WNDCLASSEX wcex;
  337. ChLib.hInstance=hInstance;
  338. //MessageBox(0,"Main create",0,0);
  339. wcex.cbSize = sizeof(WNDCLASSEX); 
  340. wcex.style = CS_IME;
  341. wcex.lpfnWndProc = InitProc;
  342. wcex.cbClsExtra = 0;
  343. wcex.cbWndExtra = 12;
  344. wcex.hInstance = hInstance;
  345. wcex.hIcon = 0;
  346. wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
  347. wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
  348. wcex.lpszMenuName = 0;
  349. wcex.lpszClassName = szClassName;
  350. wcex.hIconSm = 0;
  351. hInst=hInstance;
  352. RegisterClassEx(&wcex);
  353. {
  354.    m_hWnd=CreateWindowEx( 0,
  355. szClassName,NULL,
  356. WS_POPUP|WS_DISABLED,// | WS_DISABLED,WS_SIZEBOX
  357. WinStartPos.x,WinStartPos.y,WinWidth,WinHeight,
  358. hWndParent,NULL,hInstance,this);
  359. SetWindowLong(m_hWnd,8,(DWORD)hWndParent);//FIGWL_SVRWND
  360. ShowWindow(m_hWnd,SW_SHOWNOACTIVATE);
  361. UpdateWindow(m_hWnd);
  362. }
  363. //MessageBox(0,"Main create",0,0);
  364. myHwndParent=hWndParent;
  365. myQQWind->Create("QQ","QQ",hInstance,hWndParent,dwStyle,dwExStyle,hMenu);
  366. inputWind->Create("inputWind",szTitle,hInstance,hWndParent,dwStyle,dwExStyle,hMenu);
  367. ConWind->Create("ConHwnd",szTitle,hInstance,hWndParent,dwStyle,dwExStyle,hMenu);
  368. Main_hWnd=&m_hWnd;
  369. Cont_hWnd=&ConWind->m_hWnd;
  370. inpu_hWnd=&inputWind->m_hWnd;
  371. inputWind->Main_hWnd=&m_hWnd;
  372. inputWind->Cont_hWnd=&ConWind->m_hWnd;
  373. inputWind->inpu_hWnd=&inputWind->m_hWnd;
  374. ConWind->Main_hWnd=&m_hWnd;
  375. ConWind->Cont_hWnd=&ConWind->m_hWnd;
  376. ConWind->inpu_hWnd=&inputWind->m_hWnd;
  377. DrawFrame();
  378. //SetTimer(m_hWnd,1,30,0);
  379. return m_hWnd != NULL;
  380. }
  381. CMyWnd::SetAllWinAttrib(unsigned char Lclarity)
  382. {
  383. myset.mySetWindow(m_hWnd,   RGB(255,255,255),Lclarity,LWA_ALPHA|LWA_COLORKEY);
  384. myset.mySetWindow(inputWind->m_hWnd,RGB(255,255,255),Lclarity,LWA_ALPHA|LWA_COLORKEY);
  385. myset.mySetWindow(ConWind->m_hWnd,  RGB(255,255,255),Lclarity,LWA_ALPHA|LWA_COLORKEY);
  386. myset.mySetWindow(myQQWind->m_hWnd, RGB(255,255,255),Lclarity,LWA_ALPHA|LWA_COLORKEY);
  387. }
  388. ////////////////////////////////////////////////////////
  389. //   增加边框
  390. void CMyWnd::DrawFrame()
  391. {
  392. int i,line1,line2,line3,mudle1;
  393. int flowerx,flowery;
  394. BitBlt(myResM.BackDC,0,0,WinWidth,WinHeight,myResM.reBackDC,0,0,SRCCOPY);//SRCCOPY
  395. if(myResM.frameflage[0]=='1')
  396. {
  397. line1=110;
  398. line2=114;
  399. line3=110;
  400. mudle1=190;
  401. for(i=0;i<20;i++)//竖线
  402.    TransparentBlt2(myResM.BackDC,20, 38+i*3,5,5,myResM.oldBackDC,mudle1,line2,5,5,RGB(255,255,255));
  403. for(i=0;i<8;i++) //竖线
  404.    TransparentBlt2(myResM.BackDC,0,  i*3, 5,5,myResM.oldBackDC,mudle1,line2,5,5,RGB(255,255,255));
  405. for(i=0;i<35;i++)//竖线
  406.    BitBlt(myResM.BackDC,WinWidth-4,i*3,5,5,myResM.oldBackDC,mudle1,line2,SRCCOPY);
  407. for(i=0;i<8;i++)//斜线
  408.    TransparentBlt2(myResM.BackDC,i*3,18+i*3,5,5,myResM.oldBackDC,mudle1,line1,5,5,RGB(255,255,255));
  409. for(i=0;i<60;i++) //横线
  410. {
  411.    BitBlt(myResM.BackDC,i*3,0, 5,5,myResM.oldBackDC,mudle1,line3,SRCCOPY);
  412.    BitBlt(myResM.BackDC,i*3,96,5,5,myResM.oldBackDC,mudle1,line3,SRCCOPY);
  413. }
  414. }
  415. //绘制窗花
  416. if(myResM.flowerflage[0]=='1')
  417. {
  418. flowerx=180;
  419. flowery=130;
  420. TransparentBlt2(myResM.BackDC,144,0,30,30,myResM.oldBackDC,flowerx,flowery,30,30,RGB(255,255,255));
  421. flowery=166;
  422. TransparentBlt2(myResM.BackDC,144,80,30,30,myResM.oldBackDC,flowerx,flowery,30,30,RGB(255,255,255));
  423. }
  424. return;
  425. }
  426.  LRESULT WINAPI CMyWnd::WindowProc(UINT uMsg,UINT wParam,LONG lParam)
  427.  {
  428.   POINT pt;
  429.   RECT Rect;
  430.   COLORREF tColor;
  431.   int t,st;
  432.   static dely;
  433.   char gifname[256];
  434.   static int QQtimenum;
  435.   try {
  436.     switch (uMsg)
  437.     {
  438. case WM_CREATE:
  439. //半透明不能和水波共处,否则会出现窗口刷新异常
  440. //myset.mySetWindow(m_hWnd,RGB(255,255,255),myResM.clarityflage,LWA_ALPHA|LWA_COLORKEY);
  441. initalizeWin();
  442. myset.mySetWindow(m_hWnd,RGB(255,255,255),myResM.clarityflage,LWA_ALPHA|LWA_COLORKEY);
  443. GetModuleFileName(hInst,gifname,255);
  444. myGetPath(gifname);   //取路径 动画
  445. SetTimer(m_hWnd,3,1000,NULL);//
  446. SetTimer(m_hWnd,4,30,NULL);//
  447. strcat(gifname,"1.gif");
  448. if(m_Gif.LoadGIF(gifname))
  449. ;//MessageBox(0,"map","m_Gif.LoadGIF",0);
  450. else
  451. SetTimer(m_hWnd,2,100,NULL);
  452. DrawFrame();
  453.  
  454. break;
  455. case WM_TIMER:
  456.            if(stopflash==0){
  457. if(wParam==2)
  458. {
  459. KillTimer(m_hWnd,2);
  460. if(x>90)
  461. x--;
  462. if(x<90)
  463. x++;
  464. if(y>50)
  465. y--;
  466. if(y<50)
  467. y++;
  468. pt.x=x-30;
  469. pt.y=y-30;
  470. if (m_Gif.GetImageInfo (Rect,tColor,tt-1)){
  471.      BitBlt (WindDC,0,0,WinWidth, WinHeight,Texthdc,0,0,SRCCOPY);
  472. }else{
  473. //if(m_Gif.m_ImageList.m_nCount<0)
  474. // MessageBox(0,"header",0,0);
  475. GetModuleFileName(hInst,gifname,255);
  476. myGetPath(gifname);   //取路径 动画
  477. strcat(gifname,"1.gif");
  478. m_Gif.LoadGIF( gifname);
  479. }
  480. if (!m_Gif.ShowImage (WindDC,pt,tt++)){
  481. tt = 0;
  482. //m_Gif.ShowImage (WindDC,pt,tt++);
  483. }
  484. SetTimer(m_hWnd,2,100,NULL);
  485. }
  486. if(wParam==1){
  487. if(myResM.scrollflage[0]!='1')
  488. KillTimer(m_hWnd,1);
  489. TimeShowText(0);
  490. if (!m_Gif.GetImageInfo (Rect,tColor,tt-1))
  491.      BitBlt (WindDC,0,0,WinWidth, WinHeight,Texthdc,0,0,SRCCOPY);
  492. }
  493.     if(wParam==3){
  494. char temss[15];
  495. myResM.Chtime.apptime();
  496. sprintf(temss,"速度:%d",myResM.Chtime.GetAverage());
  497. myQQWind->settxttimer(m_hWnd,100,0,temss);
  498. }
  499.    }
  500. break;
  501. case WM_PAINT://绘制窗口
  502. myPaintTxt(0,saveWM_LButton);
  503. break;
  504.         case WM_SETCURSOR:
  505. if ((HIWORD(lParam) == WM_MOUSEMOVE))
  506. {
  507. if(myResM.scrollflage[0]=='1')
  508. SetTimer(m_hWnd,1,20,NULL);
  509. SetCapture(m_hWnd);
  510. //SetWindowLong(m_hWnd,4,1);//GWL_HINSTANCE DWL_MSGRESULT
  511. }
  512. else 
  513. return DefWindowProc(m_hWnd,uMsg,wParam,lParam);
  514. break;
  515.         case WM_RBUTTONDOWN:
  516. {
  517. //char ss[100];
  518. //sprintf(ss,"%d",0);
  519. //MessageBox(0,ss,"dd",0);
  520. }
  521. break;
  522.         case WM_RBUTTONUP:
  523. y=lParam/0x10000;
  524. x=lParam%0x10000;
  525. st=getRgnFlage(x,y);
  526. switch(st)
  527. {
  528. case 1:
  529. Popup();
  530. break;
  531. case 4:
  532. selectback();
  533. break;
  534. }
  535. break;
  536.         case WM_LBUTTONDOWN:
  537. y=lParam/0x10000;
  538. x=lParam%0x10000;
  539. st=getRgnFlage(x,y);
  540. GetCursorPos( &pt );
  541. GetWindowRect(m_hWnd,&WinRect);
  542. Cursordif.x = pt.x - WinRect.left;//得到相对位置
  543. Cursordif.y = pt.y - WinRect.top;
  544. fCanMove=1;
  545. saveWM_LButton=1;
  546. if(st==1)
  547. {
  548. t=y/TextH+1;
  549. myPaintTxt(t,saveWM_LButton);
  550. }
  551. break;
  552.         case WM_LBUTTONUP:
  553. y=lParam/0x10000;
  554. x=lParam%0x10000;
  555. st=getRgnFlage(x,y);
  556. if( fCanMove && saveWM_LButton==0) 
  557. {
  558. GetCursorPos( &pt );
  559. pt.x=pt.x - Cursordif.x;
  560. pt.y=pt.y - Cursordif.y;
  561. MyWinMove(pt);
  562. }
  563. fCanMove = FALSE;
  564. if(st==2)
  565. {
  566. if(saveWM_LButton==1)
  567. {
  568. myQQWind->settxt(m_hWnd,x,y,"",0);
  569. ShowWindow(m_hWnd, SW_HIDE);
  570. ShowWindow(inputWind->m_hWnd, SW_HIDE);
  571. }
  572. }
  573. if(st==1)
  574. {
  575. t=y/TextH;
  576. saveCurLine=t+1;
  577. if(saveWM_LButton==1&&inputWind->showtxt[0]!=0)
  578. {
  579. keybd_event(49 + t, 0, 0, 1);
  580. }
  581. myPaintTxt(0,saveWM_LButton);
  582. saveWM_LButton=0;
  583. }
  584.             if(st==3)
  585. {
  586. myResM.Chtime.reset();
  587. }
  588. break;
  589.         
  590.         case WM_MOUSEMOVE:
  591. saveWM_LButton=0;
  592. y=lParam/0x10000;
  593. x=lParam%0x10000;
  594. t=y/TextH+1;
  595. saveCurLine=t;
  596. Txx=0;
  597. if(fCanMove==TRUE)
  598. {
  599. QQtimenum=0;
  600. myQQWind->settxt(m_hWnd,x,y,"",0);
  601. GetCursorPos( &pt );//取得光标位置
  602. pt.x=pt.x - Cursordif.x;
  603. pt.y=pt.y - Cursordif.y;
  604. MyWinMove(pt);
  605. myPaintTxt(0,saveWM_LButton);
  606. //使用SetWindowPos作移动时会改变集焦。可用MoveWindow解决。
  607. //在不移动时可以使用它。
  608. }
  609. else
  610. {
  611. st=getRgnFlage(x,y);
  612. if(st==4)
  613. {
  614. myQQWind->settxt(m_hWnd,x,y,"选择图片",1);
  615. //光标的设置
  616. SetCursor(LoadCursor(NULL,MAKEINTRESOURCE(32649)));    //根据选择区域设置光标
  617. }
  618. if(st==3)
  619. {
  620. myQQWind->settxt(m_hWnd,x,y,"重设计数器",1);
  621. //光标的设置
  622. SetCursor(LoadCursor(NULL,MAKEINTRESOURCE(32649)));    //根据选择区域设置光标
  623. }
  624. if(st==2)
  625. {
  626.    myPaintTxt(0,0);
  627.    myQQWind->settxt(m_hWnd,x,y,"隐藏窗口",1);
  628. //光标的设置
  629. SetCursor(LoadCursor(NULL,MAKEINTRESOURCE(32649)));    //根据选择区域设置光标
  630. }
  631. if(st==1)
  632. {
  633. QQtimenum++;
  634. if(QQtimenum>20)
  635. {
  636. if(QQtimenum>60)
  637. {
  638.    QQtimenum=0;
  639.    myQQWind->settxt(m_hWnd,x,y,"",0);
  640. }
  641. else
  642. {
  643. if(QQtimenum>40)
  644. myQQWind->settxt(m_hWnd,x,y,"PageUp/PageDown翻頁",2);
  645. else
  646. myQQWind->settxt(m_hWnd,x,y,"鼠标左键可选择输入",2);
  647. }
  648. }
  649. //光标的设置
  650. myMouseMove(t,saveWM_LButton);    //根据选择区域设置光标
  651. }
  652. }
  653.    //测试鼠标是否移出窗口
  654. if(PtInRegion(WinRGN2,x,y)==0)
  655. {
  656. QQtimenum=0;
  657. myQQWind->settxt(m_hWnd,x,y,"",0);
  658. KillTimer(m_hWnd,1);
  659. myPaintTxt(0,0);
  660. }
  661. if(fCanMove==FALSE)
  662. {   
  663. //SetWindowLong(m_hWnd,4,0);
  664. ReleaseCapture();
  665. }
  666. break;
  667. case WM_DESTROY:
  668. //SendMessage(m_hWnd,WM_CLOSE,0,0);
  669. if(myHwndParent==NULL)
  670. {
  671. //PostQuitMessage(0);
  672. }
  673. else
  674. {
  675. //SetWindowLong(m_hWnd,GWL_WNDPROC,(long)endProc);
  676. if(IsWindow(m_hWnd))
  677. DestroyWindow(m_hWnd);
  678. }
  679. break;
  680.         default:
  681.                 return DefWindowProc(m_hWnd,uMsg,wParam,lParam);
  682.             break;
  683.     }
  684.     return 0;
  685.    
  686.   } catch (...) {
  687.   MessageBox(0,"CMyWnd::WindowProc","有错误发生",0);
  688.   }
  689.    return 1;
  690. }
  691. int CMyWnd::getRgnFlage(long x,long y)
  692. {
  693. int ret=0;
  694. long rgb,r,g,b;
  695. rgb=GetPixel(myResM.oldBackDC,x,y+109);
  696. r=GetRValue(rgb);
  697. g=GetGValue(rgb);
  698. b=GetBValue(rgb);
  699. if(r==255 && g==0 && b==0)
  700. ret=1;
  701. if(r==0 && g==255 && b==0)
  702. ret=2;
  703. if(r==0 && g==0 && b==255)
  704. ret=3;
  705. if(r==0 && g==0 && b==0)
  706. ret=4;
  707.    return ret;
  708. }
  709. //根据选择区域设置光标
  710. CMyWnd::myMouseMove(int linemove,int act)
  711. {
  712. PAINTSTRUCT ps;
  713. SetBkMode(WindDC,TRANSPARENT);
  714. BeginPaint(m_hWnd, &ps);
  715.    SetCursor(LoadCursor(NULL,MAKEINTRESOURCE(32649)));
  716.    myPaintTxt(linemove,act);
  717. EndPaint(m_hWnd, &ps);
  718. }
  719.  
  720. CMyWnd::TimeShowText(int line)
  721. {
  722. HDC hdc;
  723. int t;
  724. int lineposy;
  725. static len;
  726. static SIZE sz;
  727. hdc=Texthdc;
  728. if(saveCurLine<=0)
  729. return 0;
  730. if(page.Chistr[saveCurLine-1][0]==0)
  731. return 0;
  732.  
  733. {
  734. StartPPch=page.Chistr[saveCurLine-1];
  735. TimePPch=StartPPch;
  736. len=strlen(TimePPch);
  737. GetTextExtentExPoint(hdc,TimePPch,len,WinWidth,&t,0,&sz);
  738. }
  739. t=Txx+sz.cx;
  740. if(t<0)
  741. Txx=WinWidth-TextH;
  742. lineposy=resavehight+(saveCurLine-1)*TextH;
  743.     //清除掉文本区
  744. BitBlt(hdc,0,lineposy,WinWidth,TextH,myResM.BackDC,0,lineposy,SRCCOPY);
  745. if(saveWM_LButton==0)
  746. BitBlt(hdc,0,lineposy,WinWidth,TextH,myResM.LinebarDC,0,0,SRCAND);
  747. else
  748. BitBlt(hdc,0,lineposy,WinWidth,TextH,myResM.LinebarDC1,0,0,SRCCOPY);
  749. DeleteObject(SelectObject(hdc, hUIFont));
  750. SetTextColor(hdc,RGB(0,100,0));
  751. if(saveCurLine==1)
  752. TextOut(hdc,Txx,lineposy, TimePPch,len);
  753. else
  754. TextOut(hdc,Txx+20,lineposy, TimePPch,len);
  755. Txx-=1;
  756. return 0;
  757. }
  758. int CMyWnd::myPaintTxt(int linemove ,int act )
  759. {
  760. int line=0;
  761. char shtemss[1500];
  762. PAINTSTRUCT ps;
  763. HDC hdc;
  764.    RECT LoWinRect;
  765. long h,w;
  766. GetWindowRect(m_hWnd,&LoWinRect); 
  767.    w=LoWinRect.right-LoWinRect.left;
  768. h=LoWinRect.bottom-LoWinRect.top;
  769.     //清除掉文本区
  770. hdc=Texthdc;
  771. BitBlt(hdc,0,0,WinWidth,WinHeight,myResM.BackDC,0,0,SRCCOPY);
  772. if(linemove>0 && linemove<6)
  773. {
  774. if(act==0)
  775. BitBlt(hdc,0,resavehight+(linemove-1)*TextH,WinWidth,TextH,myResM.LinebarDC,0,0,SRCAND);
  776. else
  777. BitBlt(hdc,0,resavehight+(linemove-1)*TextH,WinWidth,TextH,myResM.LinebarDC1,0,0,SRCCOPY);
  778. }
  779. for(line=0;line<5&&page.Chistr[line][0]!=0;line++)
  780. {
  781. // MessageBox(0,ss,"dd",0);
  782. if(page.Proprity[line]=='1')
  783. SetTextColor(hdc,RGB(0,0,255));
  784.     if(page.Proprity[line]=='2')
  785. SetTextColor(hdc,RGB(0,0,0));
  786.     if(page.Proprity[line]=='3')
  787. SetTextColor(hdc,RGB(0,100,0));
  788. sprintf(shtemss,"%d:%s%s",line+1,page.Chistr[line],page.Enstr[line]);
  789. if(line==0)
  790. TextOut(hdc,5,resavehight+line*TextH, shtemss,strlen(shtemss));
  791. else
  792. TextOut(hdc,25,resavehight+line*TextH, shtemss,strlen(shtemss));
  793. }
  794. BeginPaint(m_hWnd, &ps);
  795.     WindDC=GetDC(m_hWnd);
  796. BitBlt(WindDC,0,0,WinWidth,WinHeight,hdc,0,0,SRCCOPY);
  797. EndPaint(m_hWnd, &ps);
  798. // if(line<3)
  799. // MoveWindow(m_hWnd,LoWinRect.left,LoWinRect.top,w,ControlHeight+TextH*2,TRUE);
  800. // else
  801. // MoveWindow(m_hWnd,LoWinRect.left,LoWinRect.top,WinWidth,WinHeight,TRUE);
  802. }
  803. //特殊字符处理,
  804. int CMyWnd:: specsif(char *ss)
  805. {
  806. int i,t,t1,t2,len;
  807. //特殊字符处理,以便支持特殊字符了输入
  808. len=strlen(ss);
  809. if(len>=4)
  810. {
  811. t=-1;
  812. for(i=0;i<len;i++)
  813. {
  814. t++;
  815. t1=t2=-1;
  816. if(ss[i]=='0' && (ss[i+1]=='x'||ss[i+1]=='X') && i<len-2 )
  817. {
  818. if(ss[i+2]>='0' && ss[i+2]<='9')
  819. t1=ss[i+2]-'0';
  820. if(ss[i+2]>='a' && ss[i+2]<='f')
  821. t1=ss[i+2]-'a'+10;
  822. if(ss[i+2]>='A' && ss[i+2]<='F')
  823. t1=ss[i+2]-'A'+10;
  824. if(ss[i+3]>='0' && ss[i+3]<='9')
  825. t2=ss[i+3]-'0';
  826. if(ss[i+3]>='a' && ss[i+3]<='f')
  827. t2=ss[i+3]-'a'+10;
  828. if(ss[i+3]>='A' && ss[i+3]<='F')
  829. t2=ss[i+3]-'A'+10;
  830. }
  831. if(t1!=-1 && t2!=-1)
  832. {
  833. //char tem[100];
  834. //sprintf(tem,"%d %d",t1,t2);
  835. t1=t1*16+t2;
  836. ss[t]=t1;
  837. //MessageBox(0,tem,ss,0);
  838. i=i+3;
  839. }
  840. else
  841. ss[t]=ss[i];
  842. }
  843. ss[t+1]=0;
  844. }
  845. return 0;
  846. }
  847. //设置需要显示的字符串
  848. int CMyWnd:: settxt(char *ss)
  849. {
  850. int i,len,line=0;
  851. char *ppc;
  852. if(ss!=NULL)
  853. strcpy(showtxt,ss);
  854. else
  855. showtxt[0]=0;
  856. ppc=showtxt;
  857. len=strlen(ppc);
  858. for(i=0;i<5;i++)
  859. {
  860. page.Enstr[i][0]=0;
  861. page.Chistr[i][0]=0;
  862. page.Proprity[i]=0;
  863. }
  864. for(i=0;i<len;i++)
  865. {
  866. if(showtxt[i]==';')
  867. {
  868. showtxt[i]=0;
  869. strcpy(page.Enstr[line],ppc);
  870. ppc=&showtxt[i+1];
  871. line++;
  872. if(line==5)
  873. break;
  874. }
  875. if(showtxt[i]==' ')
  876. {
  877. showtxt[i]=0;
  878. strcpy(page.Chistr[line],ppc);
  879. //特殊字符处理
  880. specsif(page.Chistr[line]);
  881. page.Proprity[line]=showtxt[i+1];
  882. ppc=&showtxt[i+2];
  883. }
  884. }
  885. return 0;
  886. }
  887. int CMyWnd::MyWinMove(POINT pt)
  888. {
  889. POINT pt1;
  890. pt1=pt;
  891. myResM.WriteRegPos("CMyWnd",pt);
  892. myResM.WriteRegPos("ConHwnd",pt);
  893. pt1.y-=inputWind->ControlHeight;
  894. myResM.WriteRegPos("inputHwnd",pt1);
  895. SetWindowPos(m_hWnd, 0,  pt.x, pt.y,0, 0, 21);
  896. SetWindowPos(ConWind->m_hWnd,  0, pt.x-31, pt.y+15,0, 0, 21);
  897. SetWindowPos(inputWind->m_hWnd,0, pt1.x, pt1.y,0, 0, 21);
  898. return 0;
  899. }
  900. int CMyWnd::RedrawWin()
  901. {
  902. RECT  upwin;
  903. GetWindowRect(m_hWnd,&upwin);
  904. upwin.bottom=upwin.bottom-inputWind->ControlHeight;
  905. RedrawWindow(m_hWnd,0,0,RDW_VALIDATE|RDW_NOCHILDREN|RDW_INVALIDATE|RDW_ERASENOW|RDW_ERASE);//RDW_ERASE
  906. return 0;
  907. }
  908. //链接到目标地址
  909. int CMyWnd::selectback()
  910. {
  911. char gg[512]="";
  912. char filter[100]="图片形文件 (*.*)|*.bmp";
  913. if(browseFile(gg,255, 0,0,filter,NULL))//m_hWnd
  914. {
  915. char dd[512]="";
  916. myfileExtname(gg,dd);
  917. strupr(dd);
  918. if(strcmp(dd,"BMP")==0||strcmp(dd,"JPG")==0){
  919. RegSaveString("backpic",gg);
  920. myResM.loadback();
  921. }else{
  922. MessageBox(0,gg,"文件类型应为bmp或jpg,请重新选择。",0);
  923. }
  924. }
  925. DrawFrame();
  926. myPaintTxt(0,0);
  927.     return 0;
  928. }
  929. //链接到目标地址
  930. HINSTANCE GotoURL(LPCTSTR url, int showcmd)
  931. {
  932.     // 调用函数ShellExecute()
  933. //    HINSTANCE result = (HINSTANCE)ShellExecute(NULL, "open", url, NULL,NULL, showcmd);
  934.     return 0;
  935. }
  936. //返回所选菜单项
  937. long CMyWnd::Popup()
  938. {
  939.   long iMenu,  nMenus,result,retabout;
  940.   POINT p ;
  941.   char buffer [256]="";
  942.   long flag=0;
  943.   HMENU hMenu;
  944.   int CurentKbdNum=0;
  945.   char MenuName[20][256]={"词语管理","锁定背景","跟踪灵敏","选择背景","透 明 度","增加边框","输入模式"
  946.   ,"滚动显示","四码段词","自动造词","窗    花"," 帮  助 ","关于极速"};
  947.     GetCursorPos(&p);
  948.     hMenu = CreatePopupMenu();
  949.     nMenus = 13;
  950.     for(iMenu = 1 ;iMenu<=nMenus;iMenu++)
  951. {
  952.    flag=0;
  953.    if(2==iMenu)
  954.    {
  955.     char dd[500];
  956. RegReadString("backpic",dd);
  957. //MessageBox(0,"ddd",dd,0);
  958. if(dd[0]!=0)
  959. flag|=MF_CHECKED;
  960.    }
  961. switch (iMenu)
  962. {
  963. case 1:
  964.         flag|=MF_ENABLED;
  965. break;
  966. case 2:
  967.         flag|=MF_ENABLED;
  968. break;
  969. case 3:
  970.         flag|=MF_ENABLED;
  971. break;
  972. case 4:
  973.         flag|=MF_ENABLED;
  974. break;
  975. case 5:
  976.         flag|=MF_ENABLED;
  977. break;
  978. case 6:
  979. if(myResM.frameflage[0]=='1')
  980. flag=MF_ENABLED|MF_CHECKED;
  981. else
  982. flag=MF_ENABLED;
  983. break;
  984. case 7:
  985.         flag|=MF_ENABLED;
  986. break;
  987. case 8:
  988. if(myResM.scrollflage[0]=='1')
  989. {
  990. SetTimer(m_hWnd,1,20,NULL);
  991. flag=MF_ENABLED|MF_CHECKED;
  992. }
  993. else
  994. {
  995. flag=MF_ENABLED;
  996. }
  997. break;
  998. case 10:
  999. if(myResM.autoword[0]=='1')
  1000. {
  1001. flag=MF_ENABLED|MF_CHECKED;
  1002. }
  1003. else
  1004. {
  1005. flag=MF_ENABLED;
  1006. }
  1007. break;
  1008. case 11:
  1009. if(myResM.flowerflage[0]=='1')
  1010. {
  1011. flag=MF_ENABLED|MF_CHECKED;
  1012. }
  1013. else
  1014. {
  1015. flag=MF_ENABLED;
  1016. }
  1017. break;
  1018. case 12:
  1019.         flag|=MF_ENABLED;
  1020. break;
  1021. case 13:
  1022.         flag|=MF_ENABLED;
  1023. break;
  1024. default:
  1025.         flag=MF_GRAYED|MF_DISABLED;
  1026. break;
  1027. }
  1028.    if(iMenu==8)
  1029.            flag|=MF_MENUBREAK|MF_MENUBARBREAK;
  1030.    
  1031.    AppendMenu (hMenu, flag, iMenu, MenuName[iMenu-1]);
  1032.    if(iMenu!=7)
  1033.   AppendMenu (hMenu, MF_SEPARATOR, iMenu, "");
  1034.     }
  1035.     iMenu = TrackPopupMenu(hMenu, TPM_RIGHTBUTTON + TPM_LEFTALIGN + TPM_NONOTIFY + TPM_RETURNCMD, p.x, p.y, 0, GetForegroundWindow(), 0);
  1036.     //得到菜单的选择字符串
  1037.     result = GetMenuString(hMenu, (iMenu - 1), buffer, strlen(buffer), MF_BYPOSITION);
  1038.     
  1039.     DestroyMenu(hMenu);
  1040. if(iMenu>0)
  1041. {
  1042. switch (iMenu)
  1043. {
  1044. case 1:
  1045. {
  1046. char AppPath[500];
  1047. int i;
  1048. GetModuleFileName(hInst,AppPath,256);
  1049. for(i=strlen(AppPath)-1;i>=0;i--)
  1050. {
  1051. if(AppPath[i]=='\')
  1052. {
  1053. AppPath[i]=0;
  1054. strcat(AppPath,"\词语管理.exe ShowMessageBox");
  1055. break;
  1056. }
  1057. }
  1058. WinExec(AppPath,1);
  1059. break;
  1060. }
  1061. case 2:
  1062. myResM.FixBackPic();
  1063. {
  1064.     char dd[500]="";
  1065. //RegReadString("backpic",dd);
  1066. //MessageBox(0,"dd",dd,0);
  1067. }
  1068. break;
  1069. case 3:
  1070. if(myResM.traceflage[0]>'0' && myResM.traceflage[0]<='9')
  1071. EDIT1_txt[0]=myResM.traceflage[0];
  1072. else
  1073. EDIT1_txt[0]='0';
  1074. EDIT1_txt[1]=0;
  1075. strcpy(EDIT2_txt,"        跟踪灵敏度设10个级别:0立即移动,1为20个单位,……,8为160个单位,9锁定,默认为3。以下为当前灵敏度");
  1076. retabout=DialogBox(hInst,MAKEINTRESOURCE(IDD_DIALOG1),0,About);
  1077. if(retabout==IDOK)
  1078. {
  1079. myResM.traceflage[0]=EDIT1_txt[0];
  1080. myResM.traceflage[1]=0;
  1081. if(myResM.traceflage[0]>'0' && myResM.traceflage[0]<='9')
  1082. RegSaveString("traceflage",myResM.traceflage); 
  1083. else
  1084. RegSaveString("traceflage","0"); 
  1085. }
  1086. break;
  1087. case 4:
  1088. selectback();
  1089. break;
  1090. case 5:
  1091. {
  1092. char tem[20];
  1093. sprintf(tem,"%d",myResM.clarityflage);
  1094. strcpy(EDIT1_txt,tem);
  1095. strcpy(EDIT2_txt,"        透明度设置,值越小透明度越高,可以是1-255中的一个值。当前的值为:");
  1096.        retabout=DialogBox(hInst,MAKEINTRESOURCE(IDD_DIALOG1),0,About);
  1097. if(retabout==IDOK)
  1098. {
  1099. myResM.clarityflage=EDIT1_NUM;
  1100. if(myResM.clarityflage==0||myResM.clarityflage>255)
  1101. myResM.clarityflage=200;
  1102. WriteReg("clarityflage",(DWORD)myResM.clarityflage);
  1103. SetAllWinAttrib(myResM.clarityflage);
  1104. }
  1105. }
  1106. break;
  1107. case 6:
  1108. if(myResM.frameflage[0]=='1')
  1109. {
  1110. RegSaveString("frameflage","0");
  1111. myResM.frameflage[0]='0';
  1112. }
  1113. else
  1114. {
  1115. myResM.RegSaveString("frameflage","1");
  1116. myResM.frameflage[0]='1';
  1117. }
  1118. DrawFrame();
  1119. break;
  1120. case 7:
  1121. GotoURL("www.cctv.com",1);
  1122. ConWind->ModlePopup(myResM.CurModleNum);
  1123. break;
  1124. case 8:
  1125. if(myResM.scrollflage[0]=='1')
  1126. {
  1127. RegSaveString("scrollflage","0");
  1128. myResM.scrollflage[0]='0';
  1129. }
  1130. else
  1131. {
  1132. myResM.RegSaveString("scrollflage","1");
  1133. myResM.scrollflage[0]='1';
  1134. }
  1135. break;
  1136. case 10:
  1137. if(myResM.autoword[0]=='1')
  1138. {
  1139. RegSaveString("autoword","0");
  1140. myResM.autoword[0]='0';
  1141. }
  1142. else
  1143. {
  1144. myResM.RegSaveString("autoword","1");
  1145. myResM.autoword[0]='1';
  1146. }
  1147. break;
  1148. case 11:
  1149. if(myResM.flowerflage[0]=='1')
  1150. {
  1151. RegSaveString("flowerflage","0");
  1152. myResM.flowerflage[0]='0';
  1153. }
  1154. else
  1155. {
  1156. myResM.RegSaveString("flowerflage","1");
  1157. myResM.flowerflage[0]='1';
  1158. }
  1159. DrawFrame();
  1160. break;
  1161. case 12:
  1162. WinExec("hh c:\jsime\jsime.CHM",1);
  1163. //WinHelp(NULL,"c:\jsime\jsime.hlp",HELP_CONTENTS,0);
  1164. break;
  1165. case 13:
  1166. strcpy(EDIT1_txt,"E-MAIL:whln669@sohu.com ");
  1167. strcpy(EDIT2_txt,"        首先感谢各位用户使用《极速五笔》,本软件是由王华设计开发,如对本软件有意见和建议,或需要得到帮助,请发电子邮件与本人联系。谢谢!");
  1168. DialogBox(hInst,MAKEINTRESOURCE(IDD_DIALOG1),0,About);
  1169. break;
  1170. default:
  1171. MessageBox(0,"过两天补上","功能暂时未编码",0);
  1172. break;
  1173. }
  1174. }
  1175. return  0;
  1176. }
  1177. //////////////////////////////////////////////////////////////////////////////
  1178. //  内部函数
  1179. //  需要类CMyWnd支持
  1180. int CMyWnd::MyMoveWinInput(HWND hWnd ,long x,long y)
  1181. {
  1182. RECT LoWinRect,ParentWinRect,screenrc;
  1183. long h,w,temy;
  1184. static int savy;;
  1185. int trace;
  1186. //char ss[100];
  1187. //sprintf(ss,"%d",cmywnd->m_hWnd);
  1188. //MessageBox(0,"Main create",ss,0);
  1189. temy=y;
  1190. SystemParametersInfo(SPI_GETWORKAREA,0, &screenrc,0);
  1191. GetWindowRect(m_hWnd,&LoWinRect); 
  1192. if(IsWindow(hWnd))
  1193. {
  1194. GetWindowRect(hWnd,&ParentWinRect); 
  1195. }
  1196. else
  1197. {
  1198. ParentWinRect.right=0;
  1199. ParentWinRect.left=0;
  1200. ParentWinRect.top=0;
  1201. ParentWinRect.bottom=0;
  1202. }
  1203. w=LoWinRect.right-LoWinRect.left;
  1204. h=LoWinRect.bottom-LoWinRect.top;
  1205. if((x>10000 && y>10000)||(x<=0 && y<=0))
  1206. return 0;
  1207. x=x+ParentWinRect.left;
  1208. y=y+ParentWinRect.top+inputWind->ControlHeight;
  1209. //如果座标远离窗口时才移动。
  1210. trace=(int)(myResM.traceflage[0]-'0');
  1211. if(trace<9)
  1212. {
  1213. int t,con;
  1214. trace=trace*20;
  1215. t=LoWinRect.left-x;
  1216. if(t> trace || t<-trace|| savy!=temy )
  1217. {
  1218. savy=temy;
  1219. con=inputWind->ControlHeight;
  1220. if(x<screenrc.left )
  1221. x=screenrc.left;
  1222. if( x>screenrc.right-w)
  1223. x=screenrc.right-w;
  1224. if( y<screenrc.top )
  1225. y=screenrc.top;
  1226. if(y>screenrc.bottom-h-con )
  1227. {
  1228. //y=screenrc.bottom-h;
  1229. y=y-con-h-40;
  1230. MoveWindow(m_hWnd,x,y,w,h,TRUE);
  1231. y=y+h;
  1232. x=x+20;
  1233. MoveWindow(inputWind->m_hWnd,x,y,w,con,TRUE);
  1234. }
  1235. else
  1236. {
  1237. y=y+10;
  1238. MoveWindow(inputWind->m_hWnd,x,y,w,con,TRUE);
  1239. y=y+con;
  1240. MoveWindow(m_hWnd,x,y,w,h,TRUE);
  1241. }
  1242. // SetWindowPos(ConWind->m_hWnd, 0, x,y,0, 0, 21); //SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER  //16/1/4
  1243. }
  1244. }
  1245. return 0;
  1246. }