Ecere SDK/eC Forums http://ec-lang.org/community/ Print view |
|
[Solved]How to use windowsShortcut.ec? http://ec-lang.org/community/viewtopic.php?f=13&t=160 |
Page 1 of 1 |
Author: | samsam598 [ Mon Aug 22, 2011 4:51 am ] |
Post subject: | [Solved]How to use windowsShortcut.ec? |
I want to create a shortcut for my ecere program.Given below code: Code: Select all
Code: Select all
Edited on Sep 16,2011.Updated full source: Code: Select all
|
Author: | jerome [ Mon Aug 22, 2011 7:42 am ] |
Post subject: | Re: How to use windowsShortcut.ec? |
1. You need to add windowsShortcuts.ec to your project (right click project node, Add file to project or select project node and 'Enter') import works 2 ways: - It imports an eC shared library (e.g. ecere.dll) - It imports another eC file within your project (works through the '.sym' files) First it will look for a dll, if it can't find any it will look for a .sym files (which get generated by the files within your project). See page 93-97 in the Tao for more info. 2. import "windowsShortcut" is right 3. You have a typo: Modifier instead of Modifiers 4. You will need to add uuid and ole32 to your Project Settings / Linking / Additional Libraries for the application to link |
Author: | samsam598 [ Mon Aug 22, 2011 7:29 pm ] |
Post subject: | Re: How to use windowsShortcut.ec? |
Thanks Jerome,it compiles! But sorry for my stupid.The CreateLink params seems wrong(I mean I have no idea how to set the right params) since I did not create a shortcut after the program is running. |
Author: | jerome [ Mon Aug 22, 2011 9:14 pm ] |
Post subject: | Re: How to use windowsShortcut.ec? |
Hi Sam, I've tried your code, and it does work. It creates a shortcut to program.exe, in the current directory. Also note that this function expects UTF-8 parameters (It will converts to Windows' UTF-16 encoding). The extension for shortcut however should be '.lnk', and if you want the text to be displayed you should name your shortcut that way, e.g. 'this is a shortcut for program.exe.lnk'. For the last parameter you can just pass null, it only goes in the 'comment' (which you can check if you hit alt-enter on the shortcut to bring up the properties dialog). This is used e.g. by the installer to fill up the Start Menu, e.g.: Code: Select all
Cheers, Jerome |
Author: | samsam598 [ Mon Aug 22, 2011 9:31 pm ] |
Post subject: | Re: How to use windowsShortcut.ec? |
Hi Jerome, Thanks.It is perfect. BWT,I noticed you used String instead of char* in the snippet,what's a String,what can it do?I want to learn more.Thanks. Also I know there is a FileDialog which allow us to pick a file from a dialog window.Is there also a DirectoryDialog to allow select a folder?Thanks. Regards, Sam |
Author: | jerome [ Mon Aug 22, 2011 9:59 pm ] |
Post subject: | Re: How to use windowsShortcut.ec? |
At the moment, String and char * are interchangeable and represent the same data type. In the future, we hope to have a more evolved String data type that makes life easier for eC programmers. (Right now, all we have are a bunch of convenience functions, like CopyString, and operators like new/delete to help us with the complexity of C strings). For example, see this thread for a lot more info about strings in eC. The DirectoryDialog is a FileDialog with the 'type' member set to 'selectDir' Code: Select all
Code: Select all
|
Author: | samsam598 [ Fri Sep 16, 2011 2:25 am ] |
Post subject: | Re: [Solved]How to use windowsShortcut.ec? |
Updated the full source at the begining of the post. |
All times are UTC-05:00 | Page 1 of 1 |
Powered by phpBB® Forum Software © phpBB Limited |