summaryrefslogtreecommitdiff
path: root/plugins/YAPP
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
commit6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch)
tree2e8bb660c908b54914abd562af8aafa4a486c846 /plugins/YAPP
parenta61c8728b379057fe7f0a0d86fe0b037598229dd (diff)
less TCHARs:
- TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAPP')
-rw-r--r--plugins/YAPP/src/message_pump.h4
-rw-r--r--plugins/YAPP/src/popwin.cpp12
-rw-r--r--plugins/YAPP/src/services.cpp6
-rw-r--r--plugins/YAPP/src/yapp.cpp34
-rw-r--r--plugins/YAPP/src/yapp_history.h4
-rw-r--r--plugins/YAPP/src/yapp_history_dlg.cpp66
6 files changed, 63 insertions, 63 deletions
diff --git a/plugins/YAPP/src/message_pump.h b/plugins/YAPP/src/message_pump.h
index a6fbb1c164..d432706822 100644
--- a/plugins/YAPP/src/message_pump.h
+++ b/plugins/YAPP/src/message_pump.h
@@ -19,12 +19,12 @@ struct PopupData
HICON hIcon;
union {
char *pszTitle;
- TCHAR *ptzTitle;
+ wchar_t *ptzTitle;
wchar_t *pwzTitle;
};
union {
char *pszText;
- TCHAR *ptzText;
+ wchar_t *ptzText;
wchar_t *pwzText;
};
COLORREF colorBack; // if colorBack and colorText are equal, defaults will be used
diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp
index 3bfa589fb7..7bbdc6ca52 100644
--- a/plugins/YAPP/src/popwin.cpp
+++ b/plugins/YAPP/src/popwin.cpp
@@ -187,7 +187,7 @@ struct PopupWindowData
bool custom_col;
HBRUSH bkBrush, barBrush, underlineBrush;
HPEN bPen;
- TCHAR tbuff[128];
+ wchar_t tbuff[128];
int tb_height, av_height, text_height, time_height, time_width;
int real_av_width, real_av_height;
bool have_av;
@@ -469,7 +469,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
if (pwd->custom_col) SetTextColor(ps.hdc, pd->colorText);
else SetTextColor(ps.hdc, colFirstLine);
- TCHAR *title = mir_u2t(pd->pwzTitle);
+ wchar_t *title = mir_u2t(pd->pwzTitle);
DrawText(ps.hdc, title, -1, &tr, DT_VCENTER | DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX);
mir_free(title);
@@ -491,7 +491,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
if (options.av_layout != PAV_NONE && options.time_layout == PT_WITHAV && pwd->time_height <= pwd->tb_height && !pwd->have_av)
GetClientRect(hwnd, &r);
- TCHAR *text = mir_u2t(pd->pwzText);
+ wchar_t *text = mir_u2t(pd->pwzText);
tr.left = r.left + options.padding + options.text_indent; tr.right = r.right - options.padding; tr.top = tr.bottom + options.padding; tr.bottom = r.bottom - options.padding;
DrawText(ps.hdc, text, -1, &tr, DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
mir_free(text);
@@ -560,7 +560,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
return TRUE;
case PUM_SETTEXT:
- replaceStrT(pd->ptzText, (TCHAR*)lParam);
+ replaceStrT(pd->ptzText, (wchar_t*)lParam);
InvalidateRect(hwnd, 0, TRUE);
RepositionWindows();
return TRUE;
@@ -592,7 +592,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
// titlebar height
if (hFontFirstLine) SelectObject(hdc, (HGDIOBJ)hFontFirstLine);
- TCHAR *title = mir_u2t(pd->pwzTitle);
+ wchar_t *title = mir_u2t(pd->pwzTitle);
GetTextExtentPoint32(hdc, title, (int)mir_tstrlen(title), &size);
mir_free(title);
pwd->tb_height = size.cy;
@@ -630,7 +630,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
r.right -= pwd->time_width + options.padding;
if (hFontSecondLine) SelectObject(hdc, (HGDIOBJ)hFontSecondLine);
- TCHAR *text = mir_u2t(pd->pwzText);
+ wchar_t *text = mir_u2t(pd->pwzText);
DrawText(hdc, text, -1, &r, DT_CALCRECT | DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
pwd->text_height = r.bottom;
mir_free(text);
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp
index c77273cb5b..8b74676a1b 100644
--- a/plugins/YAPP/src/services.cpp
+++ b/plugins/YAPP/src/services.cpp
@@ -195,11 +195,11 @@ void UpdateMenu()
{
bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1;
if (isEnabled) {
- Menu_ModifyItem(hMenuItem, LPGENT("Disable Popups"), IcoLib_GetIcon(ICO_POPUP_ON));
+ Menu_ModifyItem(hMenuItem, LPGENW("Disable Popups"), IcoLib_GetIcon(ICO_POPUP_ON));
Menu_ModifyItem(hMenuRoot, NULL, IcoLib_GetIcon(ICO_POPUP_ON));
}
else {
- Menu_ModifyItem(hMenuItem, LPGENT("Enable Popups"), IcoLib_GetIcon(ICO_POPUP_OFF));
+ Menu_ModifyItem(hMenuItem, LPGENW("Enable Popups"), IcoLib_GetIcon(ICO_POPUP_OFF));
Menu_ModifyItem(hMenuRoot, NULL, IcoLib_GetIcon(ICO_POPUP_OFF));
}
@@ -291,7 +291,7 @@ static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam)
POPUPDATAT pd = {0};
mir_tstrcpy(pd.lptzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification");
pd.lchIcon = LoadIcon(0, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION);
- _tcsncpy(pd.lptzText, _A2T((char *)wParam), MAX_SECONDLINE); pd.lptzText[MAX_SECONDLINE-1] = 0;
+ wcsncpy(pd.lptzText, _A2T((char *)wParam), MAX_SECONDLINE); pd.lptzText[MAX_SECONDLINE-1] = 0;
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, 0);
}
return 0;
diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp
index 9b64c9803b..06ce6610fd 100644
--- a/plugins/YAPP/src/yapp.cpp
+++ b/plugins/YAPP/src/yapp.cpp
@@ -94,8 +94,8 @@ static void InitFonts()
{
font_id_firstline.cbSize = sizeof(FontIDT);
font_id_firstline.flags = FIDF_ALLOWEFFECTS;
- mir_tstrcpy(font_id_firstline.group, LPGENT("Popups"));
- mir_tstrcpy(font_id_firstline.name, LPGENT("First line"));
+ mir_tstrcpy(font_id_firstline.group, LPGENW("Popups"));
+ mir_tstrcpy(font_id_firstline.name, LPGENW("First line"));
mir_strcpy(font_id_firstline.dbSettingsGroup, MODULE);
mir_strcpy(font_id_firstline.prefix, "FontFirst");
mir_tstrcpy(font_id_firstline.backgroundGroup, L"Popups");
@@ -105,8 +105,8 @@ static void InitFonts()
font_id_secondline.cbSize = sizeof(FontIDT);
font_id_secondline.flags = FIDF_ALLOWEFFECTS;
- mir_tstrcpy(font_id_secondline.group, LPGENT("Popups"));
- mir_tstrcpy(font_id_secondline.name, LPGENT("Second line"));
+ mir_tstrcpy(font_id_secondline.group, LPGENW("Popups"));
+ mir_tstrcpy(font_id_secondline.name, LPGENW("Second line"));
mir_strcpy(font_id_secondline.dbSettingsGroup, MODULE);
mir_strcpy(font_id_secondline.prefix, "FontSecond");
mir_tstrcpy(font_id_secondline.backgroundGroup, L"Popups");
@@ -116,8 +116,8 @@ static void InitFonts()
font_id_time.cbSize = sizeof(FontIDT);
font_id_time.flags = FIDF_ALLOWEFFECTS;
- mir_tstrcpy(font_id_time.group, LPGENT("Popups"));
- mir_tstrcpy(font_id_time.name, LPGENT("Time"));
+ mir_tstrcpy(font_id_time.group, LPGENW("Popups"));
+ mir_tstrcpy(font_id_time.name, LPGENW("Time"));
mir_strcpy(font_id_time.dbSettingsGroup, MODULE);
mir_strcpy(font_id_time.prefix, "FontTime");
mir_tstrcpy(font_id_time.backgroundGroup, L"Popups");
@@ -126,8 +126,8 @@ static void InitFonts()
FontRegisterT(&font_id_time);
colour_id_bg.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colour_id_bg.group, LPGENT("Popups"));
- mir_tstrcpy(colour_id_bg.name, LPGENT("Background"));
+ mir_tstrcpy(colour_id_bg.group, LPGENW("Popups"));
+ mir_tstrcpy(colour_id_bg.name, LPGENW("Background"));
mir_strcpy(colour_id_bg.dbSettingsGroup, MODULE);
mir_strcpy(colour_id_bg.setting, "ColourBg");
colour_id_bg.defcolour = GetSysColor(COLOR_3DSHADOW);
@@ -135,8 +135,8 @@ static void InitFonts()
ColourRegisterT(&colour_id_bg);
colour_id_border.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colour_id_border.group, LPGENT("Popups"));
- mir_tstrcpy(colour_id_border.name, LPGENT("Border"));
+ mir_tstrcpy(colour_id_border.group, LPGENW("Popups"));
+ mir_tstrcpy(colour_id_border.name, LPGENW("Border"));
mir_strcpy(colour_id_border.dbSettingsGroup, MODULE);
mir_strcpy(colour_id_border.setting, "ColourBorder");
colour_id_border.defcolour = RGB(0, 0, 0);
@@ -144,8 +144,8 @@ static void InitFonts()
ColourRegisterT(&colour_id_border);
colour_id_sidebar.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colour_id_sidebar.group, LPGENT("Popups"));
- mir_tstrcpy(colour_id_sidebar.name, LPGENT("Sidebar"));
+ mir_tstrcpy(colour_id_sidebar.group, LPGENW("Popups"));
+ mir_tstrcpy(colour_id_sidebar.name, LPGENW("Sidebar"));
mir_strcpy(colour_id_sidebar.dbSettingsGroup, MODULE);
mir_strcpy(colour_id_sidebar.setting, "ColourSidebar");
colour_id_sidebar.defcolour = RGB(128, 128, 128);
@@ -153,8 +153,8 @@ static void InitFonts()
ColourRegisterT(&colour_id_sidebar);
colour_id_titleunderline.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colour_id_titleunderline.group, LPGENT("Popups"));
- mir_tstrcpy(colour_id_titleunderline.name, LPGENT("Title underline"));
+ mir_tstrcpy(colour_id_titleunderline.group, LPGENW("Popups"));
+ mir_tstrcpy(colour_id_titleunderline.name, LPGENW("Title underline"));
mir_strcpy(colour_id_titleunderline.dbSettingsGroup, MODULE);
mir_strcpy(colour_id_titleunderline.setting, "ColourTitleUnderline");
colour_id_titleunderline.defcolour = GetSysColor(COLOR_3DSHADOW);
@@ -168,7 +168,7 @@ void InitMenuItems(void)
{
bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1;
- hMenuRoot = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 500010000, IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0));
+ hMenuRoot = Menu_CreateRoot(MO_MAIN, LPGENW("Popups"), 500010000, IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0));
Menu_ConfigureItem(hMenuRoot, MCI_OPT_UID, "043A641A-2767-4C57-AA57-9233D6F9DC54");
CMenuItem mi;
@@ -178,13 +178,13 @@ void InitMenuItems(void)
SET_UID(mi, 0x92c386ae, 0x6e81, 0x452d, 0xb5, 0x71, 0x87, 0x46, 0xe9, 0x2, 0x66, 0xe9);
mi.hIcolibItem = IcoLib_GetIcon(ICO_HISTORY, 0);
mi.pszService= MS_POPUP_SHOWHISTORY;
- mi.name.t = LPGENT("Popup History");
+ mi.name.w = LPGENW("Popup History");
hMenuItemHistory = Menu_AddMainMenuItem(&mi);
SET_UID(mi, 0x4353d44e, 0x177, 0x4843, 0x88, 0x30, 0x25, 0x5d, 0x91, 0xad, 0xdf, 0x3f);
mi.hIcolibItem = IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0);
mi.pszService = "Popup/EnableDisableMenuCommand";
- mi.name.t = (isEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups"));
+ mi.name.w = (isEnabled ? LPGENW("Disable Popups") : LPGENW("Enable Popups"));
hMenuItem = Menu_AddMainMenuItem(&mi);
}
diff --git a/plugins/YAPP/src/yapp_history.h b/plugins/YAPP/src/yapp_history.h
index c07c32f2ae..ff13d28b34 100644
--- a/plugins/YAPP/src/yapp_history.h
+++ b/plugins/YAPP/src/yapp_history.h
@@ -39,12 +39,12 @@ struct PopupHistoryData{
union{
char *message;
wchar_t *messageW;
- TCHAR *messageT;
+ wchar_t *messageT;
};
union{
char *title;
wchar_t *titleW;
- TCHAR *titleT;
+ wchar_t *titleT;
};
time_t timestamp;
};
diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp
index 67a1fcaa14..535b4a7ee5 100644
--- a/plugins/YAPP/src/yapp_history_dlg.cpp
+++ b/plugins/YAPP/src/yapp_history_dlg.cpp
@@ -16,7 +16,7 @@
HWND hHistoryWindow = 0; //the history window
PopupHistoryList lstPopupHistory; //defined in main.cpp
-const TCHAR *szHistoryColumns[] = {L"Title", L"Message", L"Timestamp"}; //need to make sure that the string and size vectors have the same number of elements
+const wchar_t *szHistoryColumns[] = {L"Title", L"Message", L"Timestamp"}; //need to make sure that the string and size vectors have the same number of elements
const int cxHistoryColumns[] = {100, 450, 115};
const int cHistoryColumns = sizeof(szHistoryColumns) / sizeof(szHistoryColumns[0]);
@@ -118,59 +118,59 @@ struct SortParams{
static int lastColumn = -1; //last sort column
-int MatchesFilterCS(const TCHAR *filter, const PopupHistoryData *popupItem) //case sensitive
+int MatchesFilterCS(const wchar_t *filter, const PopupHistoryData *popupItem) //case sensitive
{
if (mir_tstrlen(filter) <= 0) { return 1; } //if no filter is set then the popup item matches the filter
int match = 0;
- match = (_tcsstr(popupItem->messageT, filter)) ? 1 : match; //check message part
+ match = (wcsstr(popupItem->messageT, filter)) ? 1 : match; //check message part
if (!match) //check title part of no match has been found
{
- match = (_tcsstr(popupItem->titleT, filter)) ? 1 : match;
+ match = (wcsstr(popupItem->titleT, filter)) ? 1 : match;
}
if (!match) //if no match has been found yet try to match the timestamp
{
- TCHAR buffer[1024];
+ wchar_t buffer[1024];
struct tm *myTime = localtime(&popupItem->timestamp);
- _tcsftime(buffer, 1024, L"%c", myTime);
- match = (_tcsstr(buffer, filter)) ? 1 : match;
+ wcsftime(buffer, 1024, L"%c", myTime);
+ match = (wcsstr(buffer, filter)) ? 1 : match;
}
return match;
}
-__inline void ConvertCase(TCHAR *dest, const TCHAR *source, size_t size)
+__inline void ConvertCase(wchar_t *dest, const wchar_t *source, size_t size)
{
- _tcsncpy(dest, source, size);
- _tcslwr(dest);
+ wcsncpy(dest, source, size);
+ wcslwr(dest);
}
-int MatchesFilterCI(const TCHAR *filterS, const PopupHistoryData *popupItem)
+int MatchesFilterCI(const wchar_t *filterS, const PopupHistoryData *popupItem)
{
if (mir_tstrlen(filterS) <= 0) { return 1; } //if no filter is set then the popup item matches the filter
int match = 0;
const int BUFFER_SIZE = 1024;
- TCHAR buffer[BUFFER_SIZE];
- TCHAR filterI[BUFFER_SIZE];
+ wchar_t buffer[BUFFER_SIZE];
+ wchar_t filterI[BUFFER_SIZE];
ConvertCase(filterI, filterS, BUFFER_SIZE);
ConvertCase(buffer, popupItem->messageT, BUFFER_SIZE); //check message part
- match = (_tcsstr(buffer, filterI)) ? 1 : match;
+ match = (wcsstr(buffer, filterI)) ? 1 : match;
if (!match) // check title part of no match has been found
{
ConvertCase(buffer, popupItem->titleT, BUFFER_SIZE);
- match = (_tcsstr(buffer, filterI)) ? 1 : match;
+ match = (wcsstr(buffer, filterI)) ? 1 : match;
}
if (!match) //if no match has been found yet try to match the timestamp
{
struct tm *myTime = localtime(&popupItem->timestamp);
- _tcsftime(buffer, 1024, L"%c", myTime);
- match = (_tcsstr(buffer, filterI)) ? 1 : match;
+ wcsftime(buffer, 1024, L"%c", myTime);
+ match = (wcsstr(buffer, filterI)) ? 1 : match;
}
return match;
@@ -180,8 +180,8 @@ int CALLBACK PopupsCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam)
{
SortParams params = *(SortParams *) myParam;
const int MAX_SIZE = 512;
- TCHAR text1[MAX_SIZE];
- TCHAR text2[MAX_SIZE];
+ wchar_t text1[MAX_SIZE];
+ wchar_t text2[MAX_SIZE];
int res;
ListView_GetItemText(params.hList, (int) lParam1, params.column, text1, _countof(text1));
@@ -323,8 +323,8 @@ void DeleteOldEvents(HWND hWnd, int renderer)
}
}
-typedef int (*SIG_MATCHESFILTER)(const TCHAR *filter, const PopupHistoryData *popupItem);
-typedef void (*SIG_ADDEVENTS)(HWND hWnd, int renderer, TCHAR *filter, SIG_MATCHESFILTER MatchesFilter);
+typedef int (*SIG_MATCHESFILTER)(const wchar_t *filter, const PopupHistoryData *popupItem);
+typedef void (*SIG_ADDEVENTS)(HWND hWnd, int renderer, wchar_t *filter, SIG_MATCHESFILTER MatchesFilter);
IEVIEWEVENTDATA *CreateAndFillEventData(PopupHistoryData *popupItem)
{
@@ -345,7 +345,7 @@ IEVIEWEVENTDATA *CreateAndFillEventData(PopupHistoryData *popupItem)
return eventData;
}
-void AddEventsCustomControl(HWND hWnd, int renderer, TCHAR *filter, SIG_MATCHESFILTER MatchesFilter)
+void AddEventsCustomControl(HWND hWnd, int renderer, wchar_t *filter, SIG_MATCHESFILTER MatchesFilter)
{
PopupHistoryWindowData *pwData = (PopupHistoryWindowData *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
if (pwData)
@@ -401,10 +401,10 @@ void AddEventsCustomControl(HWND hWnd, int renderer, TCHAR *filter, SIG_MATCHESF
}
}
-void AddEventsDefault(HWND hWnd, int, TCHAR *filter, SIG_MATCHESFILTER MatchesFilter)
+void AddEventsDefault(HWND hWnd, int, wchar_t *filter, SIG_MATCHESFILTER MatchesFilter)
{
HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY);
- TCHAR buffer[1024];
+ wchar_t buffer[1024];
struct tm *myTime;
LVITEM item = {0};
@@ -423,7 +423,7 @@ void AddEventsDefault(HWND hWnd, int, TCHAR *filter, SIG_MATCHESFILTER MatchesFi
ListView_InsertItem(hHistoryList, &item);
ListView_SetItemText(hHistoryList, lIndex, 1, popupItem->messageT);
myTime = localtime(&popupItem->timestamp);
- _tcsftime(buffer, 1024, L"%c", myTime);
+ wcsftime(buffer, 1024, L"%c", myTime);
ListView_SetItemText(hHistoryList, lIndex++, 2, buffer);
}
}
@@ -437,7 +437,7 @@ void RefreshPopupHistory(HWND hWnd, int renderer)
SIG_ADDEVENTS AddEvents = (renderer == RENDER_DEFAULT) ? AddEventsDefault : AddEventsCustomControl;
- TCHAR filter[MAX_FILTER_SIZE];
+ wchar_t filter[MAX_FILTER_SIZE];
DeleteOldEvents(hWnd, renderer); //delete events
GetDlgItemText(hWnd, IDC_HISTORY_FILTER, filter, _countof(filter)); //get filter text
@@ -466,9 +466,9 @@ void CopyPopupDataToClipboard(HWND hList, int selection)
{
if (OpenClipboard(hList))
{
- TCHAR buffer[2048];
- buffer[0] = _T('\0');
- TCHAR *clipboard;
+ wchar_t buffer[2048];
+ buffer[0] = '\0';
+ wchar_t *clipboard;
int i;
int found = 0;
int count = ListView_GetItemCount(hList);
@@ -491,10 +491,10 @@ void CopyPopupDataToClipboard(HWND hList, int selection)
EmptyClipboard();
int len = (int)mir_tstrlen(buffer);
- HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (len + 2) * sizeof(TCHAR));
- clipboard = (TCHAR *) GlobalLock(hData);
- _tcsncpy(clipboard, buffer, len);
- clipboard[len] = _T('\0');
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (len + 2) * sizeof(wchar_t));
+ clipboard = (wchar_t *) GlobalLock(hData);
+ wcsncpy(clipboard, buffer, len);
+ clipboard[len] = '\0';
GlobalUnlock(hData);
if (!SetClipboardData(textType, hData))
{