Friday, May 21, 2010

How do you add the windows xp theme to visual basic 6?

I am going crazy I need to know how to do this.


I don't want a link to know how to do it unless it is step by step.


and I don't want any useless comments saying like go buy a book. I really need step by step instructions and on how to do this.


I am running portable eddition

How do you add the windows xp theme to visual basic 6?
Previous answer - stop smoking crack =)





The Windows XP Visual Styles are provided by ComCtl32.dll version 6 or later. (In fact, anyone who is as old as me and remembers back to Visual Basic 3 may find this familiar, since the exciting 3D control look which was provided with Windows 95 was also implemented in the same way). Note that unlike previous versions of this DLL, version 6 is not redistributable - which sadly means you can only use the visual styles on an operating system that has this version installed.





Link to ComCtl first





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 = %26amp;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





You also will need a manifest file for it.





%26lt;?xml version="1.0" encoding="UTF-8" standalone="yes" ?%26gt;


%26lt;assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"%26gt;


%26lt;assemblyIdentity


version="1.0.0.0"


processorArchitecture="X86"


name="CompanyName.ProductName.YourAppNam...


type="win32" /%26gt;


%26lt;description%26gt;Your application description here%26lt;/description%26gt;


%26lt;dependency%26gt;


%26lt;dependentAssembly%26gt;


%26lt;assemblyIdentity


type="win32"


name="Microsoft.Windows.Common-Controls"


version="6.0.0.0"


processorArchitecture="X86"


publicKeyToken="6595b64144ccf1df"


language="*" /%26gt;


%26lt;/dependentAssembly%26gt;


%26lt;/dependency%26gt;


%26lt;/assembly%26gt;
Reply:The answer is simple. You don't.





All the stuff on the inside of the form is rendered in the VB6 runtime library, which cannot be modified. That means ALL visual objects. Certain elements (title bar, window extremities) will adjust to pick up the modifications in XP or Vista, but most of them will not change.





This was by design, likely to prevent having to slightly adjust form elements for each different OS.


No comments:

Post a Comment