@@ -26,7 +26,7 @@ bool ShaderWindow::LoadProfile(const std::wstring& fileName)
26
26
27
27
std::string shaderCategory;
28
28
std::string shaderName;
29
- std::optional<std::string> windowName;
29
+ std::optional<std::wstring> windowName;
30
30
std::optional<std::string> desktopName;
31
31
std::optional<bool > transparent;
32
32
std::optional<bool > clone;
@@ -43,8 +43,10 @@ bool ShaderWindow::LoadProfile(const std::wstring& fileName)
43
43
return true ;
44
44
}
45
45
else if (key == " CaptureWindow" )
46
- {
47
- windowName = value;
46
+ {
47
+ wchar_t wideName[MAX_WINDOW_TITLE];
48
+ MultiByteToWideChar (CP_UTF8, 0 , value.c_str (), -1 , wideName, MAX_WINDOW_TITLE);
49
+ windowName = std::wstring (wideName);
48
50
}
49
51
else if (key == " CaptureDesktop" )
50
52
{
@@ -400,7 +402,12 @@ void ShaderWindow::SaveProfile(const std::wstring& fileName)
400
402
outfile << " InputArea \" " << std::to_string (m_captureOptions.inputArea .left ) << " " << std::to_string (m_captureOptions.inputArea .top ) << " "
401
403
<< std::to_string (m_captureOptions.inputArea .right ) << " " << std::to_string (m_captureOptions.inputArea .bottom ) << " \" " << std::endl;
402
404
if (m_captureOptions.captureWindow )
403
- outfile << " CaptureWindow " << std::quoted (GetWindowStringText (m_captureOptions.captureWindow )) << std::endl;
405
+ {
406
+ auto windowTitle = GetWindowStringText (m_captureOptions.captureWindow );
407
+ char utfName[MAX_WINDOW_TITLE];
408
+ WideCharToMultiByte (CP_UTF8, 0 , windowTitle.c_str (), -1 , utfName, MAX_WINDOW_TITLE, NULL , NULL );
409
+ outfile << " CaptureWindow " << std::quoted (utfName) << std::endl;
410
+ }
404
411
else if (m_captureOptions.monitor )
405
412
{
406
413
MONITORINFOEX info;
@@ -504,7 +511,7 @@ void ShaderWindow::ScanWindows()
504
511
UINT i = 0 ;
505
512
for (const auto & w : m_captureWindows)
506
513
{
507
- AppendMenu (m_windowMenu, MF_STRING, WM_CAPTURE_WINDOW (i++), convertCharArrayToLPCWSTR ( w.name .c_str () ));
514
+ AppendMenu (m_windowMenu, MF_STRING, WM_CAPTURE_WINDOW (i++), w.name .c_str ());
508
515
if (m_captureOptions.captureWindow == w.hwnd )
509
516
CheckMenuItem (m_windowMenu, WM_CAPTURE_WINDOW (i - 1 ), MF_CHECKED | MF_BYCOMMAND);
510
517
}
@@ -826,7 +833,7 @@ void ShaderWindow::UpdateTitle()
826
833
const auto & aspectRatio = aspectRatios.at (WM_ASPECT_RATIO (m_selectedAspectRatio));
827
834
const auto & shader = m_captureManager.Presets ().at (m_captureOptions.presetNo );
828
835
829
- char windowName[26 ];
836
+ wchar_t windowName[26 ];
830
837
windowName[0 ] = 0 ;
831
838
if (m_captureOptions.captureWindow )
832
839
{
@@ -839,22 +846,22 @@ void ShaderWindow::UpdateTitle()
839
846
}
840
847
if (captureTitle.size () > 20 )
841
848
{
842
- captureTitle = captureTitle.substr (0 , 20 ) + " ..." ;
849
+ captureTitle = captureTitle.substr (0 , 20 ) + _T ( " ..." ) ;
843
850
}
844
- captureTitle += " , " ;
845
- strncpy_s (windowName, captureTitle.c_str (), 26 );
851
+ captureTitle += _T ( " , " ) ;
852
+ wcsncpy_s (windowName, captureTitle.c_str (), 26 );
846
853
}
847
854
}
848
855
849
- char title[200 ];
856
+ wchar_t title[200 ];
850
857
const char * scaleString = m_captureOptions.freeScale ? " free" : outputScale.mnemonic ;
851
858
const auto fps = (int )roundf (m_captureManager.FPS ());
852
- snprintf (title, 200 , " ShaderGlass (%s%s , %spx , %s %%, ~%s , %dfps)" , windowName, shader->Name , pixelSize.mnemonic , scaleString, aspectRatio.mnemonic , fps);
853
- SetWindowTextA (m_mainWindow, title);
859
+ _snwprintf_s (title, 200 , _T ( " ShaderGlass (%s%S , %Spx , %S %%, ~%S , %dfps)" ) , windowName, shader->Name , pixelSize.mnemonic , scaleString, aspectRatio.mnemonic , fps);
860
+ SetWindowTextW (m_mainWindow, title);
854
861
}
855
862
else
856
863
{
857
- SetWindowTextA (m_mainWindow, " ShaderGlass (stopped)" );
864
+ SetWindowTextW (m_mainWindow, _T ( " ShaderGlass (stopped)" ) );
858
865
}
859
866
}
860
867
0 commit comments