Click here to Skip to main content
15,914,165 members
Home / Discussions / C#
   

C#

 
Generalalgorithm for motion detection Pin
shamna23-May-05 22:07
shamna23-May-05 22:07 
GeneralDesktop Icons Pin
Sabry190523-May-05 21:52
Sabry190523-May-05 21:52 
GeneralRe: Desktop Icons Pin
Dave Kreskowiak24-May-05 4:33
mveDave Kreskowiak24-May-05 4:33 
GeneralRe: Desktop Icons Pin
Sabry190524-May-05 4:40
Sabry190524-May-05 4:40 
GeneralRe: Desktop Icons Pin
Dave Kreskowiak24-May-05 11:08
mveDave Kreskowiak24-May-05 11:08 
GeneralRe: Desktop Icons Pin
eggie524-May-05 12:48
eggie524-May-05 12:48 
GeneralRe: Desktop Icons Pin
Sabry190526-May-05 0:15
Sabry190526-May-05 0:15 
GeneralRe: Desktop Icons Pin
eggie526-May-05 12:53
eggie526-May-05 12:53 
That's a very reasonable request and I don't know why I didn't implement it in the first place. I must be a slacker. Anyways, to implement the "dynamic" desktop handle recovery you speak of, we need to introduce a new Window API function, FindWindow. Consider the following example:

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace ConsoleApplication15
{
    class Program
    {
        [DllImport("user32.dll")]
        static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

        [DllImport("user32.dll")]
        static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

        static void Main(string[] args)
        {

            IntPtr handle = FindWindow(null, "PROGRAM MANAGER");
            ShowWindow(handle, 0);
        }
    }
}


We get the handle to the desktop by using a null parameter and "PROGRAM MANAGER" for the second parameter of the FindWindow function. Don't ask me how I figured it out. Anyways, that should work.

Additionally, if you have a "Show Desktop" button in your taskbar you will notice some cool clashing between your program and windows, because I think that "Show Desktop" button calls ShowWindow somewhere....

Let me know if this works for you...

/\ |_ E X E GG
GeneralRe: Desktop Icons Pin
Sabry190530-May-05 2:01
Sabry190530-May-05 2:01 
Generalproblem Pin
send2naeem23-May-05 21:48
send2naeem23-May-05 21:48 
GeneralRe: problem Pin
NormDroid23-May-05 22:08
professionalNormDroid23-May-05 22:08 
GeneralRe: problem Pin
send2naeem23-May-05 22:10
send2naeem23-May-05 22:10 
GeneralRe: problem Pin
User 665823-May-05 22:41
User 665823-May-05 22:41 
GeneralRe: problem Pin
send2naeem23-May-05 23:23
send2naeem23-May-05 23:23 
GeneralRe: problem Pin
J4amieC23-May-05 23:40
J4amieC23-May-05 23:40 
Generalto send live video & audio (streams) on network. Pin
shumyla198323-May-05 21:24
shumyla198323-May-05 21:24 
GeneralC string reading Pin
saberhawkp423-May-05 20:02
saberhawkp423-May-05 20:02 
GeneralEncoding Technique Pin
Rashaida23-May-05 19:53
sussRashaida23-May-05 19:53 
GeneralReading Access Schema Pin
ivix4u23-May-05 18:13
ivix4u23-May-05 18:13 
GeneralRemoving HTML-tags from a string Pin
anderslundsgard23-May-05 18:08
anderslundsgard23-May-05 18:08 
GeneralRe: Removing HTML-tags from a string Pin
Serdar YILMAZ23-May-05 21:27
Serdar YILMAZ23-May-05 21:27 
GeneralRe: Removing HTML-tags from a string Pin
anderslundsgard23-May-05 22:27
anderslundsgard23-May-05 22:27 
GeneralRe: Removing HTML-tags from a string Pin
eggie524-May-05 12:53
eggie524-May-05 12:53 
Questionlgo4net not found...? Reference: Copy Local solved the problem...? Pin
devvvy23-May-05 17:53
devvvy23-May-05 17:53 
GeneralTell me Default Encoding technique Pin
shumyla198323-May-05 17:02
shumyla198323-May-05 17:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.