jm.
jm.

Reputation: 23734

XP Look-and-feel for VB6 Outlook Property Page?

I am writing a PropertyPage for Outlook using VB6. This is implemented as a VB6 OCX.

When running in a newer version of Outlook (like 2007) on XP (or newer), my dialog looks weird because it doesn't have XP look and feel. Is there a way to do this?

Preferably without adding a manifest file for Outlook.exe.

Upvotes: 1

Views: 653

Answers (4)

Adam Dempsey
Adam Dempsey

Reputation: 2962

This is what I do in all of my VB6 Apps, only ever tested in a standalone EXE so not sure if it will work as an OCX.

Private Type tagInitCommonControlsEx
   lngSize As Long
   lngICC As Long
End Type
Private Declare Function InitCommonControlsEx Lib "comctl32.dll" _
   (iccex As tagInitCommonControlsEx) As Boolean
Private Const ICC_USEREX_CLASSES = &H200

Public Function InitCommonControlsVB() As Boolean
   On Error Resume Next
   Dim iccex As tagInitCommonControlsEx
   ' Ensure CC available:
   With iccex
       .lngSize = LenB(iccex)
       .lngICC = ICC_USEREX_CLASSES
   End With
   InitCommonControlsEx iccex
   InitCommonControlsVB = (Err.Number = 0)
   On Error Goto 0
End Function

Public Sub Main()
   InitCommonControlsVB

   '   
   ' Start your application here:
   ' 

End Sub

Create a file similar to this: http://pastebin.com/f689388b2

Then you add the manifest file to your resource file as type RT_MANIFEST (24)

I can't quite remember if that's all you need to do as I always just use the same pre-made .res file now.

Source: http://www.vbaccelerator.com/home/vb/code/libraries/XP_Visual_Styles/Using_XP_Visual_Styles_in_VB/article.asp

Upvotes: 0

MarkJ
MarkJ

Reputation: 30408

I think you're right to avoid using a manifest. Unfortunately the standard well-known hacks to support XP themes from VB6 rely on manifests. This MSDN article on developer solutions for Outlook 2007 warns that providing your own manifest for Outlook 2007 might cause it to hang.

Upvotes: 1

McAden
McAden

Reputation: 13970

Not that I know of using VB6

If you can use .NET instead - one way is WPF. I saw earlier an example on code-project. Here's the link

Edit: And another tool to assist here

Upvotes: 0

JP Alioto
JP Alioto

Reputation: 45127

I don't think you can do it in VB6 ... those controls are going to look like what they look like. You can, however, create your property pages with Visual Studio .NET and Visual Basic .NET and get the XP, 2007 and Vista look and feel. It's a bit of a change from what you're doing, but you're really behind the times developing with VB6 anyway. More details on how to do that are here and the office developer center.

Upvotes: 0

Related Questions