Hi all!
Has anybody ever worked with XP themes? I mean with uxtheme.dll? I'm just trying to, but even the first call to OpenThemeData function returns 0. I've searched the board, but haven't found something helpfull. I have examples in C++ and VB - everything is working. What's wrong with this:
Resource:
#define IDD_DLG_XP 1000
#define IDC_BTN_XP 1001

IDD_DLG_XP DIALOGEX 6,6,194,102
CAPTION "xpTest"
FONT 8,"MS Sans Serif",400,0
STYLE 0x10CF0000
EXSTYLE 0x00000000
BEGIN
  CONTROL "Click",IDC_BTN_XP,"Button",0x50010000,58,35,76,20,0x00000000
END


Code:
.486
.model flat,stdcall
option casemap:none

include windows.inc
include user32.inc
include kernel32.inc
include comctl32.inc

includelib user32.lib
includelib kernel32.lib
includelib comctl32.lib

DlgProc                        PROTO :HWND,:UINT,:WPARAM,:LPARAM

;xpTest.dlg
IDD_DLG_XP equ 1000
IDC_BTN_XP equ 1001


.data?
hInstance HINSTANCE ?
m_ThemesLib DWORD ?

.data
szXpThemeLib  db  "uxtheme.dll",0
szIsThemeActive  db  "IsThemeActive",0
szOpenThemeData  db  "OpenThemeData",0
szCloseThemeData  db  "CloseThemeData",0
szButton  db  "button",0
szToolbar  db  "toolbar",0
icc  INITCOMMONCONTROLSEX  <sizeof INITCOMMONCONTROLSEX,ICC_USEREX_CLASSES>

.code
start:
invoke InitCommonControlsEx,addr icc
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke LoadLibrary,addr szXpThemeLib
mov m_ThemesLib,eax

invoke DialogBoxParam,hInstance,IDD_DLG_XP,NULL,addr DlgProc,NULL
.if m_ThemesLib
invoke FreeLibrary,m_ThemesLib
.endif
invoke ExitProcess,0

DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

LOCAL hProc :DWORD
LOCAL hTheme :DWORD

.if uMsg==WM_CLOSE
invoke EndDialog,hWnd,NULL
.elseif uMsg==WM_COMMAND
mov eax,wParam
and eax,0FFFFh
.if eax==IDC_BTN_XP
.if m_ThemesLib
invoke GetProcAddress,m_ThemesLib,addr szOpenThemeData
.if eax
mov hProc,eax
push offset szButton
push hWnd
call hProc  ;THIS RETURNS 0!!!!!
.if eax
mov hTheme,eax
invoke GetProcAddress,m_ThemesLib,addr szCloseThemeData
push hTheme
call eax
.endif
.endif
.endif
.else
mov eax,FALSE
ret
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret

DlgProc endp
end start

May be somebody has faced with a question yet?..
Thank you.

Posted on 2006-04-17 07:39:25 by I, lamer
Thanks to all, the problem solved - strings of controls' names ("button" etc) should be in unicode - thanks to ramguru.
Posted on 2006-04-17 09:54:24 by I, lamer