{{tag>category:"OpenInsight 32-Bit" author:"Colin Rule" author:"[url=http://www.sprezzatura.com]The Sprezzatura Group[/url]"}} [[https://www.revelation.com/the-works|Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community]] ==== SetWindowTheme (OpenInsight 32-Bit) ==== === At 20 JAN 2010 05:47:08PM Colin Rule wrote: === I have used SetWindowTheme to override the theme of a tab control so that the background colour of the form displays properly through the control. This however fails on Windows 2000, for some obscure reason, which I beleive to be a issue with the DLL, which is declared as: UXTHEME INT STDCALL SetWindowTheme( HANDLE, LPWSTR, LPWSTR ) Anyone have any idea about this. If not, is there any way to determine the Windows version so I can bypass this code if the Workstation is Windows 2000? Colin ---- === At 20 JAN 2010 09:03PM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote: === Colin, SetWindowTheme() is not part of Windows 2000. It was introduced in Windows XP in UxTheme.dll which itself was new in Windows XP as well. Checking for the windows version is not the recommended way of checking if a DLL supports a function. The best way is to load the DLL yourself (via LoadLibrary API call) and use the GetProcAddress() function in Kernel.dll to attempt to get it's address. If this fails then you know the function you want isn't on your OS. This approach is used because Service Packs can add DLLs without changing the Windows version. e.g. .bpPre { font-family:Consolas,Courier New,Courier,Verdana,Arial; font-size:10pt; background-color:#FEFEFE; color:#000000; border:1px solid #7389AE; padding:10px 20px; margin:0px 10px auto; } .bpComment { font-style:italic; color:#008000; } .bpDirective { color:#808000; } .bpKeyword { color:#0000FF; } .bpNumber { color:#800000; } .bpString { color:#008080; } .bpSymbol { color:#800040; } .bpSysVar { color:#8000FF; } .bpDebug { font-size:12pt; font-weight:bold; color:#FF0000; } .bpDict { color:#FF8000; } .bpLabel { font-size:11pt; font-weight:bold; } .bpLineNo { font-family:Courier New, Courier, monospace; color:#808080; background-color:#F5F5F5; } compile function zz_Verify_API( dllName, funcName ) /* Author : Captain C, USS Sprezzatura NZZ-1701 Date : 21 Jan 2010 (thought I'd have a house on the moon by now!) Purpose : Function to check if an API function is installed on an OS Comments ======== Uses the following two functions from Kernel DLL which need to be prototyped first: HANDLE STDCALL LoadLibraryA( LPASTR ) as LoadLibrary LPVOID STDCALL GetProcAddress( HANDLE, LPASTR ) Arguments ========= dllName - Name of the DLL that contains the function funcName - Name of the function to test for. Case-Sensitive! Returns ======= TRUE$ if the function exists, FALSE$ otherwise$ Amended Date Reason ======= ==== ====== */ declare function LoadLibrary, GetProcAddress $insert logical If Assigned( dllName ) Else dllName = "" If Assigned( funcName ) Else funcName = "" isAPI = FALSE$ hLib = LoadLibrary( dllName ) If ( hLib # 0 ) Then pFunc = GetProcAddress( hLib, funcName ) isAPI = ( pFunc # 0 ) End return isAPI FYI - you can use the first field in the SYSTEM VERSION property to check the Windows version. Windows 2000 is 5.0 Windows XP is 5.1 Windows Vista is 6.0 Windows 7 is 6.1 (For more information on versioning check [url=http://en.wikipedia.org/wiki/Windows_NT]here[/url]) [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] [url=http://www.sprezzatura.com/blog]The Sprezzatura Blog[/url] [i]World leaders in all things RevSoft[/i] [img]http://www.sprezzatura.com/zz.gif[/img] ---- === At 21 JAN 2010 02:35AM Colin Rule wrote: === Thanks guys, looks good. I will implement and see what happens. Colin [[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=WORKS_READ&SUMMARY=1&KEY=64E1503BE6E5AA59852576B1007D2A89|View this thread on the Works forum...]]