Windows 7 Components - Beta#

Well, here comes the update promised. Originally, I planned to release it yesterday, but I had to give a talk today on short notice. So I pushed around priorities a little.

Anyway, this update has a few fixes as well as support for taskbar windows as well, interesting for MDI applications. It is all in the code.

A more detailed update will come in the next days, for now, just the download.

ZIP File (790 Kb). Uninstall prior version first! Unzip and install into IDE.

Friday, October 02, 2009 10:23:21 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0]  | 

 

Google AdSense


Delphi Controls for Windows 7 - State Update#

Well, in my last blog post I've asked for your input for getting a preview of WinControls. I am getting pretty well along with the controls and I've wanted to show you a small preview of the Taskbar Windows component.


Download video (WMV, 4MB) here

Watch my blog for the upcoming release of the controls and see them live at the EKON 13 this week!

Sunday, September 27, 2009 10:44:29 PM (W. Europe Standard Time, UTC+01:00) #    Comments [6]  | 

 

Update for the Windows 7 Taskbar Components coming soon#

Currently, I am getting ready to ship an update for the Windows 7 taskbar components. As the preview, this one will be open source and free of charge for anyone to use in any project.

However, one problem still remains to be resolved. I try to get a "screen shot" from a tab sheet, whether it is currently visible or not. The normal Delphi method WinControl.PaintTo, and the Windows API methods PrintWindow and BitBlt do not give the desired results.

What do I need this for? Well consider the image below, showing the tabs of the Internet Explorer, currently opened. Something similar I want to create for Delphi as simple component. To create the preview, I must be able to get the "screen shot" of all Tabcontrols, whether they are visible or not.

I have uploaded a sample application, which demonstrates the problem. Feel free to download and test it. This application runs on Windows XP and Windows Vista as well, as it does not demonstrate the preview windows, but simply the "copy" feature, ehm problem.

Feel free to send me any ideas you have regarding this problem, as all other solutions would not be the best ;)

Download the problem sampler (Source, ZIP-file, 4 KB)

Email any solution to dwischnewski (at) gmail.com

Thank you for your support, I'll mention the solution provider in the finals.

UpdateI got the solution in my Inbox now, thanks to Craig Peterson from Scooter Software, who already has helped me a great bit for this whole problem. I'll finish the components now, await the release for October 1st. Be first to see them at the EKON.

Wednesday, September 16, 2009 3:25:41 PM (W. Europe Standard Time, UTC+01:00) #    Comments [4]  | 

 

Graphic Tablets and Delphi#

During the recent days I was looking for a solution on how to access properties of my Wacom tablet within a Delphi application.

Using the Pen & Ink API of Windows is one possibility, however that offered much more than I needed, not thinking about the time getting into that one as well. On the Delphi-PRAXiS I found a link to Centaurix, a company offering an easy to use Delphi component, which gives me access to the properties I just needed. The component is freeware and comes with source code.

Great!

Download here.

Thursday, February 12, 2009 3:44:39 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0]  | 

 

Windows 7 - Displaying your applications status in the Windows Taskbar#

Today, I show you the second set of screen shots from the Windows 7 Taskbar components. Since Windows 95 - which introduced the last real change in how the user handles multiple running applications on Windows - we all know the notification area. Sadly many programs have abused this area, so that on some users computers this really grow into a monster featuring easily 30 and more icons. Never on my computer though ;-)

Windows 7 stops this Taskbar spamming in a really effictive way. The notification icons will not be shown anymore, at least on default. They are all hidden away. Even when your application wants to show a (bubble) hint, the user will not see it unless the user approved your application first. Now, since sometimes showing a state can be really important, Windows 7 introduced overlay icons in the Taskbar entry for running processes. This way the application can show some information without the need for more screen real estate - the application already has an entry in the Taskbar anyway - at least in most cases.

Click on images to view full size version.

Windows 7 automatically hides all notification icons unless the user wants them to show
Windows 7 automatically hides all notification icons unless the user wants them to show.

Showing the tasks state in the Windows 7 Taskbar
Showing the tasks state in the Windows 7 Taskbar.

Note the overlay icon in the second screen shot. Maybe the application is performing a search. A side effect of this is, that the designers should start creating application icons and overlay icons that work with each other well. Overlay icons are shown only if the user uses large icons in the Windows Taskbar (default setting).

For your Delphi application, simply drop a the TdwOverlayIcon component on your form, connect it to an image list (16 x 16 pixels for bitmap size) and set the image index used. Set it to -1 for displaying no overlay icon.

Saturday, January 24, 2009 1:21:47 PM (W. Europe Standard Time, UTC+01:00) #    Comments [4]  | 

 

Windows 7 - Displaying Progress of a Task in the Windows Taskbar#

You have asked for it, so here are the first images for you. Today I want to show you a few screen shots of displaying the progress of a rather lengthy task in the Windows 7 Taskbar. You should not that Microsoft does not encourage you to use this for shorter tasks which usually finish within a few seconds. But this is up to you in the end ;-)

For all of you Delphi 7 users, the first screen shot shows Delphi 7 running on Windows 7 using those components. So, this works as well.

Click on images to view full size version.

Del phi 7 with Demo app and Windows 7 components
Delphi 7 running on Windows 7. The demo application is loaded in the IDE, the components are shown in the tool palette.

Showing a marquee in the taskbar
The marquee shows a task in progress with undeterminable end - like connecting to a server.

Showing a progressing task
The progress is coming along just fine.

Showing a paused task
The application may be waiting for some user interaction, the current task is paused.

Further, you can cancel a task, coloring the progressbar red as well.

For those of you not knowing Windows 7 just yet and wondering why some application icons have a border in the taskbar and some do not: Windows 7 allows you to pin applications to the taskbar. This way, they will always be in the same order/place. The framed ones are actually running, others are just waiting to be started.

Wednesday, January 21, 2009 12:56:23 PM (W. Europe Standard Time, UTC+01:00) #    Comments [2]  | 

 

Alpha 1 of "Windows 7 Controls for Delphi"#

Well, as written here before, I have toyed around with Windows 7 and created a few Controls that you can simply place on your Form to support some of the most obvious Windows 7 features. Currently available are:

  • Jump Lists - right click your application entry on the taskbar to see those
  • Overlay Icon - show the state of your application right in the taskbar (notification icons are hidden by Windows 7 by default, finally)
  • Progress indicator in the taskbar button
  • Taskbar Thumbnails - you application can be controlled directly from the taskbar preview window

Please note, that if you have Aero turned of, or your Windows 7 is running in a VM, most of the features are not supported by Windows 7 (atm?).

The installer provides packages for Delphi 7, Delphi 2006, Delphi 2007, and Delphi 2009.

Further, those are just the first version in early Alpha State, but they are for free ;-) If you want to use them to create your own controls, those MUST be placed under GPL. For use in your applications you can choose freely between GPL, LPGL and MPL, whatever suits your needs.

In the coming days I'll post a few screen shots and/or short videos demonstrating those controls in action.

If you have suggestions, improvements, or anything else regarding those controls, do not hesitate to contact me ;-)

Download the installer (1,5 MB)

Note: the installer only copies the files to your local hard drive (default folder: User Documents\Delphi Win7 Support). You must open the corresponding project group/package and install it into your Delphi IDE.

Have fun,
Daniel

Tuesday, January 20, 2009 11:53:05 AM (W. Europe Standard Time, UTC+01:00) #    Comments [5]  | 

 

Windows 7 Controls for Delphi#

Probably tomorrow, I will publish my first attempt to create controls tailored towards Windows 7. Naturally, those controls will run on older Systems (tested on XP and Vista), but the new Windows 7 functionality will be available on Windows 7 only, silently failing on older systems.

Currently, I am setting up a VM with Windows XP and Delphi 2006 to test them. Wait a little more and enjoy ;-)

The packages for Delphi 2006, 2007, and 2009 will be included.   

Monday, January 19, 2009 3:57:04 PM (W. Europe Standard Time, UTC+01:00) #    Comments [1]  | 

 

Windows 7 Jump Lists#

During the last days I have taken the time to get familar with Windows 7, at least a little. So far, I do like it, though it is far from stable on my machine at the moment - at least, Windows Vista was better in that respect.

The new Taskbar and the start menu are pretty amazing. I like the feature to show progress and states on it, as well as add buttons to the window preview panes. Also, the Jump Lists are quiet nice, so I started importing those features into Delphi, all available as a small component set. Those will be available soon, with more details about what and how they will work.

However, so far I have seen many sample videos, read quiet a few blog entries on how to program those jump list, but they all habe one thing in common: they are missing the code samples. If you are looking for those samples, download the Windows 7 SDK Beta and look into the installation folder. For me, those are at C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\winui\Shell\JumpList.

Saturday, January 17, 2009 1:55:15 PM (W. Europe Standard Time, UTC+01:00) #    Comments [3]  | 

 

Delphi Win32 Project Localizer#

