• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ s2ws函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中s2ws函数的典型用法代码示例。如果您正苦于以下问题:C++ s2ws函数的具体用法?C++ s2ws怎么用?C++ s2ws使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了s2ws函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: request_custom_command

DWORD request_custom_command(Remote *remote, Packet *packet)
{
	Packet * response = packet_create_response(packet);
	Tlv argTlv             = {0};
	DWORD index            = 0;
	vector<wstring> args;

	LPCSTR func = packet_get_tlv_value_string(packet, TLV_TYPE_MIMIKATZ_FUNCTION);
	dprintf("Function: %s", packet_get_tlv_value_string(packet, TLV_TYPE_MIMIKATZ_FUNCTION));
	wstring function = s2ws(func);

	while( packet_enum_tlv( packet, index++, TLV_TYPE_MIMIKATZ_ARGUMENT, &argTlv ) == ERROR_SUCCESS )
	{
		dprintf("Arg: %s", (PCHAR)argTlv.buffer);
		args.push_back(s2ws((PCHAR)argTlv.buffer));
	}

	clear_buffer();

	initialize_mimikatz();
	myMimiKatz->doCommandeLocale(&function, &args);

	wchar_t* output = convert_wstring_to_wchar_t(oss.str());
	
	clear_buffer();

	packet_add_tlv_raw(response, TLV_TYPE_MIMIKATZ_RESULT, output, (DWORD)(wcslen(output)*sizeof(wchar_t)));
	packet_transmit_response(ERROR_SUCCESS, remote, response);

	return ERROR_SUCCESS;	
}
开发者ID:AnwarMohamed,项目名称:metasploit-payloads,代码行数:31,代码来源:main.cpp


示例2: comp

static bool comp(string a, string b)
{
	bool ret;

	std::wstring stemp1 = s2ws(a);
	LPCWSTR lpa1 = stemp1.c_str();

	std::wstring stemp2 = s2ws(b);
	LPCWSTR lpa2 = stemp2.c_str();

	if (StrCmpLogicalW(lpa1, lpa2) >= 0)
	{
		ret = false;
	}
	else
	{
		ret = true;
	}

	if (reverseflag)
	{
		ret = !ret;
	}

	return ret;
}
开发者ID:OleNet,项目名称:IMVL-Framework,代码行数:26,代码来源:strnatsort.cpp


示例3: IniGetStr

bool CDlgModelPlayer::OnInitDialog()
{
	m_ComboBoxSkeleton.AddItem(L"");
	m_ComboBoxHead.AddItem(L"");
	m_ComboBoxSet.AddItem(L"");
	for (size_t i=0;i<ET_MAX;++i)
	{
		m_ComboBoxEquips[i].AddItem(L"");
	}
	m_ComboBoxLeftHand.AddItem(L"");
	m_ComboBoxRightHand.AddItem(L"");
	m_ComboBoxBack.AddItem(L"");
	std::set<std::wstring>	setString;

	std::string strDirMU = IniGetStr("WorldEditor.cfg","ResDir","mu");
	std::wstring wstrFindPath = s2ws(strDirMU)+L"Player\\";//|{"+wstrFileType+L"}";
	CDir dir;
	dir.ReadDir(wstrFindPath);
	for (size_t i=0; i<dir.m_FileInfo.size(); i++)
	{
		if (!dir.m_FileInfo[i].IsDirectory())
		{
			std::wstring wstrFilename = dir.m_FileInfo[i].wstrFilename;
			std::transform(wstrFilename.begin(),wstrFilename.end(),wstrFilename.begin(),std::toupper);
			//if (wstrFileType.find(GetExtension(dir.m_FileInfo[i].wstrFilename))!=std::wstring::npos)
			if (GetExtension(wstrFilename)==L".bmd")
			{
				if (wstrFilename.find(L"HELMCLASS")!=std::wstring::npos)
				{
					m_ComboBoxHead.AddItem(wstrFilename.c_str());
				}
				else if (wstrFilename.find(L"PLAYER")!=std::wstring::npos)
				{
					m_ComboBoxSkeleton.AddItem(wstrFilename.c_str());
				}
				else
				{
					for (size_t i=0;i<ET_MAX;++i)
					{
						if (wstrFilename.find(s2ws(g_EquipNames[i]))!=std::wstring::npos)
						{
							m_ComboBoxEquips[i].AddItem(wstrFilename.c_str());
							int index=wstrFilename.find(s2ws(g_EquipNames[i]));
							wstrFilename.replace(index, strlen(g_EquipNames[i]), L"*");
							setString.insert(wstrFilename);
							break;
						}
					}
				}
			}
		}
	}
	for (std::set<std::wstring>::iterator it=setString.begin();it!=setString.end();it++)
	{
		m_ComboBoxSet.AddItem(it->c_str());
	}
	return true;
}
开发者ID:50059021,项目名称:wodegongjubao,代码行数:58,代码来源:DlgModelPlayer.cpp


