Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show Desktop Icons using VB6 1

Status
Not open for further replies.

dja1

Programmer
Apr 24, 2002
65
GB
The PC I use at work is maintained by a third-party, who have decided that Desktop Icons are unnecessary, and so delete all entries in my Desktop folder whenever XP is initiated.
What I would like to do is to have my desktop show shortcut icons.
I have no problem in devising a method to copy all shortcuts from another folder to this folder. I also know how to make these icons show on the desktop by right-clicking the desktop arrange icons / show desktop items. Does anyone know how to show the icons on the desktop using VB6 ?
 
The PC I use at work is maintained by a third-party, who have decided that Desktop Icons are unnecessary, and so delete all entries in my Desktop folder whenever XP is initiated.
Well that's pretty damned foolish. By doing that they could be deleting not only links (shortcuts) but actual files. Instead of addressing this for yourself, address it for everyone: the desktop belongs to the USER, not an admin, and they MUST keep their HANDS OFF THE USERS' DATA.
 
harebrain said:
the desktop belongs to the USER, not an admin
Actually, it belongs to neither; it belongs to the owners of the company. I agree that deleting desktop items every time a user logs in is silly, but I suspect that maybe they are using a guest login, or changes to the profile are not being stored, giving the appearance of being deleted... Whatever the case, the best approach would seem to be discussing this with management, rather than trying to circumvent the issue.

We use GPO's to limit storing files on a desktop, because (for us), files don't belong there... they belong on a network folder that actually gets backed up!!
 
>they MUST keep their HANDS OFF THE USERS' DATA

Right up to the point where a user accidentally deletes something important from that desktop ...
 
Thank you for your responses, so far.

However, I did ask "Does anyone know how to show the icons on the desktop using VB6 ?" - would it be possible to restrict any replies to actually answering the question ?
 
While I agree with harebrain and guitarzan, that this is more of a management issue, here is the workaround which I got by hooking into Windows' message stream.

I checked it on Windows XP and found it working. It simulates choosing the "Show Desktop Icons" command on desktop context menu.
___
[tt]
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_COMMAND = &H111
Private Sub Command1_Click()
Dim hWindow As Long
hWindow = FindWindowEx(0, 0, "Progman", vbNullString)
hWindow = FindWindowEx(hWindow, 0, "SHELLDLL_DefView", vbNullString)
PostMessage hWindow, WM_COMMAND, &H7402, ByVal 0&
End Sub[/tt]
 
Hypetia

Thanks very much - spot on. As a matter of interest, I found that if you run this code when Desktop Icons are visible - it switches them off !

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top