当前位置: 首页>>代码示例>>C++>>正文


C++ wyString::GetAsWideChar方法代码示例

本文整理汇总了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;
}
开发者ID:Fale,项目名称:sqlyog,代码行数:47,代码来源:Favorite.cpp

示例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);
 }
开发者ID:Fale,项目名称:sqlyog,代码行数:16,代码来源:Favorite.cpp

示例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;
}
开发者ID:Fale,项目名称:sqlyog,代码行数:40,代码来源:Favorite.cpp


注:本文中的wyString::GetAsWideChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。