Help with special characters and words with tildes lazarus / 21-General ---------------------------------------------------------------------- Ecsa · 2022-12-01 20:31 Hello friends, I am using the following code to change the wallpaper in Windows 11 and everything works perfectly as long as the image does not contain special characters such as the letters áéíóú or the letter ñ in its name. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var  s: string;begin   s := 'c:\windows\athena.bmp';   SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PChar(s), 0)end; As an example I have an image called "Móntaña.jpg" and when I use the procedure in the registry I check that it appears as follows HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper that is written as follows: "C:\Desktop\Móntaña.jpg" for which it places a black image and not the wallpaper because the name had the special character. It's the same when you want to execute a command from the console. I have the same problem, the texts with special characters don't work for me. Can someone help me? I've been having this problem for months and I can't solve it. Thanks in advance. ---------------------------------------------------------------------- PascalDragon · 2022-12-01 20:38 Try to use SystemParametersInfoW and pass the string as PWideChar. Or ensure that the string is converted from UTF-8 to your system's codepage. ---------------------------------------------------------------------- Ecsa · 2022-12-01 20:45 Excuse my ignorance, I made this change and it doesn't work for me  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PWideChar(s), 0) ---------------------------------------------------------------------- Bart · 2022-12-01 20:53 Try (untested): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var  s: string;  u: UnicodeString;begin  s := 'c:\windows\athena.bmp';  u := s; //implicit conversion, lossless in this case  //or simply directly do u := s := 'c:\windows\athena.bmp';   SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, PWChar(u), 0)end;  Bart ---------------------------------------------------------------------- KodeZwerg · 2022-12-01 20:56 If Barts code not work, my was tested. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  s: WideString;begin  s := 'Drive:\Path\Filenama.ext';  if SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, PWideChar(s), SPIF_SENDCHANGE) then    ShowMessage('Good')    else    ShowMessage('Error');end. ---------------------------------------------------------------------- Bart · 2022-12-01 20:57 Quote from: KodeZwerg on December 01, 2022, 09:56:10 pmIf Barts code not work, my was tested. And since yours works, so would mine  Bart ---------------------------------------------------------------------- Ecsa · 2022-12-01 21:08 None of the possible solutions have worked. ---------------------------------------------------------------------- KodeZwerg · 2022-12-01 21:31 Quote from: Ecsa on December 01, 2022, 10:08:12 pmNone of the possible solutions have worked. Very very strange.... As you can see on my attachment, I was using your filename with my logo. And BTW, "Wallpaper" inside of registry is not your actual wallpaper name for custom pictures so you might are mislead by thinking it. ---------------------------------------------------------------------- KodeZwerg · 2022-12-01 21:42 I attached my project, maybe you did a copy/paste error. ---------------------------------------------------------------------- Ecsa · 2022-12-02 14:25 Quote from: KodeZwerg on December 01, 2022, 10:42:05 pmI attached my project, maybe you did a copy/paste error. I just checked today and if now it works without problem, thank you very much. ---------------------------------------------------------------------- KodeZwerg · 2022-12-02 14:31 Quote from: Ecsa on December 02, 2022, 03:25:05 pmQuote from: KodeZwerg on December 01, 2022, 10:42:05 pmI attached my project, maybe you did a copy/paste error. I just checked today and if now it works without problem, thank you very much. I am glad that you made it finally.  (If possible, edit first post subject with a [solved] or something like that)