| View previous topic :: View next topic |
| Author |
Message |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Tue Jun 09, 2009 5:58 pm Post subject: Desktop in a window? |
|
|
Is there a way that I can put the desktop in a window, icons an all? I know the code from CodeScript to use the desktop wallpaper on a window but I would like the icons as well. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Jun 09, 2009 9:17 pm Post subject: |
|
|
Are you talking about as a screenshot? _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Tue Jun 09, 2009 10:45 pm Post subject: |
|
|
I doubt he means screenie.. I'm thinking he's talking about replicating the desktop via a VDS interface. At one time I ventured out on such a project which I called "MicroDesktop". It was going to be a mini desktop which used the wallpaper, but scaled down, and 16x16 icons layed out exactly as the desktop looks. But at that time, I had no clue how to find out what icons were on the desktop, and at what positions they were at on the desktop. _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Jun 10, 2009 11:08 am Post subject: |
|
|
Yes, I mean what Garrett said. Take the complete desktop and put it in/on a window so that it is still functional. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jun 10, 2009 2:10 pm Post subject: |
|
|
Hehehe so what would be the reason to do this? I am still lost here... _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Jun 10, 2009 2:26 pm Post subject: |
|
|
I have an idea for a program that this would be the main part... if it can be done. Kind of an app launcher, but not. Hard to explain w/o writing a book. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jun 10, 2009 2:48 pm Post subject: |
|
|
There is no magic API that would do this. You would just have to create a dialog with the desktop as the background then scan all the current icons to get their information and create either bitbtn elements or clickable bitmap elements on your dialog. You may need to use get the icon spacing with the API function GetSystemMetrics and translate those to your window size but for the location on the desktop for a specific icon that may be tricky. All in all I think it can be done just not very easy. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jun 10, 2009 2:54 pm Post subject: |
|
|
One more note the desktop is nothing more than a window with no title bar and has a ListView control to hold the icons so you may be able to get the positions using the ListView API messages. I know there are a couple of DSU's here that can control the VDS Table element which is just a list view element. To get the Desktop window id use the GetDesktopWindow API function or use the VDS @winatpoint() function in an empty area of the desktop then walk the child windows to find it's listview control. Not sure since I have never thought of trying this before  _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jun 10, 2009 5:50 pm Post subject: |
|
|
Ok after a little digging... Here is a snippit of VB code that would need to be translated into VDS to get the positions of the icons on the desktop.
| Code: |
Public Function StoreDeskTopInfo() As Boolean
Dim pid As Long, tid As Long, lStyle As Long
Dim hProcess As Long, lpSysShared As Long, dwSize As Long
Dim nCount As Long, lWritten As Long, hFileMapping As Long
Dim h As Long, i As Long
h = GetSysLVHwnd
If h = 0 Then Exit Function
If (GetWindowLong(h, GWL_STYLE) And LVS_AUTOARRANGE) = LVS_AUTOARRANGE Then
bAutoArrange = True
Call SendMessage(GetParent(h), WM_COMMAND, IDM_TOGGLEAUTOARRANGE, ByVal 0&)
End If
tid = GetWindowThreadProcessId(h, pid)
nCount = SendMessage(h, LVM_GETTITEMCOUNT, 0, 0&)
If nCount = 0 Then Exit Function
xScreen = Screen.Width \ Screen.TwipsPerPixelX
yScreen = Screen.Height \ Screen.TwipsPerPixelY
ReDim ptOriginal(nCount - 1)
ReDim ptCurrent(nCount - 1)
dwSize = Len(ptOriginal(0))
If IsWindowsNT Then
lpSysShared = GetMemSharedNT(pid, dwSize, hProcess)
WriteProcessMemory hProcess, ByVal lpSysShared, ptOriginal(0), dwSize, lWritten
For i = 0 To nCount - 1
SendMessage h, LVM_GETITEMPOSITION, i, ByVal lpSysShared
ReadProcessMemory hProcess, ByVal lpSysShared, ptOriginal(i), dwSize, lWritten
Next i
FreeMemSharedNT hProcess, lpSysShared, dwSize
Else
lpSysShared = GetMemShared95(dwSize, hFileMapping)
CopyMemory ByVal lpSysShared, ptOriginal(0), dwSize
For i = 0 To nCount - 1
SendMessage h, LVM_GETITEMPOSITION, i, ByVal lpSysShared
CopyMemory ptOriginal(i), ByVal lpSysShared, dwSize
ptCurrent(i).x = xScreen / 2
ptCurrent(i).y = yScreen / 2
Next i
FreeMemShared95 hFileMapping, lpSysShared
End If
StoreDeskTopInfo = True
End Function
|
Now to get the Desktop ListView Window handle is easy see the code below.
| Code: |
#DEFINE FUNCTION,GetDesktopIconWin
Info Desktop ListView Window@CR()Window ID:@GetDesktopIconWin()@CR()Window Class:@winclass(@GetDesktopIconWin())@CR()Window Title:@wintext(@GetDesktopIconWin())
Stop
:GetDesktopIconWin
%R = @window(@window(@winexists(#Progman),CHILD),CHILD)
Exit %R
|
_________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Jun 10, 2009 7:08 pm Post subject: |
|
|
Very cool. Now, um, to translate... I'll take a stab at it, but I'm not good at that.
Another question. Is there a way a screen shot could be taken of the desktop even if there are windows open over it so that only the desktop is captured and not any other window? _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1567
|
Posted: Thu Jun 11, 2009 5:34 am Post subject: |
|
|
The vdssave extension will take a screenshot of the windows desktop (no windows or shortcuts overlayed).
Im sure its possible in pure vds 6 too, it's just taking the canvas of the window (desktop) and assigning it to a bitmap then saving it. |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Jun 11, 2009 12:20 pm Post subject: |
|
|
| LiquidCode wrote: | | Very cool. Now, um, to translate... |
I can translate this but it will take a little time since I have a couple of other projects going on at the moment. Actually what we really need is a better and more generic way of sending messages that require pointers like this. I will try to hide all the memory allocation of the remote process in a single function with @sendmsg()... So I guess I would call it @sendmsgEx()... _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Fri Jun 12, 2009 11:35 am Post subject: |
|
|
@PGWare I don't remember that. I'll take a look. thanks!
@DragonSphere If you could translate, that would be great. Thanks for the help! _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sun Aug 02, 2009 7:04 pm Post subject: |
|
|
I've been using a couple programs that remember the desktop icons positions which is very useful when testing VDS programs under different screen sizes (they put the icons back where they go when dis-arranged).
But I got a virus from one of them and the other one forces me to connect to a china website a lot, which I am trying to get away from.
I would be willing to pay a little for that conversion if it would help me write my own VDS desktop save program for my own personal use.
thanks |
|
| Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 768 Location: Eastman, GA
|
Posted: Tue Apr 26, 2011 3:15 pm Post subject: |
|
|
Digging around. Looking for API.
In theory if you parent #progman to your window using vdswnd.dll or the mdi code I posted should work.
I don't think it's a good ideal though. |
|
| Back to top |
|
 |
|