<p>I have some UI in VB 2005 that looks great in XP Style, but goes hideous in Classic Style.</p>

<p>Any ideas about how to detect which mode the user is in and re-format the forms on the fly?</p>

<hr>

<p>Post Answer Edit:</p>

<p>Thanks Daniel, looks like this will work. I'm using the first solution you posted with the GetCurrentThemeName() function.</p>

<p>I'm doing the following:</p>

<p><strong>Function Declaration:</strong>
  <pre><code> Private Declare Unicode Function GetCurrentThemeName Lib "uxtheme" (ByVal stringThemeName As System.Text.StringBuilder, ByVal lengthThemeName As Integer, ByVal stringColorName As System.Text.StringBuilder, ByVal lengthColorName As Integer, ByVal stringSizeName As System.Text.StringBuilder, ByVal lengthSizeName As Integer) As Int32
</pre></code></p>

<p><strong><em>Code Body:</em></strong>
<pre><code>
Dim stringThemeName As New System.Text.StringBuilder(260)
Dim stringColorName As New System.Text.StringBuilder(260)
Dim stringSizeName As New System.Text.StringBuilder(260)</p>

<p>GetCurrentThemeName(stringThemeName, 260, stringColorName, 260, stringSizeName, 260)
MsgBox(stringThemeName.ToString)
</pre></code></p>

<p>The MessageBox comes up Empty when i'm in Windows Classic Style/theme, and Comes up with "C:\WINDOWS\resources\Themes\luna\luna.msstyles" if it's in Windows XP style/theme. I'll have to do a little more checking to see what happens if the user sets another theme than these two, but shouldn't be a big issue.</p>

[{'answer_id': 34724, 'author': 'Konrad Rudolph', 'author_id': 1968, 'author_profile': 'https://Stackoverflow.com/users/1968', 'pm_score': 0, 'selected': False, 'text': '<p>There\'s the <a href="http://msdn.microsoft.com/en-us/library/bb759813%28VS.85%29.aspx" rel="nofollow noreferrer">IsThemeActive</a> WinAPI function.</p>\n'}, {'answer_id': 34729, 'author': 'Daniel Jennings', 'author_id': 3641, 'author_profile': 'https://Stackoverflow.com/users/3641', 'pm_score': 3, 'selected': True, 'text': '<p>Try using a combination of <a href="http://www.pinvoke.net/default.aspx/uxtheme/GetCurrentThemeName.html" rel="nofollow noreferrer">GetCurrentThemeName</a> (<a href="http://msdn.microsoft.com/en-us/library/bb773365%28VS.85%29.aspx" rel="nofollow noreferrer">MSDN Page</a>) and <a href="http://msdn.microsoft.com/en-us/library/aa969518%28VS.85%29.aspx" rel="nofollow noreferrer">DwmIsCompositionEnabled</a></p>\n\n<p>I linked the first to PInvoke so you can just drop it in your code, and for the second one you can use the code provided in the MSDN comment:</p>\n\n<pre><code>[DllImport("dwmapi.dll", PreserveSig = false)]\npublic static extern bool DwmIsCompositionEnabled();\n</code></pre>\n\n<p>See what results you get out of those two functions; they should be enough to determine when you want to use a different theme!</p>\n'}, {'answer_id': 104081, 'author': 'Richard Morgan', 'author_id': 2258, 'author_profile': 'https://Stackoverflow.com/users/2258', 'pm_score': 1, 'selected': False, 'text': "<p>Personally, I use the following to see if the app is running under themed:</p>\n\n<pre><code>if (Application.RenderWithVisualStyles)\n{\n    // you're themed\n}\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/34712', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3648/']