Link to home
Start Free TrialLog in
Avatar of nikolaosk
nikolaoskFlag for Greece

asked on

how to show/hide the my computer icon,my documents icon,network places icon on the desktop

hi all,

i just want to show/hide the my computer,my documents icons from desktop.
 
i know how to hide all icons. i do not want that. i know how to hide/unhide start button,systray.

if you do right click on desktop(win xp) and then properties, display properties window is shown. go to desktop tab, then hit customize desktop, then go to general tab. you see there how to check/ uncheck the desktop icons. that is what i want.

i need a solution with vb and apis .


i have a question that i need to ask someone( i work  on a certification project that test people's knowledge of windows).



question: by right clicking the relevant item on desktop give us the name of the computer.


that icon is my computer. but if does not appear on the desktop i cannot ask him that.

hope you get mi point

thanks

Avatar of Computron
Computron

Avatar of nikolaosk

ASKER

thanks a lot for your prompt answer.

the link you pointed me has thousands of lines of complicated code.plus it gives me nasty errors. do you think you can simplify it for me by writing a small vb project that does hide/show my computer icon?
how to do it in the registry:

hide / show my computer icon on desktop :

http://techsupt.winbatch.com/TS/T000001049F6.html

If that does not work here is what you need to do to remove my computer from the start menu and the desktop , open a new notepad and copy and paste what is below into it :

'--------------------------------------------

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum]
"{20D04FE0-3AEA-1069-A2D8-08002B30309D}"=dword:00000001

'--------------------------------------------

That will get rid of them ( however before you run the registry edit I would go to that key to save a copy of it before you alter it that way you know how to undo it to make my computer re appear back in the start menu and the desktop.

hide show my documents on desktop :

http://www.theeldergeek.com/hide_show_my_documents_on_desktop.htm

hide / show IE icon on desktop :

http://www.theeldergeek.com/hide_internet_explorer_desktop_icon.htm

Now that you know what the registry edits are to disable / get rid of the icons all you have to do is use registry edits in visual basic to alter the values as you please, taking into consideration the site below for an example in visual basic on how to modify the registry:

http://www.codetoad.com/vb_modify_registry.asp

There are simplified ways of altering the registry by using regread, regwrite, regdelete etc as well and I am sure you can also use wmi for altering the registry, if you need further help please post back.
yes i would like to see the full code(just for one icon.)

i know how to use these functions(regread, regwrite, regdelete) from api but in case  i make many mistake.

the problem is that i cannot reboot again. this will happen in an exam. so you cannot reboot. it must take place immediately the change.


is it safe to play with the registry? will that registry path will be the same for all machines running xp and 2000?

thanks
nikolaosk, you dont have to reboot. There is actually a windows trick you can pull off to update the registry without restarting the computer.
It envolves terminating the explorer.exe process and then executing using shell () function. All this can be easily achieved in a few lines of code using WMI.
Based on gecko's suggestion with the registry access. Use this to accomplish the update. Give it a try let us know the resulting factors.

Gecko, in regards to exam. He is making a program that is basically a questionier which asks the user to do certain tasks..this is what he means by exam. He doesn't mean it refering to any type of school activities. :)
'Example:

'****************
'Module code
'****************

Option Explicit
Dim objWMIService As Object, colProcess As Object

Public Sub doReboot(strProcess As String)
Dim objProcess
Dim strComputer As String, strProcessKill As String
strComputer = Environ$("COMPUTERNAME")  '// current computer
strProcessKill = "'" & strProcess & "'" '// Don't attempt to modify this line the ' ' are important.
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery("Select * from Win32_Process Where Name = " & strProcessKill)
For Each objProcess In colProcess
  objProcess.Terminate                  '// Find the proccess and terminate it.
Next
Shell strProcess, vbHide
Set objWMIService = Nothing             '// clean up memory
Set colProcess = Nothing
End Sub


'****************
'Form code
'****************

Private Sub Command1_Click()
doReboot ("explorer.exe")
End Sub
You might be able to update the registry with SystemParametersInfo API so search for that also. Good luck :)
ah ok :) well in that case I hope it works out. Just I was not sure what he meant by exam and I wanted to make sure I was covering my A$$ :)

btw any luck with my firewall Q ?
i have not managed to unhide/hide the my computer icon from desktop by changing the values in teh registry through vb.

can you show me how?

thanks
ASKER CERTIFIED SOLUTION
Avatar of nffvrxqgrcfqvvc
nffvrxqgrcfqvvc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
THANKS A LOT FOR YOUR ANSWER. I WILL TRY IT AND SEE IF IT WORKS. AT THE MOMENT  I HAVE THIS HUGE URGENT NEED FOR HELP FOR THIS QUESTION THAT IT IS ALSO POSTED ON EE SITE.


Question Title: how to retrieve the text(keyword) of a help window(press f1 and then choose index option) that someone types(keyword) in the index window

PLEASE HAVE A LOOK. I KNOW YOU HAVE ANSWERED SIMILAR ANSWERS TO THAT ONE. I HAD THIS ONE POSTED PREVIOUSLY AND YOU SAID THAT YOU CANNOT GET WHAT SOMEONE TYPES IN A HELP WINDOW.YOU TOLD ME THAT IT IS NOT POSSIBLE TO GET THE HANDLE. NOW THIS IS A BIT DIFFERENT. YOU PRESS F1 IN WINDOWS XP THE HELP FIRES UP AND THEN PRESS INDEX BUTTON THE THE TEXT BOX THAT APPEARS AND SOMEONE CAN TYPE A KEYWORD TO IT. THAT TEXT BOX HAD HANDLE. PLEASE HELP.

I WILL LET YOU KNOW ABOUT YOUR SOLUTION FOR THIS PROBLEM
Hello, Have you tried this yet nik..?
sorry for the delay on coming back to this question.currently i have many questions open and i am trying to close most of them.

i did try your code above.
what happens when i run your showhidmycomputericon or showhidmycoputericon is this
1) all the icons on the desktop become invisible for a while and then show again

2) my documents folder opens

what i want is not to hide/unhide all icons but only to show my computer icon on (windows xp, windows 2000) the desktop if

it is not shown already.

thanks
nikos