News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

You'd think shortcut would be quick

Started by oex, January 17, 2010, 10:02:25 AM

Previous topic - Next topic

oex

I've checked around but cant find anything but COM IShellLink to safely create lnk shortcuts.... Is there not an api call? I have never done COM.... Maybe COM is more simple than it looks?
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

Vortex

Donkey's Lib Projects, Files.lib :
Quote
List of functions:
CreateLink, CreateLinkIndirect, CreateDesktopLink, CreateStartmenuLink, CreateSpecialFolderLink, ResolveLinkIndirect, ResolveLink, CheckFileName, RecurseFolder, InitCRC32Table, CRC32, FindNameInPath, GetCL, GetFileExists, ReadFileLines, GetFileInfo, TimeStamp2FileTime, FileTime2DateStamp, GetModulePath, RegisterFileExtension, StripFilename, IsShortcut, IsPEFile

http://www.quickersoft.com/donkey/libs.htm

oex

He's a star :wink.... Still looking for a non COM version if there is one
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

donkey

Quote from: oex on January 17, 2010, 10:20:52 AM
He's a star :wink.... Still looking for a non COM version if there is one

There is no non COM version in the API, shortcuts can only be manipulated through the IShellLink interface. You can attempt to write your own file handler but it would be a bit of work, I know I once tried then gave up an went with COM:

http://www.stdlib.com/art6-Shortcut-File-Format-lnk.html

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

oex

Hi Edgar,

Yeah I saw that link and considered it then decided windows versions would likely as not break my code with an evil grin....

I've been taking a look at your code, I'm assuming FRAME is PROC and understand that if I call invoke CoInitialize say at the begining of my app then call your code for "CreateLink" reworked to MASM syntax I should be fixed up

I'm moding it now, I like the theory of COM but dont like it in practice (probably because I have never properly been introduced to it).... Maybe this will change my mind should it work :bg
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

donkey

Hi oex,

If you translate it to MASM post it here so others can use it, you can also use the function directly from the lib as it is in a MASM compatible format.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

oex

Quote from: donkey on January 17, 2010, 11:32:52 AM
If you translate it to MASM post it here so others can use it

Yep for sure.... ugly structure patches atm, first time I've seen GoASM syntax should have it fixed up shortly

je >>A1
je >A1

There is important difference?

struct
db

lol it's all foreign to me :bg
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

oex

#7
It builds at least, off for a 6 mile walk will finish off in a couple hoursĀ  :bg
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

Vortex


oex

#9
OK guys this version should work ok with masm but I would appreciate a double check off someone I havent translated GoASM to Masm before or coded anything for COM

One thing I did notice was that a website link works but has wrong icon it appears an internet shortcut has extension .url and contents:
[InternetShortcut]
URL=http://www.masm32.com/
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

dedndave

shortcuts to web links (.URL files) are not the same as other shortcuts (.LNK)
they resemble a .INI file
the trick here is to get the icon to match the websites favicon (which may or may not be cached in temporary internet files)

this is a shortcut for google - i renamed it from .URL to .TXT and opened it with notepad

[DEFAULT]
BASEURL=http://www.google.com/
[InternetShortcut]
URL=http://www.google.com/
Modified=E0BFB7BD4033CA0151
IconFile=http://www.google.com/favicon.ico
IconIndex=1

all of the sections and values are not needed to make a working shortcut
this one would also work if renamed to .URL - it would have the icon of whatever your default browser is

[InternetShortcut]
URL=http://www.google.com/

oex

Awesome thanks for that Dave I had done the same with a Secondlife .url file but they only had the details I posted
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

dedndave

more favicon info....

websites are supposed to use an ICO file named "favicon.ico", place it in the web_root folder, and create an HTML reference tag
those are the MS rules for IE ver 6 favorites

many websites don't follow the rules, and thus may not properly display a favicon when bookmarked with IE 6

some websites use a different name, file type (animated GIFs, for example), or location
the only way to get the right icon for those sites is to open and parse the homepage HTML file

otherwise, you will see the icon from the default browser

here is an example of a site that didn't follow the old rules...
http://www.sesp.cse.clrc.ac.uk/html/SoftwareTools/vtune/users_guide/mergedProjects/analyzer_ec/mergedProjects/reference_olh/reference_olh.htm

the favicon shows up fine using Firefox   :bg

oex

Oh joy! They Changed It!

In 2003 the .ico format was registered by Simon Butcher with the Internet Assigned Numbers Authority (IANA) under the MIME type image/vnd.microsoft.icon, finally standardizing the filetype.[3] (This also means that the filetype image/x-icon is no longer correct.)
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

dedndave

you will see them both ways - the older mime type was in such wide use, it sort of became the standard without sanction
the "/x-????" types are used for mime types that are otherwise undefined, so it is essentially valid
of course, microsoft wants everyone to use their vnd.microsoft type - lol
during the "browser wars" of the late 90's/early 00's, that was a big issue between microsoft and netscape