The R Project SVN R

Rev

Rev 42522 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 42522 Rev 45017
Line 64... Line 64...
64
    HGLOBAL hglb;
64
    HGLOBAL hglb;
65
    char *s;
65
    char *s;
66
    int ll = strlen(str) + 1;
66
    int ll = strlen(str) + 1;
67
 
67
 
68
    if (!(hglb = GlobalAlloc(GHND, ll))){
68
    if (!(hglb = GlobalAlloc(GHND, ll))){
69
        R_ShowMessage(G_("Insufficient memory: cell not copied to the clipboard"));
69
	R_ShowMessage(G_("Insufficient memory: cell not copied to the clipboard"));
70
	return 1;
70
	return 1;
71
    }
71
    }
72
    if (!(s = (char *)GlobalLock(hglb))){
72
    if (!(s = (char *)GlobalLock(hglb))){
73
        R_ShowMessage(G_("Insufficient memory: cell not copied to the clipboard"));
73
	R_ShowMessage(G_("Insufficient memory: cell not copied to the clipboard"));
74
	return 1;
74
	return 1;
75
    }
75
    }
76
    strcpy(s, str);
76
    strcpy(s, str);
77
    GlobalUnlock(hglb);
77
    GlobalUnlock(hglb);
78
    if (!OpenClipboard(NULL) || !EmptyClipboard()) {
78
    if (!OpenClipboard(NULL) || !EmptyClipboard()) {
79
        R_ShowMessage(G_("Unable to open the clipboard"));
79
	R_ShowMessage(G_("Unable to open the clipboard"));
80
        GlobalFree(hglb);
80
	GlobalFree(hglb);
81
        return 1;
81
	return 1;
82
    }
82
    }
83
    SetClipboardData(CF_TEXT, hglb);
83
    SetClipboardData(CF_TEXT, hglb);
84
    CloseClipboard();
84
    CloseClipboard();
85
    return 0;
85
    return 0;
86
}
86
}
Line 89... Line 89...
89
{
89
{
90
    HGLOBAL hglb;
90
    HGLOBAL hglb;
91
    char *pc;
91
    char *pc;
92
 
92
 
93
    if ( OpenClipboard(NULL) &&
93
    if ( OpenClipboard(NULL) &&
94
         (hglb = GetClipboardData(CF_TEXT)) &&
94
	 (hglb = GetClipboardData(CF_TEXT)) &&
95
         (pc = (char *)GlobalLock(hglb))) {
95
	 (pc = (char *)GlobalLock(hglb))) {
96
	strncpy(str, pc, n);
96
	strncpy(str, pc, n);
97
	str[n+1] = '\0';
97
	str[n+1] = '\0';
98
        GlobalUnlock(hglb);
98
	GlobalUnlock(hglb);
99
	CloseClipboard();
99
	CloseClipboard();
100
	return 0;
100
	return 0;
101
    } else return 1;
101
    } else return 1;
102
}
102
}
103
 
103