示例4: GuildInfo

//--------------------------------------------------------------------------------------//
//		Load Guild info
//--------------------------------------------------------------------------------------//
void CClientSession::SendLoadGuildInfo(CNtlPacket * pPacket, CChatServer * app)
{

	app->db->prepare("CALL GuildInfo (?, @guild_id,@guild_name,@guild_master,@guild_notice,@guild_rep,@second_guild_master)");
	app->db->setInt(1, this->GetCharacterId());
	app->db->execute();

	app->db->execute("SELECT @guild_id,@guild_name,@guild_master,@guild_notice,@guild_rep,@second_guild_master");
	app->db->fetch();

//Check if user inside guild
	if(app->db->getInt("@guild_id") != 0)
	{
	//SET GUILD INFO
		CNtlPacket packet(sizeof(sTU_GUILD_INFO));
		sTU_GUILD_INFO * res = (sTU_GUILD_INFO *)packet.GetPacketData();

		int guildID = app->db->getInt("@guild_id");
		this->guildName = app->db->getString("@guild_name");

		res->wOpCode = TU_GUILD_INFO;
		res->guildInfo.dwGuildReputation = app->db->getInt("@guild_rep");
		res->guildInfo.guildId = guildID;
		res->guildInfo.guildMaster = app->db->getInt("@guild_master");
		res->guildInfo.guildSecondMaster[0] = app->db->getInt("@second_guild_master");
		wcscpy_s(res->guildInfo.wszName, NTL_MAX_SIZE_GUILD_NAME_IN_UNICODE, s2ws(app->db->getString("@guild_name")).c_str());
		wcscpy_s(res->guildInfo.awchName, NTL_MAX_SIZE_CHAR_NAME_UNICODE, s2ws(this->GetCharName()).c_str());
		wcscpy_s(res->guildInfo.awchNotice, NTL_MAX_LENGTH_OF_GUILD_NOTICE_UNICODE, s2ws(app->db->getString("@guild_notice")).c_str());
		packet.SetPacketLen( sizeof(sTU_GUILD_INFO));
		int rc = g_pApp->Send( this->GetHandle(), &packet);
		printf("Guild ID: %i \n",guildID);

	//SET GUILD MEMBERS
		CNtlPacket packet2(sizeof(sTU_GUILD_MEMBER_INFO));
		sTU_GUILD_MEMBER_INFO * res2 = (sTU_GUILD_MEMBER_INFO *)packet2.GetPacketData();

		app->db->prepare("SELECT CharID,CharName,Level,Race,Class FROM characters WHERE GuildID = ?");
		app->db->setInt(1, guildID);
		app->db->execute();

		while(app->db->fetch())
		{
			res2->wOpCode = TU_GUILD_MEMBER_INFO;
			res2->guildMemberInfo.bIsOnline = true;
			res2->guildMemberInfo.byClass = app->db->getInt("Class");
			res2->guildMemberInfo.byLevel = app->db->getInt("Level");
			res2->guildMemberInfo.byRace = app->db->getInt("Race");
			res2->guildMemberInfo.charId = app->db->getInt("CharID");
			res2->guildMemberInfo.dwReputation = 0;
			wcscpy_s(res2->guildMemberInfo.wszMemberName, NTL_MAX_SIZE_CHAR_NAME_UNICODE, s2ws(app->db->getString("CharName")).c_str());

			packet2.SetPacketLen( sizeof(sTU_GUILD_MEMBER_INFO));
			rc = g_pApp->Send( this->GetHandle(), &packet2);
		}
	}

}
开发者ID:philipemassari,项目名称:AKCore-1,代码行数:60,代码来源:PacketChatServer.cpp


