` Printed Icetips Article

Icetips Article



Windows API: Creating shortcuts on the desktop
2001-08-01 -- Craig E Ransom
 
Newsgroups: comp.lang.clarion

Hi all.

I hope this is simple (though it seems not to be :) :

Using C5bPE how do I from within my homemade installation program create a
shortcut to my app on the users desktop?

Short questions should yield short answers, right? ;)


Hi Niels!

Short questions should yield short answers, right? ;)

Short answer. You can try this. It's all C/C++. :(

> http://msdn.microsoft.com/library/psdk/shellcc/shell/Shortcut.htm

-- Craig (The Data Ferret)
http://www.pcferret.com/ for RARS, NetClip
http://www.pcferret.com/teletools.html for Telephony
http://www.pcferret.com/gps.html for GPS!
Virtual Access 5.50 build 311 Win98
http://counter.li.org ID #184149
"Do not meddle in the affairs of FERRETS..."
Message 3 in thread
From: Alexey Solovjev (clarion@also.spb.ru)
Subject: Re: Creating a shortcut programmatically.


View this article only
Newsgroups: comp.lang.clarion
Date: 2001-01-08 04:45:34 PST


PROGRAM

DWORD          EQUATE(LONG)
WORD           EQUATE(USHORT)
HRESULT        EQUATE(LONG)
HWND           EQUATE(UNSIGNED)
UINT           EQUATE(UNSIGNED)
OLESTRING      EQUATE(BSTRING)
!OLESTRING     EQUATE(CSTRING)

! OLE Types ====================================================================

GUID           GROUP,TYPE
Data1            DWORD
Data2            WORD
Data3            WORD
Data4            STRING(8)
               END

IID            GROUP(GUID),TYPE
               END

CLSID          GROUP(GUID),TYPE
               END

OBJECTID       GROUP(GUID),TYPE
Uniquifier       ULONG
               END

SHITEMID       GROUP,TYPE
cb               USHORT
ID               BYTE,DIM(1)
               END

ITEMIDLIST     GROUP,TYPE
mkid             LIKE(SHITEMID)
               END

               ITEMIZE,PRE(CLSCTX)
INPROC_SERVER    EQUATE(1)
INPROC_HANDLER   EQUATE(2)
LOCAL_SERVER     EQUATE(4)
INPROC_SERVER16  EQUATE(8)
               END

               ITEMIZE,PRE(CSIDL)
DESKTOP          EQUATE(0)
PROGRAMS         EQUATE(2)
CONTROLS         EQUATE(3)
Read the rest of this message... (331 more lines)

Message 4 in thread
From: Craig E Ransom (dataferret@pcferret.com)
Subject: Re: Creating a shortcut programmatically.


View this article only
Newsgroups: comp.lang.clarion
Date: 2001-01-08 07:15:13 PST



Hi Alexey!

> See attachment. The plain CW code.
>
Ah-HAH! I THOUGHT I'd seen something like this but couldn't find the
message!

This is the part that needs to be modified, I guess, to set the
correct values:

>   ShortCutInfo.TargetFile  = 'W:\TESTS\_026\CALLOLE.EXE'
>   ShortCutInfo.IconName    = 'O:\NT4\COOL.DLL'
>   ShortCutInfo.IconIndex   = 17
>   ShortCutInfo.Description = 'Description for this program shortcut'
>   ShortCutInfo.HotKey      = 0
>   ShortCutInfo.StartIn     = 'W:\TESTS\_026\'
>   ShortCutInfo.ShortCut    = 'This Program.LNK<0>'
>

N.B. it will still behoove the developer to check out the link I
provided, to understand what each item is.

BTW, I noticed:

IOLE INTERFACE,COM

COM as an attribute for INTERFACE is not documented in either C5b or
C5.5, but I was able to compile this in C5b as well as C5.5. Does this
imply that INTERFACE with the COM attribute is native Clarion for
doing COM objects? Or does COM mean something else in this context?

Thanks again! (You are such a wonderful source of information!)

-- Craig (The Data Ferret)
http://www.pcferret.com/ for RARS, NetClip
http://www.pcferret.com/teletools.html for Telephony
http://www.pcferret.com/gps.html for GPS!
Virtual Access 5.50 build 311 Win98
http://counter.li.org ID #184149
"Do not meddle in the affairs of FERRETS..."
Message 5 in thread
From: Alexey Solovjev (clarion@also.spb.ru)
Subject: Re: Creating a shortcut programmatically.


View this article only
Newsgroups: comp.lang.clarion
Date: 2001-01-08 07:59:37 PST


Hello,

> From: Craig E Ransom 
> Date: Mon, 08 Jan 2001 10:10:19 EST
> COM as an attribute for INTERFACE is not documented in either C5b or
> C5.5, but I was able to compile this in C5b as well as C5.5. Does this
> imply that INTERFACE with the COM attribute is native Clarion for
> doing COM objects? Or does COM mean something else in this context?

COM implies the PASCAL calling convention for all methods in the
INTERFACE.

Alexey Solovjev

E-mail:  clarion@also.spb.ru
Message 6 in thread
From: Randy Goodhew (rgoodhew@fuse.net)
Subject: Re: Creating a shortcut programmatically.


View this article only
Newsgroups: comp.lang.clarion
Date: 2001-01-08 11:02:40 PST


Also:

What about the undocumented data types: BSTRING and VARIANT?
Do they now work as expected?

Many thanks...

Alexey Solovjev wrote:
>
> Hello,
>
> > From: Craig E Ransom 
> > Date: Mon, 08 Jan 2001 10:10:19 EST
> > COM as an attribute for INTERFACE is not documented in either C5b or
> > C5.5, but I was able to compile this in C5b as well as C5.5. Does this
> > imply that INTERFACE with the COM attribute is native Clarion for
> > doing COM objects? Or does COM mean something else in this context?
>
> COM implies the PASCAL calling convention for all methods in the
> INTERFACE.
>
> Alexey Solovjev
>
> E-mail:  clarion@also.spb.ru
--
 Randy Goodhew
 ---[ eQ ]---
Message 7 in thread
From: Niels H. K. Thomsen (NikoDemus@vip.cybercity.dk)
Subject: Re: Creating a shortcut programmatically.


View this article only
Newsgroups: comp.lang.clarion
Date: 2001-01-09 03:18:34 PST


Could I see the rest of the code, please?

Feel free to send the source to me by e-mail, if this is preferred.

Thanks in advance. Best regards, Niels.

Craig E Ransom skrev i meddelelsen ...
>Hi Alexey!
>
>> See attachment. The plain CW code.
>>
>Ah-HAH! I THOUGHT I'd seen something like this but couldn't find the
>message!
>
>This is the part that needs to be modified, I guess, to set the
>correct values:
>
>>   ShortCutInfo.TargetFile  = 'W:\TESTS\_026\CALLOLE.EXE'
>>   ShortCutInfo.IconName    = 'O:\NT4\COOL.DLL'
>>   ShortCutInfo.IconIndex   = 17
>>   ShortCutInfo.Description = 'Description for this program shortcut'
>>   ShortCutInfo.HotKey      = 0
>>   ShortCutInfo.StartIn     = 'W:\TESTS\_026\'
>>   ShortCutInfo.ShortCut    = 'This Program.LNK<0>'
>>
>
>N.B. it will still behoove the developer to check out the link I
>provided, to understand what each item is.
>
>BTW, I noticed:
>
>IOLE INTERFACE,COM
>
>COM as an attribute for INTERFACE is not documented in either C5b or
>C5.5, but I was able to compile this in C5b as well as C5.5. Does this
>imply that INTERFACE with the COM attribute is native Clarion for
>doing COM objects? Or does COM mean something else in this context?
>
>Thanks again! (You are such a wonderful source of information!)
>
>-- Craig (The Data Ferret)
>http://www.pcferret.com/ for RARS, NetClip
>http://www.pcferret.com/teletools.html for Telephony
>http://www.pcferret.com/gps.html for GPS!
>Virtual Access 5.50 build 311 Win98
>http://counter.li.org ID #184149
>"Do not meddle in the affairs of FERRETS..."
>
Message 8 in thread
From: Craig E Ransom (dataferret@pcferret.com)
Subject: Re: Creating a shortcut programmatically.


View this article only
Newsgroups: comp.lang.clarion
Date: 2001-01-09 06:34:33 PST


Hi Niels!

> Could I see the rest of the code, please?
>
> Feel free to send the source to me by e-mail, if this is preferred.
>
The rest of it is in Alexey's message in this thread dated 08 Jan
2001 15:43:55 +0300. As he contributed it, I do not feel comfortable
posting or emailing it without his express permission.

-- Craig (The Data Ferret)
http://www.pcferret.com/ for RARS, NetClip
http://www.pcferret.com/teletools.html for Telephony
http://www.pcferret.com/gps.html for GPS!
Virtual Access 5.50 build 311 Win98
http://counter.li.org ID #184149
"Do not meddle in the affairs of FERRETS..."
Message 9 in thread
From: Craig E Ransom (dataferret@pcferret.com)
Subject: Re: Creating a shortcut programmatically.


View this article only
Newsgroups: comp.lang.clarion
Date: 2001-01-08 07:28:56 PST


Hi Alexey!

WOW! This little fellow works - in C5b!

Change these lines to put the Windows Calculator on your
desktop:

ShortCutInfo.TargetFile  = 'C:\WINDOWS\CALC.EXE'
ShortCutInfo.IconName    = 'C:\WINDOWS\CALC.EXE'
ShortCutInfo.IconIndex   = 0
ShortCutInfo.Description = 'Calculator, natch!'
ShortCutInfo.HotKey      = 0
ShortCutInfo.StartIn     = 'C:\WINDOWS'
ShortCutInfo.ShortCut    = 'Calculator.LNK<0>'

KEWEL!

-- Craig (The Data Ferret)
http://www.pcferret.com/ for RARS, NetClip
http://www.pcferret.com/teletools.html for Telephony
http://www.pcferret.com/gps.html for GPS!
Virtual Access 5.50 build 311 Win98
http://counter.li.org ID #184149
"Do not meddle in the affairs of FERRETS..."
Message 10 in thread
From: Craig E Ransom (dataferret@pcferret.com)
Subject: Re: Creating a shortcut programmatically.


View this article only
Newsgroups: comp.lang.clarion
Date: 2001-01-09 09:03:30 PST


Hi Alexey!

> See attachment. The plain CW code.
>
i have been looking at this and reading the Clarion documentation (such as it is)
I have a question concerning what is happening.

For instance, I understand what the IOLE portion does, I think.

However, to use one of the small ones:

> IPersist       INTERFACE(IOLE),COM
>
> GetClassID       PROCEDURE (*CLSID pClassID),HRESULT,RAW
>                END
>
I thought that INTERFACE required a Clarion CLASS with IMPLEMENTS(InterfaceName),
but I see no CLASS definition for IPersist, but I DO see the GetClassID which _is_
a method in the Microsoft Windows COM interface for their IPersist class. From the
Platform SDK entry: "The IPersist interface defines the single method GetClassID,
which is designed to supply the CLSID of an object that can be stored persistently
in the system."

Which is what you are doing.

Does INTERFACE therefore give us the capability of creating "Clarion INTERFACE" to
ANY such Windows Platform SDK class and its methods, without further definition?
Could I use this to access a third-party COM DLL that implements the IClassFactory
or IClassFactory2 interface, to create and manipulate objects for that COM DLL?

-- Craig (The Data Ferret)



Printed November 23, 2024, 10:16 pm
This article has been viewed/printed 35273 times.
Google search has resulted in 851 hits on this article since January 25, 2004.