![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
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 |