A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

XP Themes in Delphi 2009 Add-in



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 19th 09, 12:45 AM posted to microsoft.public.outlook.program_addins
Slava Barouline
external usenet poster
 
Posts: 15
Default XP Themes in Delphi 2009 Add-in

Hi

I am trying to move to Delphi 2009 my exisitng Add-in written in Delphi
2006 - to support unicode.

There was a hack in Controls.pas to make Message boxes support XP Themes,
but I cannot make it work for Delphi 2009 though I do the same changes for
Delphi 2009 Controls.pas.

procedure TWinControl.CreateHandle;
var
I: Integer;

//new code
Buffer : array[0..MAX_PATH] of Char;
act : TActCTXA;
bContextActivated : boolean ;
m_hActCtx : THANDLE ;
Cookie : Pointer ;
err : integer;

begin
if FHandle = 0 then
begin

//new code
m_hActCtx:=0;
bContextActivated:=false;
//Windows XP and up
if (Win32Platform = VER_PLATFORM_WIN32_NT) and
((Win32MajorVersion 5) or ((Win32MajorVersion = 5) and
(Win32MinorVersion = 1)))
then begin
if GetModuleFileName(0, Buffer, SizeOf(Buffer)) 0 then begin
//hosting exe (outlook.exe)
ZeroMemory(@act, SizeOf(act));
act.dwFlags := ACTCTX_FLAG_RESOURCE_NAME_VALID or
ACTCTX_FLAG_HMODULE_VALID;
act.lpResourceName := MAKEINTRESOURCE(2); //there must be a manifest
resource in the dll
act.cbSize := sizeof(act);
act.lpSource := Buffer;
act.hModule:=HInstance;
m_hActCtx := CreateActCtxA(act);
if (m_hActCtx 0) then begin
bContextActivated:=ActivateActCtx(m_hActCtx, Cookie);
if not bContextActivated then begin
err:=GetLastError;
if err = 0 then;
end;
end;
end;
end;
try

//old code
CreateWnd;
SetProp(FHandle, MakeIntAtom(ControlAtom), THandle(Self));
SetProp(FHandle, MakeIntAtom(WindowAtom), THandle(Self));
if Parent nil then
SetWindowPos(FHandle, Parent.PrecedingWindow(Self), 0, 0, 0, 0,
SWP_NOMOVE + SWP_NOSIZE + SWP_NOACTIVATE);
for I := 0 to ControlCount - 1 do
Controls[i].UpdateAnchorRules;
//end old code

finally
if bContextActivated then DeactivateActCtx(0, Cookie);
if m_hActCtx 0 then ReleaseActCtx(m_hActCtx);
end;
end;
end;

I was wondering if somebody already has done it.

I would appretiate some help here.

Thanks


Ads
  #2  
Old May 19th 09, 04:16 AM posted to microsoft.public.outlook.program_addins
Slava Barouline
external usenet poster
 
Posts: 15
Default XP Themes in Delphi 2009 Add-in - solved

I have done a similar hack in Controls.pas and it works OK with message
boxes

procedure TWinControl.CreateHandle;
var
I: Integer;
//
Buffer : array[0..MAX_PATH] of Char;
act : TActCTXA;
bContextActivated : boolean ;
m_hActCtx : THANDLE ;
Cookie : Pointer ;
err : integer;
begin
if WindowHandle = 0 then
begin
//
m_hActCtx:=0;
bContextActivated:=false;
//Windows XP and up
if (Win32Platform = VER_PLATFORM_WIN32_NT) and
((Win32MajorVersion 5) or ((Win32MajorVersion = 5) and
(Win32MinorVersion = 1)))
then begin
if GetModuleFileName(0, Buffer, SizeOf(Buffer)) 0 then begin
//hosting exe (outlook.exe)
ZeroMemory(@act, SizeOf(act));
act.dwFlags := ACTCTX_FLAG_RESOURCE_NAME_VALID or
ACTCTX_FLAG_HMODULE_VALID;
act.lpResourceName := PAnsiChar(AnsiChar(MAKEINTRESOURCE(2)));
//there must be a manifest resource in the dll
act.cbSize := sizeof(act);
act.lpSource := PAnsiChar(AnsiString(Buffer));
act.hModule:=HInstance;
m_hActCtx := CreateActCtxA(act);
if (m_hActCtx 0) then begin
bContextActivated:=ActivateActCtx(m_hActCtx, Cookie);
if not bContextActivated then begin
err:=GetLastError;
if err = 0 then;
end;
end;
end;
end;
try
//old code

CreateWnd;
{$IF NOT DEFINED(CLR)}
SetProp(FHandle, MakeIntAtom(ControlAtom), THandle(Self));
SetProp(FHandle, MakeIntAtom(WindowAtom), THandle(Self));
{$IFEND}
if Parent nil then
SetWindowPos(WindowHandle, Parent.PrecedingWindow(Self), 0, 0, 0, 0,
SWP_NOMOVE + SWP_NOSIZE + SWP_NOACTIVATE);
for I := 0 to ControlCount - 1 do
Controls[i].UpdateAnchorRules;

//end old code
finally
if bContextActivated then DeactivateActCtx(0, Cookie);
if m_hActCtx 0 then ReleaseActCtx(m_hActCtx);
end;

end;
end;

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedding Images in Outlook email via Delphi Rudy Hentzen Outlook and VBA 0 December 1st 08 08:36 AM
Trapping RDO (Redemption) Events in Delphi Andrew Lockwood Outlook and VBA 12 November 6th 08 12:17 AM
Stationery- Themes Nicholas Outlook - Installation 5 August 19th 08 04:32 AM
Outlook 2007 Web Themes not available Gberdan Outlook - Installation 1 February 24th 07 09:07 AM
themes or stationery sallyanne Outlook - General Queries 1 February 15th 07 05:49 PM


All times are GMT +1. The time now is 06:13 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.