Code: Select all
import "ecere"
import "windowsShortcut"//import "my/path/to/ecere/extra/windowsShortcut" ->the same
...
Button myButton
{
...
bool NotifyClicked(Button button,int x,int y,Modifier mods)
{
CreateLink("program.exe","myShortcut.ext","this is a shortcut for program.exe");
}
}
Code: Select all
form1.ec
form1.ec:3:1: error: Couldn't open obj/release.win32\windowsShortcut.sym
form1.ec:3:1: error: Couldn't open obj/release.win32\windowsShortcut.sym
Edited on Sep 16,2011.Updated full source:
Code: Select all
//app name:shortcutapp
import "ecere"
import "windowsShortcut"
class Form1 : Window
{
text = "快捷方式";
background = activeBorder;
borderStyle = fixed;
hasMaximize = true;
hasMinimize = true;
hasClose = true;
size = { 200, 80 };
anchor = { horz = -239, vert = -181 };
nativeDecorations = true;
Button btnShortcut
{
this, text = "(S)创建快捷方式", altS, size = { 146, 21 }, position = { 24, 16 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
String program = "C:\\person\\ecere\\ex\\shortcutapp\\obj\\release.win32\\shortcutapp.exe";
String dir = "C:\\Users\\shu\\Desktop";
char file[MAX_LOCATION];strcpy(file, dir);
PathCat(file, "shortcutapp.exe.lnk");
//MakeDir(dir); // Ensure the Start Menu folder is created
CreateLink(program, file, null);
MessageBox{text="快捷方式",contents="已在桌面上创建本程序的快捷方式。"}.Modal();
return true;
}
};
}
Form1 form1 {};