Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to check if Active Desktop is enabled Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
02-Oct-02
Category
System
Language
Delphi 2.x
Views
104
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius 

How to check if Active Desktop is enabled

Answer:

1   uses
2     ComObj, ShlObj, ActiveX;
3   
4   {Check if Active Desktop is enabled - Option 1}
5   
6   function IsActiveDeskTopOn: Boolean;
7   var
8     h: HWND;
9   begin
10    h := FindWindow('Progman', nil);
11    h := FindWindowEx(h, 0, 'SHELLDLL_DefView', nil);
12    h := FindWindowEx(h, 0, 'Internet Explorer_Server', nil);
13    Result := h <> 0;
14  end;
15  
16  {Check if Active Desktop is enabled - Option 2}
17  
18  function IsActiveDesktopEnable: Boolean;
19  const
20    CLSID_ActiveDesktop: TGUID = '{75048700-EF1F-11D0-9888-006097DEACF9}';
21  var
22    ActiveDesk: IActiveDesktop;
23    ComponentsOpt: TComponentsOpt;
24    hr: HRESULT;
25    dwReserved: DWORD;
26  begin
27    ZeroMemory(@ComponentsOpt, SizeOf(TComponentsOpt));
28    ComponentsOpt.dwSize := SizeOf(TComponentsOpt);
29    hr := CoCreateInstance(CLSID_ActiveDesktop, nil, CLSCTX_INPROC_SERVER,
30      CLSID_ActiveDesktop, ActiveDesk);
31    if SUCCEEDED(hr) then
32    begin
33      hr := ActiveDesk.GetDesktopItemOptions(ComponentsOpt, dwReserved);
34      {ActiveDesk._Release;}
35    end;
36    Result := ComponentsOpt.fActiveDesktop;
37  end;
38  
39  
40  //And here is how to activate the Active Desktop:
41  
42  
43  procedure TForm1.Button1Click(Sender: TObject);
44  const
45    CLSID_ActiveDesktop: TGUID = '{75048700-EF1F-11D0-9888-006097DEACF9}';
46  var
47    ActiveDesk: IActiveDesktop;
48    ComponentsOpt: TComponentsOpt;
49  begin
50    ActiveDesk := CreateComObject(CLSID_ActiveDesktop) as IActiveDesktop;
51    with ActiveDesk do
52    begin
53      ComponentsOpt.dwSize := SizeOf(ComponentsOpt);
54      GetDesktopItemOptions(ComponentsOpt, 0);
55      ComponentsOpt.fActiveDesktop := True;
56      SetDesktopItemOptions(ComponentsOpt, 0);
57      ApplyChanges(AD_APPLY_ALL);
58    end;
59  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC