How to launch a desktop shortcut for an application? lazarus / 34-Windows ---------------------------------------------------------------------- Awesome Programmer · 2022-03-23 06:14 hey, I would like to know how you can programmatically click on a desktop shortcut for an application like say notepad. I found a code that lets you create a desktop shortcut. I would like to know how you click on it or execute the shortcut. Thanks. ---------------------------------------------------------------------- dbannon · 2022-03-23 07:17 Maybe it would make more sense to run eg notepad directly ? https://wiki.freepascal.org/Executing_External_Programs Davo ---------------------------------------------------------------------- marcov · 2022-03-23 08:20 Execute over shellexecute() ---------------------------------------------------------------------- RayoGlauco · 2022-03-23 10:21 You can simulate a mouse clic as this example shows. But the previous answers are quite right. 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 uses JwaWinUser procedure MouseButtonDown(rightbutton: boolean);var  Input: TInput;begin  FillChar(Input, SizeOf(Input), 0);  Input.mi.mouseData := 0;  Input.mi.dx := 0;  Input.mi.dy := 0;  Input.type_ := INPUT_MOUSE;  if rightbutton then    Input.mi.dwFlags := MOUSEEVENTF_RIGHTDOWN  else    Input.mi.dwFlags := MOUSEEVENTF_LEFTDOWN;  SendInput(1, @Input, SizeOf(Input)); procedure MouseButtonUp(rightbutton: boolean);var  Input: TInput;begin  FillChar(Input, SizeOf(Input), 0);  Input.mi.mouseData := 0;  Input.mi.dx := 0;  Input.mi.dy := 0;  Input.type_ := INPUT_MOUSE;  if rightbutton then    Input.mi.dwFlags := MOUSEEVENTF_RIGHTUP  else    Input.mi.dwFlags := MOUSEEVENTF_LEFTUP;  SendInput(1, @Input, SizeOf(Input));end;         procedure SendMouseClick(rightbutton: boolean);begin  MouseButtonDown(rightbutton);  sleep(30);  MouseButtonUp(rightbutton);end;      end; ---------------------------------------------------------------------- Awesome Programmer · 2022-03-27 15:04 Well, I might not have been more clear with my post... I want my program to be able to execute a desktop shortcut knowing what the name of the shortcut is. I am not trying to run Notepad... that was just an example... I wrote a program that creates a shortcut for a program on the desktop and I want to execute or "run" that shortcut. Thank you all for the reply. ---------------------------------------------------------------------- RayoGlauco · 2022-03-27 21:21 Take a look on this topic: https://forum.lazarus.freepascal.org/index.php?topic=1709.0 ---------------------------------------------------------------------- Awesome Programmer · 2022-03-30 15:43 Quote from: RayoGlauco on March 27, 2022, 11:21:14 pmTake a look on this topic: https://forum.lazarus.freepascal.org/index.php?topic=1709.0 Thank you for your reply, but that question deals with creating a .ink shortcut. I already have a program that does. I want to be able to LAUNCH that .ink link I created from my program. How do you do that? ---------------------------------------------------------------------- AlexTP · 2022-03-30 15:50 Did you try this? https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf- shellapi-shellexecutea