Hello,
how can i create Links in Windows?
And more special: how can i create enties in the Windows start-menu?
I need that to make a setup program.
Is it possible to put icons into fpc programs?
What do i need for that?

Mailing lists / fpc-pascal / 2001-10
16 messages · 8 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hello,
how can i create Links in Windows?
And more special: how can i create enties in the Windows start-menu?
I need that to make a setup program.
Is it possible to put icons into fpc programs?
What do i need for that?
"Andreas K. Foerster" wroteHello, how can i create Links in Windows?
you have to use the shell object library for this (shlobj unit in Delphi, but it seems that FPC doesn't have a translation of the according Platform SDK header file,s shlobj.h, yet?) This involves interfaces (IShellLink etc.), so you would have to use FPC 1.1
And more special: how can i create enties in the Windows start-menu?
Get the path (or pathes) to the 'Start menu' directory using SHGetSpecialFolderLocation or SHGetSpecialFolderPath (both functions are part of shlobj as well) and create the appropiate file links in them.
- Sebastian
how can i create Links in Windows? And more special: how can i create enties in the…
how can i create Links in Windows?
Easiest way is via M$'s shortcut.exe. IIRC the Jedi JCL has a real routine for that.
And more special: how can i create enties in the Windows start-menu?
One can directly create them as shortcuts and dirs under windows/start menu/programs/ and below.
However I would spend some extra time, and try to create them according to profiles. (so that you make them in the right directory on NT/2000 and w9x with profiles)
I need that to make a setup program. Is it possible to put icons into fpc programs?
Yes
What do i need for that?
windres.exe, it is in the manual somewhere IRC. Just grep the HTML files for ICON or so :)
how can i create Links in Windows? And more special: how can i create enties in the…
At 10/15/01 06:42 PM, you wrote:
Andreas,
how can i create Links in Windows? And more special: how can i create enties in the Windows start-menu?
It depends on the version of Windows as well. Basically, the Start Menu is a directory somewhere. .LNK files inside this directory will appear as items on the menu, directories as submenus. You can query the Start Menu directory using SHGetSpecialFolderPath but you have to be careful because on NT there are two such directories, one for the current user and one for all users. On 9x, there is only one such directory but it you use the same without thinking on NT, the entry will go into the current user part of the Start Menu and this might not be what the user wants. You have to provide a way for them to select which part they want to put the menu item into (and this selection, of course, will have to be grayed out if your setup program runs on 9x). A very common mistake made by people developing on 9x, I should say...
The same procedure applies if you want to put an icon onto the desktop as well.
To create the actual links, you have to use a couple of COM interfaces but it's not that complicated. I have source code for all this in C which can be converted relatively easily to FPC. You *don't* have to use the 1.1 version of the compiler to use these COM interfaces, it requires a couple of lines more and may be slightly less elegant but it works, I do COM/OLE quite often that way.
Is it possible to put icons into fpc programs? What do i need for that?
You probably use dialogs and menus in your programs, the icon goes into the same resource file. You can reference your .ICO file here (which you can create
with a large number of icon editors available from the web):
#define IDAPPLICON 710
IDAPPLICON ICON Program.ico
In your program you simply register it where you register your window class:
...
wc.lpszClassName := 'tramfontWndClass';
wc.lpszMenuName := MAKEINTRESOURCE(IDMAINMENU);
wc.hCursor := LoadCursor (0, IDC_ARROW);
wc.hIcon := LoadIcon (0, MAKEINTRESOURCE(IDAPPLICON));
RegisterClass (wc);Regards,
Gabor DEAK JAHN
------------------------------------------------------------------- Gabor DEAK JAHN -- Budapest, Hungary.
WWW: www.tramontana.co.hu
E-mail:
Easiest way is via M$'s shortcut.exe. IIRC the Jedi JCL has a real routine for that. One…
Marco van de Voort wrote> how can i create Links in Windows? Easiest way is via M$'s shortcut.exe.
Errm, pitty.
Is it freeware? :*)
IIRC the Jedi JCL has a real routine for that.
Is that already available for FreePascal?
> Is it possible to put icons into fpc programs? windres.exe, it is in the manual somewhere IRC. Just grep the HTML files for ICON or so :)
Okay, now I found that in the programmers guide, chapter 12.
I experimented with it, but I couldn't get it going first. Then I found the solution:
It just works when you set {$APPTYPE GUI}
This has only one litlle disadvantage:
my program doesn't run anymore, but who cares. :-\ Okay, I forget it.
Thanks for your help.
It is in the resourcekits. Don't know if those are free.
> IIRC the Jedi JCL has a real routine for that. Is that already available for FreePascal?
Yes/No. No it isn't in its entirity, but large parts compile with some effort.
Hmm..... That seems to be a common limitation. If I look in my win2000 windows directory, the console programs don't have icons too.
At 10/17/01 08:57 AM, you wrote:
Marco,
I sent the routines, converted from my C sources, to Andreas. It is a standalone program relying only on the Windows and String units, capable of creating a shortcut in the Start Menu or on the desktop. It compiles and runs with pre-1.1 versions, too, without the new, emerging interface support. 10,301 bytes long. If somebody else is interested, too, I could post it here.
Regards,
Gabor DEAK JAHN
------------------------------------------------------------------- Gabor DEAK JAHN -- Budapest, Hungary.
WWW: www.tramontana.co.hu
E-mail:
Gabor DEAK JAHN wroteI sent the routines, converted from my C sources, to Andreas. It is a standalone program relying only on the Windows and String units, capable of creating a shortcut in the Start Menu or on the desktop.
Tested okay with FPC 1.0.4 under Win95.
Seems to be really usefull.
10,301 bytes long. If somebody else is interested, too, I could post it here.
If your source can be used legaly, you could make a Unit and a demo program of it and release it under
<http://www.freepascal.org/units.html>.
Hi,
I'm interested in how to create the shortcut, can you please post your source here?
Regards, Pavel Kanzelsberger
It's free for any use, of course, could be added to the contributed units as well. Do I…
If you don't have webspace for it, I can add it and put the source on the FTP server. If you do have webspace, please do it yourself.
Michael.
how can i create Links in Windows? And more special: how can i create enties in the…
what is the most efficient way to parse a space-delimited fixed width text file to an integer array?
also, i am rather new to freepascal and i have just discovered the plethora of string functions spread about in different libraries (strings, sysutils, and the system unit). i would prefer to work with Strings, not PChar, because i am rather weak on working with pointers, but i have written some functions that basically make PChar functions into String functions for simplicity. (and what is an AnsiString?)
some functions i am looking for are:
1) strip duplicate delimiters, (can be used to remove extra spaces [#32] also)
2) parse delimited string to array
3) translate a table of characters in string to another table
4) ...
is there a library that perhaps has a lot of this done already outside the standard freepascal libraries? for simplicity's sake, i'd prefer to just work with a single type, hopefully Strings, but i can learn to use PChar if it is in my favor.
I'm interested in how to create the shortcut, can you please post your source here?…
At 10/18/01 10:09 AM, you wrote:
Pavel,
I'm interested in how to create the shortcut, can you please post your source here?
It's free for any use, of course, could be added to the contributed units as well. Do I have to add it myself or the FPC site admin will do that?
Regards,
Gabor DEAK JAHN
------------------------------------------------------------------- Gabor DEAK JAHN -- Budapest, Hungary.
WWW: www.tramontana.co.hu
E-mail:
If you don't have webspace for it, I can add it and put the source on the FTP server. If…
At 10/18/01 07:56 PM, you wrote:
Michael,
If you don't have webspace for it, I can add it and put the source on the FTP server. If you do have webspace, please do it yourself.
I have plenty of room (and the whole thing is hardly 10 kbyte) but I don't host any source files, so nobody would find it...
Regards,
Gabor DEAK JAHN
------------------------------------------------------------------- Gabor DEAK JAHN -- Budapest, Hungary.
WWW: www.tramontana.co.hu
E-mail:
It's free for any use, of course, could be added to the contributed units as well. Do I…
Gabor DEAK JAHN wroteunit Shell;
Perhaps you should rather call that "Shortcuts".
what is the most efficient way to parse a space-delimited fixed width text file to an…
the reverend wrotewhat is the most efficient way to parse a space-delimited fixed width text file to an integer array?
Read line by line, copy width characters and convert to integer:
uses SysUtils;
Var
F : Text;
Line : String;
Number : Integer;
begin
// Assign file etc.
While not EOF(F) do
begin
Read(F,Line);
While Length(Line)>0 do
begin
// Change trim by TrimRight or TrimLeft if you know for sure the numbers
// Are left or right aligned. That is more efficient.
Number:=StrToInt(Trim(Copy(Line,1,Width)))
Delete(Line,1,Width);
// Store number somewhere.
end;
end;
end;SysUtils contains routines that work on AnsiStrings. Ansistrings are like normal pascal strings, but have unlimited length.
The SysUtils unit doesn't contain the specific calls you are looking for, but can be used to construct the routines you want.
Michael.
Perhaps you should rather call that "Shortcuts". Tschuess Andreas
At 10/19/01 08:14 AM, you wrote:
Andreas,
Perhaps you should rather call that "Shortcuts".
I didn't do so for a reason: there are quite a few other interfaces, types and constants which could be added (in C, they are located in various header files like shlobj.h, shlwapi.h, shlguid.h, shellapi.h, shfolder.h, etc.), making it a complete Shell support unit. There is much more functionality there than shortcuts: context menus, useful path manipulation functions, prepackaged registry operations (single functions calls wrapping the several steps required to read from or write to a registry key), and so on.
Regards,
Gabor DEAK JAHN
------------------------------------------------------------------- Gabor DEAK JAHN -- Budapest, Hungary.
WWW: www.tramontana.co.hu
E-mail: