本文整理汇总了C++中wyString::GetAsWideChar方法的典型用法代码示例。如果您正苦于以下问题:C++ wyString::GetAsWideChar方法的具体用法?C++ wyString::GetAsWideChar怎么用?C++ wyString::GetAsWideChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wyString
的用法示例。
在下文中一共展示了wyString::GetAsWideChar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnError
// Function to create a favorite file or folder in the given path //
wyBool
FavoriteBase::InsertFavoriteItem(wyString &path, wyBool isfolder , wyString &favquery)
{
DWORD byteswritten;
HANDLE hfile;
//const unsigned char utf8bom[10] = {unsigned char(0xEF), unsigned char(0xBB), unsigned char(0xBF)};
// if the favorite is file type then add the extension//
if(!isfolder)
{
path.Add(".sql");
hfile = ::CreateFile(path.GetAsWideChar(), GENERIC_WRITE, 0, NULL, CREATE_NEW,
NULL, NULL);
if(hfile == INVALID_HANDLE_VALUE)
{
if(::GetLastError() == ERROR_FILE_EXISTS)
{
if(::MessageBox(NULL, _(L"The name you have entered for the shortcut already exists in Favorites menu.\nWould you like to overwrite it?"), _(L"Add Favorite"), MB_YESNO | MB_TASKMODAL | MB_ICONINFORMATION | MB_DEFBUTTON2) == IDYES)
{
hfile = ::CreateFile(path.GetAsWideChar(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, NULL, NULL);
if(hfile == INVALID_HANDLE_VALUE)
OnError(_("Cannot write into Favorite File"));
}
else
return wyFalse;
}
else
return OnError(_("Cannot write into Favorite File"));
}
//if (!::WriteFile(hfile, utf8bom, 3, &byteswritten , NULL))
// return OnError("Cannot write into Favorite File");
if (!::WriteFile(hfile, favquery.GetString(), favquery.GetLength(), &byteswritten , NULL))
return OnError(_("Cannot write into Favorite File"));
::CloseHandle(hfile);
}
else if(!::CreateDirectory(path.GetAsWideChar(), NULL))
return OnError(_("Cannot create Favorite Folder"));
return wyTrue;
}
示例2: VERIFY
// Function to add the given item to the treeview control //
HTREEITEM
FavoriteBase::AddItem(HWND htree, HTREEITEM parent, wyString name, wyInt32 pos)
{
TV_INSERTSTRUCT str ;
str.hParent = parent ;
str.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE ;
str.hInsertAfter = TVI_SORT;
str.item.pszText = (LPWSTR)name.GetAsWideChar();
str.item.iImage = pos ;
str.item.iSelectedImage = pos;
HTREEITEM htreeitem;
VERIFY(htreeitem = (HTREEITEM)SendMessage(htree, TVM_INSERTITEM, NULL, (wyInt32)&str));
return(htreeitem);
}
示例3: AllocateBuff
// function to process file type Favorite//
wyBool
FavoriteBase::AddFile(HMENU hmenu, wyString &parentpath, wyWChar *filename)
{
wyInt32 i , j=0;
wyUInt32 lengthwchar = 1;
wyWChar ext[_MAX_EXT] = {0} , *data = {0};
wyChar *path = {0};
MENUITEMINFO lpmii={0};
parentpath.GetAsWideChar(&lengthwchar);
path = AllocateBuff(parentpath.GetLength() + 2);
data = AllocateBuffWChar(wcslen(filename) + 2);
wcscpy(data, (wyWChar*)filename);
strcpy(path, (wyChar*)parentpath.GetString());
for(i = wcslen(data) - 1; i && data[i]!='.'; i--, j++)
ext[j] = data[i];
if(wcsnicmp(ext, L"lqs", 3) != 0)
return wyFalse;
ext[j] = 0;
data[i] = 0;
lpmii.cbSize = sizeof(MENUITEMINFO);
lpmii.fMask = MIIM_STRING|MIIM_ID|MIIM_DATA;
lpmii.wID = m_menuid++;
lpmii.dwItemData = (ULONG_PTR)path;
lpmii.cch = wcslen(data);
lpmii.dwTypeData = data;
VERIFY(::InsertMenuItem(hmenu, -1, TRUE, &lpmii));
free(data);
return wyTrue;
}