2009-06-24 43 views
1

我正在写一个使用VB6的Outlook的PropertyPage。这是作为VB6 OCX实现的。XP外观属性页的VB6外观?

当在XP(或更新版本)中运行在较新版本的Outlook(如2007)上时,我的对话框看起来很奇怪,因为它没有XP外观。有没有办法做到这一点?

最好不添加Outlook.exe清单文件。

回答

0

我不认为你可以在VB6中做到这些控件将看起来像他们的样子。但是,您可以使用Visual Studio .NET和Visual Basic .NET创建属性页面,并获得XP,2007和Vista的外观。这与你正在做的事情有点改变,但是你真的支持用VB6开发的时代。关于如何做到这一点的更多细节是hereoffice developer center

+0

好主意。这个特定的客户不想处理在所有端点上安装.NET运行时的麻烦,所以.NET解决方案对我来说没有用处。 – 2009-06-25 04:11:52

0

不,我知道使用VB6

如果您可以使用.NET来代替 - 一种方法是WPF。我在前面看到了一个代码项目的例子。 Here's the link

编辑:而另一工具,以协助here

0

这就是我在所有VB6应用程序中所做的事情,只在独立EXE中进行过测试,因此不确定它是否可以用作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

创建一个类似的文件:http://pastebin.com/f689388b2

然后你的清单文件添加到您的资源文件类型RT_MANIFEST(24)

我不太记得了,如果这就是你所需要的做,因为我现在总是只使用相同的预制.res文件。

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

+1

MSDN文章警告说这种方法可能导致Outlook 2007挂起:http://msdn.microsoft.com/en-us/library/bb176908.aspx – MarkJ 2009-06-24 11:08:05