Well, it is available since about 3 weeks now and I had some feedback already. Now, I would like you guys to take a look at it and let me know what you think. There is a small update in the pipeline, but that is not available yet. A short product description and a video are on the project site: http://www.wischnewski.tv/en/products/dw32pl.html

Start localizing your applications. Demos come with the installer - the product is free for personal and commercial (not governmental) use.

Friday, March 21, 2008 4:26:46 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0]  | 

 

More EKON Spring 2008 Papers#

Since Sebastian Gingter (a moderator of the Delphi-PRAXiS) is not on the Delphi-Feeds list, and he just uploads(!) his papers right now, I am giving you a pointer over to his blog. His papers are on WMI (Windows Management Instrumentation) and Patterns (MVVM), in German, too.

Entries:

Thursday, February 28, 2008 5:54:40 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0]  | 

 

EKON Spring 2008 - Papers Online#

My conference sessions are all done, so the papers are ready for download. Go to my Conference Papers page and download them as you like. They are German only this time.

Thursday, February 28, 2008 5:28:42 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0]  | 

 

The quick brown fox jumps over the lazy dog#

You probably know this text from the built in Windows font preview application.

The quick brown fox jumps over the lazy dog

Well, it is nice to see a font, when you scroll through them. Many applications out there allow to easily few multiple fonts at once. But all free tools I know of lack the possibility to enter your own (unicode) text to review a font. Well, today I needed just that and I let you all use it for free ;-)

It features:

  • Font Size (6 to 128 pt)
  • Bold, Italic, and Underline
  • Quality: default, draft, proof, aliased, non-aliased, and ClearType

Font Review Application
Font Review Application

To get the application, go to the update page.

Tuesday, January 29, 2008 4:40:09 PM (W. Europe Standard Time, UTC+01:00) #    Comments [4]  | 

 

How to retrieve a list of OU Objects and their parents#

One user of the Delphi-PRAXiS asked, how to retrieve a list of either users or computers with the creation date, name and parents name. Since I had those information available, I just thought I post it here as well. Once again, you simple have to query the active directory using ADO. For the parent however, you need to get the object and then query its Parent property.

procedure TYourForm.btnSearchClick(Sender: TObject);
var
  Conn: _Connection;
  Cmd: _Command;
  RS: _Recordset;
  Affected: OleVariant;
  Line: string;
  Obj: IADsUser;
  procedure RunQuery(Query: string);
  begin
    Cmd.CommandText := Query;
    // run query and return domain list
    RS := Cmd.Execute(Affected, EmptyParam, 0);
    if RS.EOF then
      Exit;
      
    RS.MoveFirst;
    while not RS.EOF do
    begin
      try
        Obj := VBGetObject(RS.Fields.Item[1].Value) as IADsUser;
        Line := Format('%s, %s, %s, %s', [RS.Fields.Item[0].Value, RS.Fields.Item[1].Value, RS.Fields.Item[2].Value, Obj.Parent]);
        mmoReport.Lines.Add(Line);
      except
      end;
      RS.MoveNext;
    end;
  end;
begin
  mmoReport.Clear;

  // create objects
  Conn := CoConnection.Create;
  Cmd := CoCommand.Create;
  // setup objects
  Conn.Provider := 'ADsDSOObject';
  Conn.Open('Active Directory Provider', '', '', 0);
  Cmd.Set_ActiveConnection(Conn);
  Cmd.Properties.Item['Page Size'].Value := 1000;
  Cmd.Properties.Item['Searchscope'].Value := ADS_SCOPE_SUBTREE;

  RunQuery(edtQuery.Text);
end;

Once again, the whole sample is available for download (ZIP, 36 Kb).

Monday, October 15, 2007 1:17:13 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0]  | 

 

How to get a list of Domains and Sites#

Someone asked on delphifeeds.com, how to get a list of all domains within an environment. Since I was going to need just the same soon for a application in development right now, I thought I take up the challenge and try my luck. After using Google I found nil solutions using Delphi, so I went to microsoft.com and looked how they do it, using VBScript.

Well, I was lucky and found a solution, but as so often, getting it to work on Delphi is an entirely different task. First you have to find the root naming context of the domain where your application is running. You use the ADs library for that task. From that LDAP-path you replace the prefix with GC, which stands for global catalog.

// get the forest base
try
  DirObj := VBGetObject('LDAP://rootDSE') as IADs;
  Root := (VBGetObject('LDAP://' + DirObj.Get('rootDomainNamingContext')) as IADs).ADsPath;
except
  mmoReport.Lines.Add('Computer is not running in domain setup.');
  Exit;
