-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|442|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Showcase Home -> Functions Libraries

Created : 01 July 2008
Edited : 12 September 2017
System : Windows
Language : Cobra

Shortcut Reader/Writer for BlitzBasic and Cobra

For Cobra (+Blitz!): custom icons, comment/tooltips, shortcuts with command line arguments, it's all in there!

ReadMe (Cobra)
Download (Cobra)
New: Now also works with BlitzBasic!

I finally cracked it and can now write valid shortcuts! (23 hours well spent!)

Presenting a simple yet complete unit to read/write windows .lnk shortcut files from Cobra - Including custom icons, comment/tooltips, shortcuts with command line arguments, etc

I haven't tested network shortcuts, but reading them should also work *in theory*.






Tuesday, 01 July 2008, 14:47
Holy cow!
Well done Hobo!

(although untested due to my lack of Cobra!)
Tuesday, 01 July 2008, 15:08
Orion Pax
WOW! Finally! I completely forgot about this. I might have to look at the code to see the format for it. Might have a need for it in blitz. Unless you plan on doing a port in blitz.
Tuesday, 01 July 2008, 15:37
I don't plan on doing my own port (no time!), but it should be quite easy - the bulk of it is just the Read/Write Byte/Word/Integer commands. In Cobra, Word = 2 Bytes, Int = 4 Bytes. I tried to make my comments pretty detailed, too. (If there's any parts that are confusing, feel free to ask)

There's a good PDF that documents most of this info (the link is in the source-code comments), but there were a few omissions that made writing the shortcut difficult - the most important of which were two single undocumented bits hidden away in the flag bytes, which I've marked as "REALLY IMPORTANT!!!" in the comments
Friday, 30 January 2009, 07:19
Blitz port now available!

Seems to work okay - any bugs, give a yell.

(Also, Blitz SUCKS for strings... had to go through and make sure I had a dollar sign on everything that needed it... annoying!)
Friday, 30 January 2009, 07:45
Yeah. Blitz's lack of backslash expressions is slightly limiting, but for the most part, it does what it needs to.

Well done on the Shortcut making!
Wonder if it still works on Vista + 7 ? (I'll try it on Vista, later, if I remember!!)
Friday, 30 January 2009, 07:53
Works over here on Windows 7, at least when reading. Don't know if it's because of the OS, but it crashes when trying to create a shortcut.
Friday, 30 January 2009, 09:11
I did forget to mention, but there should be a file called test.txt in the same directory as the blitz example for it to create a shortcut to. It's supposed to just return false if it doesn't exist though.

If that's not it, then I've got no idea why it fails; it's just writing data to a binary file. I could understand windows not being able to read the result, but not blitz crashing.
Friday, 30 January 2009, 10:23
Perhaps windows is trying to access the file mid-write. You might have to lock the file down, until it's written.
(Not a f'ing clue!)
Friday, 30 January 2009, 12:18
Crash might be the wrong word, I merely got an error dialog box. However the test file was present when I got the error.