• Welcome to Theos PowerBasic Museum 2017.

News:

Attachments are only available to registered users.
Please register using your full, real name.

Main Menu

IWshShell / IActiveDesktop

Started by Patrice Terrier, January 15, 2009, 10:51:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

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?

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

José Roca

 
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


Patrice Terrier

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.
:-\
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

José Roca

 
This error means that the IActiveDesktop interface isn't supported in Windows Vista.

José Roca

 
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.

Patrice Terrier

Then, do you know of another interface i could use?

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com