end;
// replace LDAP with GC (global catalog)
Root := 'GC' + Copy(Root, 5, MaxInt);
mmoReport.Lines.Add(Root);

Next, you query the AD using ADO for the domains or sites, whatever you want. The queries are simple:

Query := 'SELECT Name FROM ' + QuotedStr(Root) + ' WHERE objectCategory=''domain''';
Query := 'SELECT Name FROM ' + QuotedStr(Root) + ' WHERE objectCategory=''site''';

Next, you just iterate the record set, returned after executing your command. A full demo can be downloaded (ZIP, 34 Kb) from my site.

Monday, October 15, 2007 10:48:02 AM (W. Europe Standard Time, UTC+01:00) #    Comments [0]  | 

 

More on Aero-glass and Delphi forms#

Since I just mentioned the Glow Label component for Delphi, I thought I mention a small problem with the glass effect and components placed on areas, where this effect is applied.

The (usually) black parts of the component are not painted correctly, when leaving all settings on default. You have to set the property DoubleBuffered to True, for correct painting of the components. Therefore, I have created a small routine which just does that. Simply pass along the form as parameter, an it will iterate through all controls and set their DoubleBuffer property to True.

procedure DoubleBufferAll(WinControl: TWinControl);
var
  I: Integer;
begin
  if not (WinControl is TBaseVirtualTree) then
    WinControl.DoubleBuffered := True;
  for I := 0 to WinControl.ControlCount - 1 do
    if WinControl.Controls[I] is TWinControl then
      DoubleBufferAll(WinControl.Controls[I] as TWinControl);
end;

Friday, October 12, 2007 1:04:03 PM (W. Europe Standard Time, UTC+01:00) #    Comments [1]  | 

 

Delphi Language - Did you know#

Did you know that all Delphi streams automatically support persisting/loading components, just as the IDE uses it? While looking today how again to persist a component state, I came across the methods WriteComponent and ReadComponent. I honestly never saw those before. Therefore persisting a component into a stream is just one line, when you want to have the data in text form, simply use ObjectBinaryToText and ObjectTextToBinary for the transformations. Great, how easy life can be. This method works fo published properties only, but most often this will do just fine.

// code to stream component state to file
FileStream := TFileStream.Create(Filename, fmCreate); 
BinStream := TMemoryStream.Create;
try
  BinStream.WriteComponent(YourComponent);
  BinStream.Position := 0;
  ObjectBinaryToText(BinStream, FileStream);
finally
  BinStream.Free;
  FileStream.Free;
end;

// code to load component streamed component from file
FileStream := TFileStream.Create(Filename, fmOpenRead);
BinStream := TMemoryStream.Create;
try
  ObjectTextToBinary(FileStream, BinStream);
  BinStream.Position := 0;
  BinStream.ReadComponent(YourComponent);
finally
  BinStream.Free;
  FileStream.Free;
end;

As a note, I am sure, I knew this before as I have done that a few years ago already, but hey, sometimes you just forget and rediscover and you are happy again...

Tuesday, October 09, 2007 4:01:39 PM (W. Europe Standard Time, UTC+01:00) #    Comments [6]  | 

 

Using the MS LogParser for rough statistics#

A few weeks ago, Steve Trefethen published his Blog entry Publishing IIS log file analysis using Microsoft Log Parser, where he outlined how to use the free software MS Log Parser to run a basic analysis of the log files created by IIS. Today I set up my task scheduler to run two basic tasks once a day to generate Summaries on the most read blog entries as well as the top downloaded files from my conference page.

The whole setup process took less than 20 minutes to figure out how to format the query, to create the templates for displaying them within this blog layout and to setup the scheduler tasks. The last task was the "hardest", as you cannot use parameters when using the scheduler interface. After figuring out that problem, I simply created the batch files and pointed the task scheduler to them, which in turn run the queries.

If you like to use those tasks for your DasBlog site, simply install the MS Log Parser on your server and adjust the following calls.

The Top 50 Requested Pages

logparser.exe 
"SELECT TOP 50 
  to_lowercase(cs-uri-stem) as Url, COUNT(cs-uri-stem) AS Hits 
FROM
  D:\LogFiles\W3SVC2106058385\ex*.log 
WHERE 
  (to_lowercase(cs-uri-stem) NOT LIKE '%%captchaimage%%') AND
  ((to_lowercase(cs-uri-stem) = '/blog') OR 
(to_lowercase(cs-uri-stem) = '/blog/default.aspx') OR
(to_lowercase(cs-uri-stem) like '/blog/20%%.aspx')) GROUP BY Url ORDER BY Hits DESC" -o:tpl -tpl "D:\Sites\Blog\Content\Special\mosthits.format.tpl" > "D:\Sites\Blog\Content\Special\mosthits.format.html"

