Hi,
I am using VB 2008 .net and i am using uxtheme.dll to access windows XP themes to draw certain items. Unfortunatley there is little of no info I can find with provides a vb.net example for using this dll.
For this program i am trying to get the theme for a button and just draw it to the client rectangle of a form (this is simply to get the dll functions working before i begin to use them for any application).
I have declared 3 of the funcitons from the dll as follows:
Private Declare Auto Function CloseThemeData Lib "uxtheme.dll" (ByVal hTheme As Integer) As Integer
Public Declare Auto Function OpenThemeData Lib "uxtheme.dll" (ByVal hwnd As Integer, ByVal pszClassList As String) As Integer
Private Declare Function DrawThemeBackground Lib "uxtheme.dll" (ByVal hTheme As Integer, ByVal lHDC As Integer, _
ByVal iPartId As Integer, ByVal iStateId As Integer, _
ByVal pRect As Rectangle, ByVal pClipRect As Rectangle) As Integer
In the Paint event of my form I have the following code:
Dim a As Integer
Dim b As Integer
a = OpenThemeData(0, "Button")
b = DrawThemeBackground(a, e.Graphics.GetHdc, 1, 1, Me.ClientRectangle, Me.ClientRectangle)
CloseThemeData(a)
e.Graphics.ReleaseHdc()
The code runs, but the DrawThemeBackground returns a HRESULT of &H8000403 which is i believe is an invalid pointer????
Can anyone guide me to correctly using the above functions?
Many Thanks,
I am using VB 2008 .net and i am using uxtheme.dll to access windows XP themes to draw certain items. Unfortunatley there is little of no info I can find with provides a vb.net example for using this dll.
For this program i am trying to get the theme for a button and just draw it to the client rectangle of a form (this is simply to get the dll functions working before i begin to use them for any application).
I have declared 3 of the funcitons from the dll as follows:
Private Declare Auto Function CloseThemeData Lib "uxtheme.dll" (ByVal hTheme As Integer) As Integer
Public Declare Auto Function OpenThemeData Lib "uxtheme.dll" (ByVal hwnd As Integer, ByVal pszClassList As String) As Integer
Private Declare Function DrawThemeBackground Lib "uxtheme.dll" (ByVal hTheme As Integer, ByVal lHDC As Integer, _
ByVal iPartId As Integer, ByVal iStateId As Integer, _
ByVal pRect As Rectangle, ByVal pClipRect As Rectangle) As Integer
In the Paint event of my form I have the following code:
Dim a As Integer
Dim b As Integer
a = OpenThemeData(0, "Button")
b = DrawThemeBackground(a, e.Graphics.GetHdc, 1, 1, Me.ClientRectangle, Me.ClientRectangle)
CloseThemeData(a)
e.Graphics.ReleaseHdc()
The code runs, but the DrawThemeBackground returns a HRESULT of &H8000403 which is i believe is an invalid pointer????
Can anyone guide me to correctly using the above functions?
Many Thanks,