Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /trunk/teraterm/teraterm/clipboar.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3688 - (hide annotations) (download) (as text)
Thu Nov 19 12:39:49 2009 UTC (14 years, 4 months ago) by doda
File MIME type: text/x-csrc
File size: 15524 byte(s)
PasteDelayPerLineが正しく働いていなかったのを修正。

1 maya 3227 /* Tera Term
2     Copyright(C) 1994-1998 T. Teranishi
3     All rights reserved. */
4    
5     /* TERATERM.EXE, Clipboard routines */
6     #include "teraterm.h"
7     #include "tttypes.h"
8     #include "vtdisp.h"
9     #include <string.h>
10     #include <stdlib.h>
11     #include <stdio.h>
12 yutakapon 3635 #include <commctrl.h>
13 maya 3227
14     #include "ttwinman.h"
15     #include "ttcommon.h"
16    
17     #include "clipboar.h"
18     #include "tt_res.h"
19    
20     // for clipboard copy
21     static HGLOBAL CBCopyHandle = NULL;
22     static PCHAR CBCopyPtr = NULL;
23    
24     // for clipboard paste
25     static HGLOBAL CBMemHandle = NULL;
26     static PCHAR CBMemPtr = NULL;
27     static LONG CBMemPtr2 = 0;
28     static BOOL CBAddCR = FALSE;
29     static BYTE CBByte;
30     static BOOL CBRetrySend;
31     static BOOL CBRetryEcho;
32     static BOOL CBSendCR;
33     static BOOL CBDDE;
34    
35     static HFONT DlgClipboardFont;
36    
37     PCHAR CBOpen(LONG MemSize)
38     {
39 maya 3393 if (MemSize==0) {
40     return (NULL);
41     }
42     if (CBCopyHandle!=NULL) {
43     return (NULL);
44     }
45     CBCopyPtr = NULL;
46     CBCopyHandle = GlobalAlloc(GMEM_MOVEABLE, MemSize);
47     if (CBCopyHandle == NULL) {
48     MessageBeep(0);
49     }
50     else {
51     CBCopyPtr = GlobalLock(CBCopyHandle);
52     if (CBCopyPtr == NULL) {
53     GlobalFree(CBCopyHandle);
54     CBCopyHandle = NULL;
55     MessageBeep(0);
56     }
57     }
58     return (CBCopyPtr);
59 maya 3227 }
60    
61     void CBClose()
62     {
63 maya 3393 BOOL Empty;
64     if (CBCopyHandle==NULL) {
65     return;
66     }
67 maya 3227
68 maya 3393 Empty = FALSE;
69     if (CBCopyPtr!=NULL) {
70     Empty = (CBCopyPtr[0]==0);
71     }
72 maya 3227
73 maya 3393 GlobalUnlock(CBCopyHandle);
74     CBCopyPtr = NULL;
75 maya 3227
76 maya 3393 if (OpenClipboard(HVTWin)) {
77     EmptyClipboard();
78     if (! Empty) {
79     SetClipboardData(CF_TEXT, CBCopyHandle);
80     }
81     CloseClipboard();
82     }
83     CBCopyHandle = NULL;
84 maya 3227 }
85    
86     void CBStartPaste(HWND HWin, BOOL AddCR,
87 maya 3393 int BuffSize, PCHAR DataPtr, int DataSize)
88 maya 3227 //
89     // DataPtr and DataSize are used only for DDE
90     // For clipboard, BuffSize should be 0
91     // DataSize should be <= BuffSize
92     {
93 maya 3393 UINT Cf;
94 maya 3227
95 maya 3393 if (! cv.Ready) {
96     return;
97     }
98     if (TalkStatus!=IdTalkKeyb) {
99     return;
100     }
101 maya 3227
102 maya 3393 CBAddCR = AddCR;
103 maya 3227
104 maya 3393 if (BuffSize==0) { // for clipboar
105     if (IsClipboardFormatAvailable(CF_TEXT)) {
106     Cf = CF_TEXT;
107     }
108     else if (IsClipboardFormatAvailable(CF_OEMTEXT)) {
109     Cf = CF_OEMTEXT;
110     }
111     else {
112     return;
113     }
114     }
115 maya 3227
116 maya 3393 CBMemHandle = NULL;
117     CBMemPtr = NULL;
118     CBMemPtr2 = 0;
119     CBDDE = FALSE;
120     if (BuffSize==0) { //clipboard
121     if (OpenClipboard(HWin)) {
122     CBMemHandle = GetClipboardData(Cf);
123     }
124     if (CBMemHandle!=NULL) {
125     TalkStatus=IdTalkCB;
126     }
127     }
128     else { // dde
129     CBMemHandle = GlobalAlloc(GHND,BuffSize);
130     if (CBMemHandle != NULL) {
131     CBDDE = TRUE;
132     CBMemPtr = GlobalLock(CBMemHandle);
133     if (CBMemPtr != NULL) {
134     memcpy(CBMemPtr,DataPtr,DataSize);
135     GlobalUnlock(CBMemHandle);
136     CBMemPtr=NULL;
137     TalkStatus=IdTalkCB;
138     }
139     }
140     }
141     CBRetrySend = FALSE;
142     CBRetryEcho = FALSE;
143     CBSendCR = FALSE;
144     if (TalkStatus != IdTalkCB) {
145     CBEndPaste();
146     }
147 maya 3227 }
148    
149     // �����������N���b�v�{�[�h������DDE�f�[�^���[�������������B
150     //
151     // CBMemHandle�n���h�����O���[�o�������������A�����������I�������������A
152     // �����N���b�v�{�[�h������DDE�f�[�^�������������������������i�j�����������\�������j�B
153     // �����A�f�[�^���� null-terminate �����������������O�����������������A�������f�[�^����
154     // �����������B
155     // (2006.11.6 yutaka)
156     void CBSend()
157     {
158 maya 3393 int c;
159     BOOL EndFlag;
160 doda 3688 static DWORD lastcr;
161     DWORD now;
162 maya 3227
163 maya 3393 if (CBMemHandle==NULL) {
164     return;
165     }
166 maya 3227
167 doda 3688 now = GetTickCount();
168     if (now < lastcr + ts.PasteDelayPerLine ||
169     (now > lastcr && lastcr + ts.PasteDelayPerLine < lastcr)) {
170     return;
171     }
172    
173 maya 3393 if (CBRetrySend) {
174     CBRetryEcho = (ts.LocalEcho>0);
175     c = CommTextOut(&cv,(PCHAR)&CBByte,1);
176     CBRetrySend = (c==0);
177     if (CBRetrySend) {
178     return;
179     }
180     }
181 maya 3227
182 maya 3393 if (CBRetryEcho) {
183     c = CommTextEcho(&cv,(PCHAR)&CBByte,1);
184     CBRetryEcho = (c==0);
185     if (CBRetryEcho) {
186     return;
187     }
188     }
189 maya 3227
190 maya 3393 CBMemPtr = GlobalLock(CBMemHandle);
191     if (CBMemPtr==NULL) {
192     return;
193     }
194 maya 3227
195 maya 3393 do {
196     if (CBSendCR && (CBMemPtr[CBMemPtr2]==0x0a)) {
197     CBMemPtr2++;
198     // added PasteDelayPerLine (2009.4.12 maya)
199 doda 3688 lastcr = now;
200 doda 3685 CBSendCR = FALSE;
201 doda 3688 SetTimer(HVTWin, IdPasteDelayTimer, ts.PasteDelayPerLine, NULL);
202 doda 3685 break;
203 maya 3393 }
204    
205     EndFlag = (CBMemPtr[CBMemPtr2]==0);
206     if (! EndFlag) {
207     CBByte = CBMemPtr[CBMemPtr2];
208     CBMemPtr2++;
209 maya 3227 // Decoding characters which are encoded by MACRO
210     // to support NUL character sending
211     //
212     // [encoded character] --> [decoded character]
213     // 01 01 --> 00
214     // 01 02 --> 01
215 maya 3393 if (CBByte==0x01) { /* 0x01 from MACRO */
216     CBByte = CBMemPtr[CBMemPtr2];
217     CBMemPtr2++;
218     CBByte = CBByte - 1; // character just after 0x01
219     }
220     }
221     else if (CBAddCR) {
222     EndFlag = FALSE;
223     CBAddCR = FALSE;
224     CBByte = 0x0d;
225     }
226     else {
227     CBEndPaste();
228     return;
229     }
230 maya 3227
231 maya 3393 if (! EndFlag) {
232     c = CommTextOut(&cv,(PCHAR)&CBByte,1);
233     CBSendCR = (CBByte==0x0D);
234     CBRetrySend = (c==0);
235     if ((! CBRetrySend) &&
236     (ts.LocalEcho>0)) {
237     c = CommTextEcho(&cv,(PCHAR)&CBByte,1);
238     CBRetryEcho = (c==0);
239     }
240     }
241     else {
242     c=0;
243     }
244     }
245     while (c>0);
246 maya 3227
247 maya 3393 if (CBMemPtr!=NULL) {
248     GlobalUnlock(CBMemHandle);
249     CBMemPtr=NULL;
250     }
251 maya 3227 }
252    
253     void CBEndPaste()
254     {
255 maya 3393 TalkStatus = IdTalkKeyb;
256 maya 3227
257 maya 3393 if (CBMemHandle!=NULL) {
258     if (CBMemPtr!=NULL) {
259     GlobalUnlock(CBMemHandle);
260     }
261     if (CBDDE) {
262     GlobalFree(CBMemHandle);
263     }
264     }
265     if (!CBDDE) {
266     CloseClipboard();
267     }
268 maya 3227
269 maya 3393 CBDDE = FALSE;
270     CBMemHandle = NULL;
271     CBMemPtr = NULL;
272     CBMemPtr2 = 0;
273     CBAddCR = FALSE;
274 maya 3227 }
275    
276    
277     static char *ClipboardPtr = NULL;
278     static int PasteCanceled = 0;
279    
280     static LRESULT CALLBACK OnClipboardDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
281     {
282     LOGFONT logfont;
283     HFONT font;
284     char uimsg[MAX_UIMSG];
285     //char *p;
286     POINT p;
287     RECT rc_dsk, rc_dlg;
288     int dlg_height, dlg_width;
289     OSVERSIONINFO osvi;
290     static int ok2right, info2bottom, edit2ok, edit2info;
291     RECT rc_edit, rc_ok, rc_cancel, rc_info;
292 yutakapon 3635 // for status bar
293     static HWND hStatus = NULL;
294 maya 3641 static init_width, init_height;
295 maya 3227
296     switch (msg) {
297     case WM_INITDIALOG:
298     #if 0
299     for (p = ClipboardPtr; *p ; p++) {
300     char buf[20];
301     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%02x ", *p);
302     OutputDebugString(buf);
303     }
304     #endif
305    
306     font = (HFONT)SendMessage(hDlgWnd, WM_GETFONT, 0, 0);
307     GetObject(font, sizeof(LOGFONT), &logfont);
308     if (get_lang_font("DLG_TAHOMA_FONT", hDlgWnd, &logfont, &DlgClipboardFont, ts.UILanguageFile)) {
309     SendDlgItemMessage(hDlgWnd, IDC_EDIT, WM_SETFONT, (WPARAM)DlgClipboardFont, MAKELPARAM(TRUE,0));
310     SendDlgItemMessage(hDlgWnd, IDC_CLIPBOARD_INFO, WM_SETFONT, (WPARAM)DlgClipboardFont, MAKELPARAM(TRUE,0));
311     SendDlgItemMessage(hDlgWnd, IDOK, WM_SETFONT, (WPARAM)DlgClipboardFont, MAKELPARAM(TRUE,0));
312     SendDlgItemMessage(hDlgWnd, IDCANCEL, WM_SETFONT, (WPARAM)DlgClipboardFont, MAKELPARAM(TRUE,0));
313     }
314     else {
315     DlgClipboardFont = NULL;
316     }
317    
318     GetWindowText(hDlgWnd, uimsg, sizeof(uimsg));
319     get_lang_msg("DLG_CLIPBOARD_TITLE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
320     SetWindowText(hDlgWnd, ts.UIMsg);
321     GetDlgItemText(hDlgWnd, IDC_CLIPBOARD_INFO, uimsg, sizeof(uimsg));
322     get_lang_msg("DLG_CLIPBOARD_INFO", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
323     SetDlgItemText(hDlgWnd, IDC_CLIPBOARD_INFO, ts.UIMsg);
324     GetDlgItemText(hDlgWnd, IDCANCEL, uimsg, sizeof(uimsg));
325     get_lang_msg("BTN_CANCEL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
326     SetDlgItemText(hDlgWnd, IDCANCEL, ts.UIMsg);
327     GetDlgItemText(hDlgWnd, IDOK, uimsg, sizeof(uimsg));
328     get_lang_msg("BTN_OK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
329     SetDlgItemText(hDlgWnd, IDOK, ts.UIMsg);
330    
331     SendMessage(GetDlgItem(hDlgWnd, IDC_EDIT), WM_SETTEXT, 0, (LPARAM)ClipboardPtr);
332    
333     DispConvScreenToWin(CursorX, CursorY, &p.x, &p.y);
334     ClientToScreen(HVTWin, &p);
335    
336     // �L�����b�g���������������o���������������\���t����������
337     // �m�F�E�C���h�E�����������������\���������������������B
338     // �E�C���h�E���������o������������������ (2008.4.24 maya)
339     osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
340     GetVersionEx(&osvi);
341 maya 3509 if ( (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion == 4) ||
342     (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && osvi.dwMinorVersion < 10) ) {
343     // NT4.0, 95 ���}���`���j�^API��������
344 maya 3227 SystemParametersInfo(SPI_GETWORKAREA, 0, &rc_dsk, 0);
345     }
346     else {
347     HMONITOR hm;
348     POINT pt;
349     MONITORINFO mi;
350    
351     pt.x = p.x;
352     pt.y = p.y;
353     hm = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
354    
355     mi.cbSize = sizeof(MONITORINFO);
356     GetMonitorInfo(hm, &mi);
357     rc_dsk = mi.rcWork;
358     }
359     GetWindowRect(hDlgWnd, &rc_dlg);
360     dlg_height = rc_dlg.bottom-rc_dlg.top;
361     dlg_width = rc_dlg.right-rc_dlg.left;
362     if (p.y < rc_dsk.top) {
363     p.y = rc_dsk.top;
364     }
365     else if (p.y + dlg_height > rc_dsk.bottom) {
366     p.y = rc_dsk.bottom - dlg_height;
367     }
368     if (p.x < rc_dsk.left) {
369     p.x = rc_dsk.left;
370     }
371     else if (p.x + dlg_width > rc_dsk.right) {
372     p.x = rc_dsk.right - dlg_width;
373     }
374    
375     SetWindowPos(hDlgWnd, NULL, p.x, p.y,
376     0, 0, SWP_NOSIZE | SWP_NOZORDER);
377    
378 maya 3641 // �_�C�A���O�������T�C�Y������
379     GetWindowRect(hDlgWnd, &rc_dlg);
380     init_width = rc_dlg.right - rc_dlg.left;
381     init_height = rc_dlg.bottom - rc_dlg.top;
382    
383 maya 3227 // �����T�C�Y�����K�v���l���v�Z
384     GetClientRect(hDlgWnd, &rc_dlg);
385     GetWindowRect(GetDlgItem(hDlgWnd, IDC_EDIT), &rc_edit);
386     GetWindowRect(GetDlgItem(hDlgWnd, IDOK), &rc_ok);
387     GetWindowRect(GetDlgItem(hDlgWnd, IDC_CLIPBOARD_INFO), &rc_info);
388    
389     p.x = rc_dlg.right;
390     p.y = rc_dlg.bottom;
391     ClientToScreen(hDlgWnd, &p);
392     ok2right = p.x - rc_ok.left;
393     info2bottom = p.y - rc_info.top;
394     edit2ok = rc_ok.left - rc_edit.right;
395     edit2info = rc_info.top - rc_edit.bottom;
396    
397     // �T�C�Y������
398     SetWindowPos(hDlgWnd, NULL, 0, 0,
399     ts.PasteDialogSize.cx, ts.PasteDialogSize.cy,
400     SWP_NOZORDER | SWP_NOMOVE);
401    
402 yutakapon 3635 // ���T�C�Y�A�C�R�����E�����\���������������A�X�e�[�^�X�o�[���t�����B
403     InitCommonControls();
404     hStatus = CreateStatusWindow(
405     WS_CHILD | WS_VISIBLE |
406     CCS_BOTTOM | SBARS_SIZEGRIP, NULL, hDlgWnd, 1);
407    
408 maya 3227 return TRUE;
409    
410     case WM_COMMAND:
411     switch (LOWORD(wp)) {
412     case IDOK:
413     {
414     int len = SendMessage(GetDlgItem(hDlgWnd, IDC_EDIT), WM_GETTEXTLENGTH, 0, 0);
415     HGLOBAL hMem;
416     char *buf;
417    
418     hMem = GlobalAlloc(GMEM_MOVEABLE, len + 1);
419     buf = GlobalLock(hMem);
420     SendMessage(GetDlgItem(hDlgWnd, IDC_EDIT), WM_GETTEXT, len + 1, (LPARAM)buf);
421     GlobalUnlock(hMem);
422    
423     EmptyClipboard();
424     SetClipboardData(CF_TEXT, hMem);
425    
426     // hMem���N���b�v�{�[�h�������������������A�j�����������������B
427    
428     if (DlgClipboardFont != NULL) {
429     DeleteObject(DlgClipboardFont);
430     }
431    
432 yutakapon 3635 DestroyWindow(hStatus);
433 maya 3227 EndDialog(hDlgWnd, IDOK);
434     }
435     break;
436    
437     case IDCANCEL:
438     PasteCanceled = 1;
439    
440     if (DlgClipboardFont != NULL) {
441     DeleteObject(DlgClipboardFont);
442     }
443    
444 yutakapon 3635 DestroyWindow(hStatus);
445 maya 3227 EndDialog(hDlgWnd, IDCANCEL);
446     break;
447    
448     default:
449     return FALSE;
450     }
451    
452     #if 0
453     case WM_CLOSE:
454     PasteCanceled = 1;
455     EndDialog(hDlgWnd, 0);
456     return TRUE;
457     #endif
458    
459     case WM_SIZE:
460     {
461     // ���z�u
462     POINT p;
463     int dlg_w, dlg_h;
464    
465     GetClientRect(hDlgWnd, &rc_dlg);
466     dlg_w = rc_dlg.right;
467     dlg_h = rc_dlg.bottom;
468    
469     GetWindowRect(GetDlgItem(hDlgWnd, IDC_EDIT), &rc_edit);
470     GetWindowRect(GetDlgItem(hDlgWnd, IDOK), &rc_ok);
471     GetWindowRect(GetDlgItem(hDlgWnd, IDCANCEL), &rc_cancel);
472     GetWindowRect(GetDlgItem(hDlgWnd, IDC_CLIPBOARD_INFO), &rc_info);
473    
474     // OK
475     p.x = rc_ok.left;
476     p.y = rc_ok.top;
477     ScreenToClient(hDlgWnd, &p);
478     SetWindowPos(GetDlgItem(hDlgWnd, IDOK), 0,
479     dlg_w - ok2right, p.y, 0, 0,
480     SWP_NOSIZE | SWP_NOZORDER);
481    
482     // CANCEL
483     p.x = rc_cancel.left;
484     p.y = rc_cancel.top;
485     ScreenToClient(hDlgWnd, &p);
486     SetWindowPos(GetDlgItem(hDlgWnd, IDCANCEL), 0,
487     dlg_w - ok2right, p.y, 0, 0,
488     SWP_NOSIZE | SWP_NOZORDER);
489    
490     // INFO
491     p.x = rc_info.left;
492     p.y = rc_info.top;
493     ScreenToClient(hDlgWnd, &p);
494     SetWindowPos(GetDlgItem(hDlgWnd, IDC_CLIPBOARD_INFO), 0,
495     p.x, dlg_h - info2bottom, 0, 0,
496     SWP_NOSIZE | SWP_NOZORDER);
497    
498     // EDIT
499     p.x = rc_edit.left;
500     p.y = rc_edit.top;
501     ScreenToClient(hDlgWnd, &p);
502     SetWindowPos(GetDlgItem(hDlgWnd, IDC_EDIT), 0,
503     0, 0, dlg_w - p.x - edit2ok - ok2right, dlg_h - p.y - edit2info - info2bottom,
504     SWP_NOMOVE | SWP_NOZORDER);
505    
506     // �T�C�Y������
507     GetWindowRect(hDlgWnd, &rc_dlg);
508     ts.PasteDialogSize.cx = rc_dlg.right - rc_dlg.left;
509     ts.PasteDialogSize.cy = rc_dlg.bottom - rc_dlg.top;
510 yutakapon 3635
511     // status bar
512     SendMessage(hStatus , msg , wp , lp);
513 maya 3227 }
514     return TRUE;
515    
516 maya 3641 case WM_GETMINMAXINFO:
517     {
518     // �_�C�A���O�������T�C�Y����������������������������
519     LPMINMAXINFO lpmmi;
520     lpmmi = (LPMINMAXINFO)lp;
521     lpmmi->ptMinTrackSize.x = init_width;
522     lpmmi->ptMinTrackSize.y = init_height;
523     }
524     return FALSE;
525    
526 maya 3227 default:
527     return FALSE;
528     }
529     return TRUE;
530     }
531    
532 yutakapon 3535 // �t�@�C�������`���������������Atext���������������������B
533     static int search_clipboard(char *filename, char *text)
534     {
535     int ret = 0; // no hit
536     FILE *fp = NULL;
537     char buf[256];
538     int len;
539    
540     if (filename == NULL || filename[0] == '\0')
541     goto error;
542    
543     fp = fopen(filename, "r");
544     if (fp == NULL)
545     goto error;
546    
547     // TODO: ���s��256byte�������������������l��
548     while (fgets(buf, sizeof(buf), fp) != NULL) {
549     len = strlen(buf);
550     if (buf[len - 1] == '\n')
551     buf[len - 1] = '\0';
552     if (buf[0] == '\0')
553     continue;
554     if (strstr(text, buf)) { // hit
555     ret = 1;
556     break;
557     }
558     }
559    
560     error:
561     if (fp)
562     fclose(fp);
563    
564     return (ret);
565     }
566    
567    
568 maya 3227 //
569     // �N���b�v�{�[�h�����s�R�[�h�����������������A�m�F�_�C�A���O���\�������B
570     // �N���b�v�{�[�h�����X�����\�B
571     //
572     // return 0: Cancel
573     // 1: Paste OK
574     //
575     // (2008.2.3 yutaka)
576     //
577     int CBStartPasteConfirmChange(HWND HWin)
578     {
579     UINT Cf;
580     HANDLE hText;
581     char *pText;
582     int pos;
583     int ret = 0;
584 yutakapon 3535 int confirm = 0;
585 maya 3227
586     if (ts.ConfirmChangePaste == 0)
587     return 1;
588    
589     if (! cv.Ready)
590     goto error;
591     if (TalkStatus!=IdTalkKeyb)
592     goto error;
593    
594     if (IsClipboardFormatAvailable(CF_TEXT))
595     Cf = CF_TEXT;
596     else if (IsClipboardFormatAvailable(CF_OEMTEXT))
597     Cf = CF_OEMTEXT;
598     else
599     goto error;
600    
601     if (!OpenClipboard(HWin))
602     goto error;
603    
604     hText = GetClipboardData(Cf);
605    
606     if (hText != NULL) {
607     pText = (char *)GlobalLock(hText);
608     pos = strcspn(pText, "\r\n"); // ���s����������������
609     if (pText[pos] != '\0') {
610 yutakapon 3535 confirm = 1;
611    
612     } else {
613     // �������T�[�`����
614     if (search_clipboard(ts.ConfirmChangePasteStringFile, pText)) {
615     confirm = 1;
616     }
617    
618     }
619    
620     if (confirm) {
621 maya 3227 ClipboardPtr = pText;
622     PasteCanceled = 0;
623     ret = DialogBox(hInst, MAKEINTRESOURCE(IDD_CLIPBOARD_DIALOG),
624     HVTWin, (DLGPROC)OnClipboardDlgProc);
625     if (ret == 0 || ret == -1) {
626     ret = GetLastError();
627     }
628    
629     if (PasteCanceled) {
630     ret = 0;
631     GlobalUnlock(hText);
632     CloseClipboard();
633     goto error;
634     }
635    
636     }
637    
638     ret = 1;
639    
640     GlobalUnlock(hText);
641     }
642    
643     CloseClipboard();
644    
645     error:
646     return (ret);
647     }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26