The Downloads-Counter

logparser.exe 
"SELECT TOP 50 
  to_lowercase(cs-uri-stem) as Url, COUNT(cs-uri-stem) AS Hits 
FROM
  D:\LogFiles\W3SVC2106058385\ex*.log 
WHERE
  (to_lowercase(cs-uri-stem) like '/downloads/%%')
GROUP BY 
  Url 
ORDER BY
  Hits DESC"
-o:tpl -tpl "D:\Sites\Blog\Content\Special\downloads.format.tpl" > "D:\Sites\Blog\Content\Special\downloads.format.html"

The .tpl-files are formatted similar to the ones shown in Steve's blog.

Friday, October 05, 2007 12:51:55 PM (W. Europe Standard Time, UTC+01:00) #    Comments [2]  | 

 

EKON 11 - Promised Entry #3#

One of the things promised, which are on the Internet somewhere, but sometimes hard to find, was a code snippet which reliably returns, whether the program is started in administrative mode or not. This piece of code is similar to old known solutions, however under Vista the old version returned the user level, rather than the token under which the program was started. The following code works well under Windows Vista and older systems.

const
  SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority = (Value: (0, 0, 0, 0, 0, 5));
  SECURITY_BUILTIN_DOMAIN_RID = $00000020;
  DOMAIN_ALIAS_RID_ADMINS = $00000220;
  SE_GROUP_ENABLED = $00000004;

function IsAdmin: Boolean;
var
  hAccessToken: THandle;
  ptgGroups: PTokenGroups;
  dwInfoBufferSize: DWORD;
  psidAdministrators: PSID;
  x: Integer;
  bSuccess: BOOL;
begin
  Result   := False;
  bSuccess := OpenThreadToken(GetCurrentThread, TOKEN_QUERY, True, hAccessToken);
  if not bSuccess then
    if GetLastError = ERROR_NO_TOKEN then
      bSuccess := OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, hAccessToken);
  if bSuccess then
  begin
    GetTokenInformation(hAccessToken, TokenGroups, nil, 0, dwInfoBufferSize);
    ptgGroups := GetMemory(dwInfoBufferSize); 
    bSuccess := GetTokenInformation(hAccessToken, TokenGroups, ptgGroups, dwInfoBufferSize, dwInfoBufferSize);
    CloseHandle(hAccessToken);
    if bSuccess then
    begin
      AllocateAndInitializeSid(SECURITY_NT_AUTHORITY, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, psidAdministrators);
      {$R-}
      for x := 0 to ptgGroups.GroupCount - 1 do
      begin
        if (SE_GROUP_ENABLED = (ptgGroups.Groups[x].Attributes and SE_GROUP_ENABLED)) and EqualSid(psidAdministrators, ptgGroups.Groups[x].Sid) then
        begin
          Result := True;
          Break;
        end;
      end;
      {$R+}
      FreeSid(psidAdministrators);
    end;
    FreeMem(ptgGroups);
  end;
end;

Thanks to Olaf for pointing out the insufficient memory problem. Fixed in this sample.

Tuesday, October 02, 2007 10:35:01 AM (W. Europe Standard Time, UTC+01:00) #    Comments [2]  | 

 

EKON 11 - Promised Entry #2#

The downloads are ready, you'll find my conference papers at my new Conference Page. There are no downloads for the CodeCamp session, as this was mainly a session for questions & answers on Delphi, Windows Vista & .NET. However, I have promised a few code snippets on this session, which will appear over the next days on my blog, though not before Tuesday, when I will be in my office next time.      

Saturday, September 29, 2007 5:55:57 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0]  | 

 

EKON Conference Material#

After the Sessions at the EKON I will release the conference materials on my newly created conference page. I do hope that this page will fill over time, but here is a start. My sessions will be on Wednesday, so there is not much sense in going there just now, but I wanted this part to be ready, so here you go.

http://www.gumpi.com/Blog/Special.aspx?=Conferences

Monday, September 24, 2007 2:10:00 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0]  | 

 

All content © 2010, Daniel Wischnewski
On this page
Archives
Promoted Links
Blogroll OPML
My current Flickr Images
www.flickr.com
Dies ist ein Flickr Modul mit �ffentlichen Fotos und Videos von dwischnewski. Ihr eigenes Modul k�nnen Sie hier erstellen.
Recommendations
Sitemap
Special Pages
Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Theme design by Jelle Druyts