示例5: MessageBox

///////////////////////////////////////////////////////////
/// Warning Message Box
///////////////////////////////////////////////////////////
void MsgBox::Warning(std::string msg, std::string title) {
	if (msg.length() == 0) return;
	if (msg.length() == 1 && (msg[0] == '\n' || msg[0] == '\r')) return;
#ifdef UNICODE
	MessageBox(0, s2ws(msg).c_str(), s2ws(title).c_str(), MB_OK | MB_ICONEXCLAMATION);
#else
	MessageBox(0, msg.c_str(), title.c_str(), MB_OK | MB_ICONEXCLAMATION);
#endif
}
开发者ID:cstrahan,项目名称:argss,代码行数:12,代码来源:msgbox.cpp


示例6: s2ws

void TransfersDialog::populateList()
{
    vector<Transfer*> &transfers = Transfer::getTransfers();
    ListBox1->Clear();
    for (auto it : transfers) {
        wxString var = s2ws(it->getVarName());
        wxString descr = s2ws(it->getDescription());
        wxString src = s2ws(it->getSourceNameAlt());
        wxString dest = s2ws(it->getDestNameAlt());
        ListBox1->Append(descr + _(" (") + var + _(") : ") + src + _(" to ") + dest);
    }
}
开发者ID:Obson,项目名称:SimX,代码行数:12,代码来源:TransfersDialog.cpp


示例7: FindFirstFile

