Theos PowerBasic Museum 2017

Archive => Discussion - Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Topic started by: Patrice Terrier on January 15, 2009, 10:51:17 AM

Title: IWshShell / IActiveDesktop
Post by: Patrice Terrier on January 15, 2009, 10:51:17 AM
José

I am still struggling with 64-bit and trying to find a solution to make OfTheBay work with it.

The "Icolumnmanager" that was suggested elsewhere, do not apply to my case.

What I need exactly to retrieve is, for each of the Desktop Shorcut,
- The name of the shortcut.
- The X,Y location of the matching desktop icon.
- The width, height of the matching destop icon.
etc.

By the way it seems that the IActiveDesktop interface (ShlObj.inc) would do it.
The COMPPOS member of COMPONENT structure seems to have what i am looking for.

Do you have ever worked with this interface?

...
Title: Re: IWshShell / IActiveDesktop
Post by: José Roca on January 15, 2009, 08:56:53 PM
 
Sorry for the delay. I was getting an invalid parameter error in the call to the GetDesktopItem method and have found that the value of the INTERNET_MAX_URL_LENGTH constant was wrong.

To run the example, you will need to download the updated wininet.inc and shlobj.inc files from: http://www.jose.it-berater.org/smfforum/index.php?topic=2944.new#new

This example is a translation of the one found at http://msdn.microsoft.com/en-us/library/bb776830(VS.85).aspx


#COMPILE EXE
#DIM ALL
#INCLUDE ONCE "shlobj.inc"

FUNCTION PBMAIN () AS LONG

   LOCAL hr AS LONG
   LOCAL pActiveDesktop AS IActiveDesktop
   LOCAL compDesktopItem AS COMPONENT
   LOCAL intCount AS LONG
   LOCAL intIndex AS LONG
   LOCAL strFriendlyName AS STRING
   LOCAL strSource AS STRING
   LOCAL strSubscribedURL AS STRING

   pActiveDesktop = NEWCOM CLSID $CLSID_ActiveDesktop
   IF ISNOTHING(pActiveDesktop) THEN EXIT FUNCTION

   hr = pActiveDesktop.GetDesktopItemCount(intCount, 0)
   FOR intIndex = 0 TO intCount - 1
      ' //get the COMPONENT structure for the current desktop item
      compDesktopItem.dwSize = SIZEOF(COMPONENT)
      hr = pActiveDesktop.GetDesktopItem(intIndex, compDesktopItem, 0)
      ' //Insert code that processes the structure
      IF hr THEN
         ? "Error &H" & HEX$(hr)
      ELSE
         strFriendlyName = TRIM$(ACODE$(compDesktopItem.wszFriendlyName), CHR$(0))
         ? strFriendlyName
         strSource = TRIM$(ACODE$(compDesktopItem.wszSource), CHR$(0))
         ? strSource
         strSubscribedURL = TRIM$(ACODE$(compDesktopItem.wszSubscribedURL), CHR$(0))
         ? strSubscribedURL
      END IF
      ' //Insert code to clean-up structure for next component
      RESET compDesktopItem
   NEXT

   pActiveDesktop = NOTHING
   WAITKEY$

END FUNCTION

Title: Re: IWshShell / IActiveDesktop
Post by: Patrice Terrier on January 15, 2009, 09:17:21 PM
José,

Thank you for the new include files.

I have updated my Jose_WinAPI folder with the latest you just provided, however it doesn't work on VISTA 64.

hr = pActiveDesktop.GetDesktopItemCount(intCount, 0)
intCount is always returning 0

while hr = -2147467263

i am getting realy upset with these 64-bit issues.
:-\
Title: Re: IWshShell / IActiveDesktop
Post by: José Roca on January 15, 2009, 09:22:29 PM
 
This error means that the IActiveDesktop interface isn't supported in Windows Vista.
Title: Re: IWshShell / IActiveDesktop
Post by: José Roca on January 15, 2009, 09:31:44 PM
 
In Widows Vista, the Active Desktop has been replaced by Windows Sidebar, that in turn is going to be replaced by the Gadget Platform in Windows 7.
Title: Re: IWshShell / IActiveDesktop
Post by: Patrice Terrier on January 15, 2009, 09:43:06 PM
Then, do you know of another interface i could use?