bool ZipResourceDepot::RegisterPackages(std::wstring basePackagePath)
{
	HANDLE fileHandle;
	WIN32_FIND_DATA findData;

	//Get first file
	std::wstring pathSpec = basePackagePath + L"*";
	fileHandle = FindFirstFile(pathSpec.c_str(), &findData);
	if (fileHandle != INVALID_HANDLE_VALUE)
	{
		//Loop on all remaining entries
		while (FindNextFile(fileHandle, &findData))
		{
			//Skip if file is hidden
			if (findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
			{
				continue;
			}

			//Do not currently support packages within directories, so throw Warning
			if (findData.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY)
			{
				//Do not warn for directory symbol
				if (findData.cFileName != s2ws(".."))
				{
					BE_WARNING("Packages within Directories are ignored");
				}
			}
			else
			{
				std::wstring filename = findData.cFileName;
				std::wstring lowerPackageName = filename;

				std::transform(lowerPackageName.begin(), lowerPackageName.end(), lowerPackageName.begin(), (int(*)(int))std::tolower);
				lowerPackageName = lowerPackageName.substr(0, lowerPackageName.find_last_of('.'));

				pathSpec = pathSpec.substr(0, pathSpec.find_last_of('/'));
				pathSpec = pathSpec + s2ws("/") + filename;

				//Add Package to mapping
				m_packageMap[ws2s(lowerPackageName)] = PackageMappingDetails(m_numPackages, ws2s(pathSpec));
				m_numPackages++;
			}
		}
	}

	FindClose(fileHandle);


	return true;
}
开发者ID:jel-massih,项目名称:BombastEngine,代码行数:51,代码来源:ResourceDepot.cpp


示例8: initSoundManifest

//Parse our array of values to get the initial mappings
void initSoundManifest()
{
	//ofstream oHash("hash3.txt");
	for(u32 i = 0; i < NUM_MAPPINGS; i++)
	{
		g_mSoundIDToString[g_soundMap[i].id] = s2ws(g_soundMap[i].name);
		g_mStringToSoundID[s2ws(g_soundMap[i].name)] = g_soundMap[i].id;
		//oHash << "id: " << g_soundMap[i].id << ", filename: " << g_soundMap[i].name << ", filename hashed: " << hash(g_soundMap[i].name) << endl;
		//if(g_soundMap[i].id != hash(g_soundMap[i].name))
		//	oHash << "Hash failed." << endl;
		//else
		//	oHash << "Hash worked!" << endl;
	}
}
开发者ID:Haapavuo,项目名称:liTools,代码行数:15,代码来源:sndmanifest.cpp


示例9: remove

BOOL CCBitmapConvert::TranstToBMP(string srcPath,string destPath)
{
	remove(destPath.c_str());
	WCHAR wCH[255] = {0};
	WCHAR wCH1[255] = {0};
	wstring wstrPath = s2ws(srcPath);
	wcscpy(wCH,wstrPath.c_str());
	Image img(wCH);//这里的图片可以是其它格式	
	CLSID pngClsid;
	GetImageCLSID(L"image/bmp", &pngClsid);//这里的图片可以是其它格式,此处转化为BMP格式
	wstrPath = s2ws(destPath);
	wcscpy(wCH1, wstrPath.c_str());
	img.Save(wCH1, &pngClsid, NULL);
	return TRUE;
}
开发者ID:wyrover,项目名称:myhistoryprojects,代码行数:15,代码来源:CBitmapConvert.cpp


示例10: s2ws

int CellmlModelDefinition::loadModelFromString(const std::string &ms)
{
    std::cout << "Creating CellML Model Definition from the given model string"
              << std::endl;
    mUrl = "";
    std::wstring msW = s2ws(ms);
    ObjRef<iface::cellml_api::CellMLBootstrap> cb = CreateCellMLBootstrap();
    ObjRef<iface::cellml_api::DOMModelLoader> ml = cb->modelLoader();
    int code;
    try
    {
        ObjRef<iface::cellml_api::Model> model = ml->createFromText(msW);
        model->fullyInstantiateImports();
        // we have a model, so we can start grabbing hold of the CellML API objects
        mCapi = new CellmlApiObjects();
        mCapi->model = model;
        code = instantiateCellmlApiObjects();
    }
    catch (...)
    {
      std::wcerr << L"Error loading model from string." << std::endl;
      return -1;
    }
    return code;
}
开发者ID:nickerso,项目名称:csim,代码行数:25,代码来源:cellml_model_definition.cpp


示例11: pStg

void OIBReader::ReadSequenceOib()
{
   for (int i=0; i<(int)m_oib_info.size(); i++)
   {
      wstring path_name = m_oib_info[i].filename;

      if (path_name == m_path_name)
         m_cur_time = i;
	  
	   //storage
	   POLE::Storage pStg("temp_storage.txt"); 
	   //open
	   if (pStg.open()) {
		  //enumerate
		  std::list<std::string> entries = 
			  pStg.entries();
		  for(std::list<std::string>::iterator it = entries.begin();
			  it != entries.end(); ++it) {
                  m_oib_t = i;
			  if (!pStg.isDirectory(*it)) {
				  std::wstring st = s2ws(*it);
				  ReadStream(pStg,st);
			  }
		  }
	   }
	   //release
	   pStg.close();
   }
}
开发者ID:jefferis,项目名称:fluorender,代码行数:29,代码来源:oib_reader.cpp


示例12: s2ws

std::vector<std::string>* DataInDirectoryInvestigator::SearchFiles(std::string fileType){
	this->fileType = fileType;

	std::string searchQuery = dirPath;
	searchQuery.append(fileType);
	
	std::wstring stemp = s2ws(searchQuery);
	LPCWSTR DIRPATH = stemp.c_str();
	
	std::cout << "Searching Files in " << dirPath << std::endl;
	std::vector<std::string> * acquiredFilePaths = new std::vector<std::string>();

	HANDLE hFind;
	WIN32_FIND_DATA w32fd;
	hFind = FindFirstFile(DIRPATH, &w32fd);
	if( hFind != INVALID_HANDLE_VALUE){
		do {
			//std::cout << "cAlternateFileName : " << ws2s(w32fd.cAlternateFileName) << std::endl;
			//printf("ファイル名:%S\n", w32fd.cFileName);
			std::cout << "ファイル名: " << ws2s(w32fd.cFileName) << std::endl;
			acquiredFilePaths->push_back(ws2s(w32fd.cFileName));
		} while (FindNextFile (hFind, &w32fd));
		FindClose(hFind);
	}
	return acquiredFilePaths;
}
开发者ID:RozKen,项目名称:SATest,代码行数:26,代码来源:DataInDirectoryInvestigator.cpp


示例13: D3DReflect

//-----------------------------------------------------------------------------
bool CPUTShaderDX11::ShaderRequiresPerModelPayload( CPUTConfigBlock &properties )
{
    ID3D11ShaderReflection *pReflector = NULL;

    D3DReflect( mpBlob->GetBufferPointer(), mpBlob->GetBufferSize(), IID_ID3D11ShaderReflection, (void**)&pReflector);
    // Walk through the shader input bind descriptors.
    // If any of them begin with '@', then we need a unique material per model (i.e., we need to clone the material).
    int ii=0;
    D3D11_SHADER_INPUT_BIND_DESC desc;
    HRESULT hr = pReflector->GetResourceBindingDesc( ii++, &desc );
    while( SUCCEEDED(hr) )
    {
        cString tagName = s2ws(desc.Name);
        CPUTConfigEntry *pValue = properties.GetValueByName(tagName);
        if( !pValue->IsValid() )
        {
            // We didn't find our property in the file.  Is it in the global config block?
            pValue = CPUTMaterial::mGlobalProperties.GetValueByName(tagName);
        }
        cString boundName = pValue->ValueAsString();
        if( (boundName.length() > 0) && ((boundName[0] == '@') || (boundName[0] == '#')) )
        {
            return true;
        }
        hr = pReflector->GetResourceBindingDesc( ii++, &desc );
    }
    return false;
}
开发者ID:yumingsam,项目名称:OcclusionCulling,代码行数:29,代码来源:CPUTShaderDX11.cpp


示例14: dlopen

void *LibLoader::loadFromPath(const std::string & p)
{
	
	std::cout << "loading lib: " << p << std::endl;
#ifdef __unix
	void *lib;
	lib = dlopen(p.c_str(), RTLD_LAZY);
#elif _WIN32
	#ifdef UNICODE
	std::wstring stemp = s2ws(p);
	HINSTANCE lib = LoadLibrary(stemp.c_str());
	#else
	HINSTANCE lib = LoadLibrary(p.c_str());
	#endif
#endif
	if (!lib)
	{
		char *error;
		#ifdef __unix
		if ((error = dlerror()))
		#else
		if (!lib)
			error = "Cannot open the lib";
		#endif
			throw(MyException(error));
	}
	_libs[lib] = p;
	return lib;
}
开发者ID:MartinLestas,项目名称:Epitech_project,代码行数:29,代码来源:LibLoader.cpp


示例15: UpdateGuildNotice

//--------------------------------------------------------------------------------------//
//		Change guild notice
//--------------------------------------------------------------------------------------//
void CClientSession::SendGuildChangeNotice(CNtlPacket * pPacket, CChatServer * app)
{
	sUT_GUILD_CHANGE_NOTICE_REQ * req = (sUT_GUILD_CHANGE_NOTICE_REQ *)pPacket->GetPacketData();

	app->db->prepare("CALL UpdateGuildNotice (?,?, @wResultCode)");
	app->db->setInt(1, this->GetCharacterId());
	app->db->setString(2, Ntl_WC2MB(req->awchNotice));
	app->db->execute();

	app->db->execute("SELECT @wResultCode");
	app->db->fetch();

	CNtlPacket packet(sizeof(sTU_GUILD_CHANGE_NOTICE_RES));
	sTU_GUILD_CHANGE_NOTICE_RES * res = (sTU_GUILD_CHANGE_NOTICE_RES *)packet.GetPacketData();
	res->wOpCode = TU_GUILD_CHANGE_NOTICE_RES;
	res->wResultCode = app->db->getInt("@wResultCode");
	packet.SetPacketLen( sizeof(sTU_GUILD_CHANGE_NOTICE_RES));
	int rc = g_pApp->Send( this->GetHandle(), &packet);

	if(app->db->getInt("@wResultCode") == 300)
	{
		CNtlPacket packet2(sizeof(sTU_GUILD_CHANGE_NOTICE_NFY));
		sTU_GUILD_CHANGE_NOTICE_NFY * res2 = (sTU_GUILD_CHANGE_NOTICE_NFY *)packet2.GetPacketData();
		res2->wOpCode = TU_GUILD_CHANGE_NOTICE_NFY;
		wcscpy_s(res2->awchCharName, NTL_MAX_SIZE_CHAR_NAME_UNICODE, s2ws(this->GetCharName()).c_str());
		memcpy(res2->awchNotice, req->awchNotice, sizeof(wchar_t)* NTL_MAX_LENGTH_OF_GUILD_NOTICE_UNICODE);
		res2->wNoticeLengthInUnicode = req->wNoticeLengthInUnicode;
		//app->UserBroadcastothers(&packet2, this); // CHANGE THAT IT ONLY BROADCAST TO OTHER GUILD MEMBERS
		packet2.SetPacketLen( sizeof(sTU_GUILD_CHANGE_NOTICE_NFY));
		rc = g_pApp->Send( this->GetHandle(), &packet2);
	}
	
}
开发者ID:philipemassari,项目名称:AKCore-1,代码行数:36,代码来源:PacketChatServer.cpp


示例16: CreateFileMapping

bool
MMTT_SharedMem::createSharedMem()
{
    if (myMapping)
		return true;

#ifdef WIN32 
    myMapping = CreateFileMapping(INVALID_HANDLE_VALUE, 
		    						  NULL,
		    						  PAGE_READWRITE,
								  0,
								  mySize,
								  s2ws(myName).c_str());

    if (GetLastError() == ERROR_ALREADY_EXISTS)
    {
		detach();
		return false;
    }
#else
    assert(false);
#endif 

    if (myMapping)
		return true;
    else
		return false;
}
开发者ID:nosuchtim,项目名称:MultiMultiTouchTouch,代码行数:28,代码来源:mmtt_sharedmem.cpp


示例17: main

int main(int argc, char* argv[])
{
    //Parse de parameters. Similar way to acapelaCmd
    std::string voice = "iCub_eng";
    if (argc>1)
        voice = argv[1];
    std::cout << "Voice is: " << voice << std::endl;
    std::cout << "TODO : select the right token from this option." << voice << std::endl;

    std::string textInput;
    std::getline(std::cin, textInput);
    std::cout << "Text is: " << textInput << std::endl;

    if (::CoInitializeEx(NULL, COINIT_MULTITHREADED) == S_OK)
    {
        HRESULT hr = S_OK;
        CComPtr<IEnumSpObjectTokens> cpIEnum;
        CComPtr<ISpObjectToken> cpToken;
        CComPtr<ISpVoice> cpVoice;

        // Enumerate voice tokens that speak US English in a female voice.
        hr = SpEnumTokens(SPCAT_VOICES, L"Language=409", L"Gender=Female;", &cpIEnum);

        // Get the best matching token.
        if (SUCCEEDED(hr))
        {
            hr = cpIEnum->Next(1, &cpToken , NULL);
        }

        // Create a voice and set its token to the one we just found.
        if (SUCCEEDED(hr))
        {
            hr = cpVoice.CoCreateInstance(CLSID_SpVoice);
        }

        // Set the voice.
        if (SUCCEEDED(hr))
        {
            hr = cpVoice->SetVoice(cpToken);
        }

        // Set the output to the default audio device.
        if (SUCCEEDED(hr))
        {
            hr = cpVoice->SetOutput(NULL, TRUE);
        }

        // Speak a string directly.
        if (SUCCEEDED(hr))
        {
            hr = cpVoice->Speak(s2ws(textInput).c_str(), NULL, NULL);
        }
    }
    ::CoUninitialize();

    return 0;
}
开发者ID:jypuigbo,项目名称:speech,代码行数:57,代码来源:main.cpp


示例18: CreateMutex

MMTT_Mutex::MMTT_Mutex(const char *name)
{
#ifdef WIN32
	myMutex = CreateMutex(NULL, FALSE, s2ws(name).c_str());
#else
	assert(false);
#endif

}
开发者ID:nosuchtim,项目名称:MultiMultiTouchTouch,代码行数:9,代码来源:mmtt_sharedmem.cpp


示例19: open_IO

	Maybe<Window> open_IO( Engine& engine, const WindowConfig& windowConfig )
	{
		std::wstring windowNameW = s2ws( "HP_FP::" + engine.name );
		Window window{ nullptr, windowNameW.c_str( ) };
		if ( isOnlyInstance_IO( window.name ) )
		{
			// window class details
			WNDCLASSEX windowClass = { 0 };
			windowClass.cbSize = sizeof( WNDCLASSEX );
			windowClass.style = CS_VREDRAW | CS_HREDRAW;
			windowClass.lpfnWndProc = &windowProc_IO;
			windowClass.cbClsExtra = 0;
			windowClass.cbWndExtra = 0;
			windowClass.hInstance = GetModuleHandle( nullptr );
			windowClass.hIcon = 0;
			windowClass.hIconSm = 0;
			windowClass.hCursor = 0;
			windowClass.hbrBackground = 0;
			windowClass.lpszMenuName = 0;
			windowClass.lpszClassName = window.name;
			// register the window
			if ( RegisterClassEx( &windowClass ) )
			{
				// find position and size
				HDC screenDC = GetDC( nullptr );
				unsigned left = ( GetDeviceCaps( screenDC, HORZRES ) - windowConfig.width ) / 2;
				unsigned top = ( GetDeviceCaps( screenDC, VERTRES ) - windowConfig.height ) / 2;
				unsigned width = windowConfig.width;
				unsigned height = windowConfig.height;
				ReleaseDC( nullptr, screenDC );
				// set the style of the window
				DWORD style = WS_VISIBLE;
				if ( windowConfig.windowStyle == WindowStyle::Window )
				{
					style |= WS_CAPTION | WS_MINIMIZEBOX | WS_THICKFRAME | WS_MAXIMIZEBOX | WS_SYSMENU;
					// adjust the window size with the borders etc.
					RECT rectangle = { 0, 0, windowConfig.width, windowConfig.height };
					AdjustWindowRect( &rectangle, style, false );
					width = rectangle.right - rectangle.left;
					height = rectangle.bottom - rectangle.top;
				}
				// create the window
				window.handle = CreateWindowEx( 0, window.name, window.name, style, left, top, width, height, GetDesktopWindow( ), nullptr, GetModuleHandle( nullptr ), &engine );
				if ( window.handle == nullptr )
				{
					ERR( GetLastError( ) );
					return nothing<Window>( );
				}
				if ( windowConfig.windowStyle == WindowStyle::Fullscreen )
				{
					switchToFullscreen_IO( window.handle, windowConfig );
				}
			}
		}
		return just( std::move( window ) );
	}
开发者ID:maseek,项目名称:HP,代码行数:56,代码来源:window.cpp


示例20: WriteDebugLog

void WriteDebugLog(DWORD dwLastError, LPCSTR file, int codeLine, LOG_LEVEL level, LPCTSTR content, ...)
{
	//格式化日志
	TCHAR logContent[ODS_LOG_MAXLENGTH + 1] = {0};

	DWORD dwThreadID = ::GetCurrentThreadId();
	std::string ansiCodefile = file;
	std::string::size_type pos = ansiCodefile.find_last_of('\\');
	if (pos != std::string::npos && pos + 1 < ansiCodefile.size()) ansiCodefile = ansiCodefile.substr(pos + 1);
	tstring codeFile = s2ws(ansiCodefile);

	tstring strLevel;
	switch (level)
	{
	case ODSLEVEL_DEBUG:
		strLevel = _T("debug");
		break;
	case ODSLEVEL_INFO:
		strLevel = _T("info");
		break;
	case ODSLEVEL_ERROR:
		strLevel = _T("error");
		break;
	default:
		strLevel = _T("unknown");
		break;
	}

	int iWritten = _stprintf_s(logContent, _T("%s [%s:%d] %u "), strLevel.c_str(), codeFile.c_str(), codeLine, dwThreadID);

	va_list ap;
	va_start(ap, content);
	_vsntprintf_s(logContent + iWritten, ODS_LOG_MAXLENGTH - iWritten, _TRUNCATE, content, ap);
	va_end(ap);

	if (dwLastError != 0)
	{
		TCHAR lastError[16] = {0};
		_stprintf_s(lastError, 15, _T(" E%u"), dwLastError);
		
		size_t len = _tcslen(logContent);
		if (len + _tcslen(lastError) < ODS_LOG_MAXLENGTH)
		{
			_tcscat_s(logContent, lastError);
		}
	}

// 	//写入日志
// #ifdef ODS_OUTPUT_STD
	printf("%s\n", t2a(logContent));
// #endif
#ifdef ODS_OUTPUT_FILE
 	OutputFile(logContent);
#endif
	OutputDebugString(logContent);
}
开发者ID:a3587556,项目名称:trochilus,代码行数:56,代码来源:ods.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ s3函数代码示例发布时间:2022-05-30
下一篇:
C++ s2i函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap