Why this happen? is it a bug of mfc9.0

I write a program in vc++ 2008,and i want to make it support multiple
language. so i write a dll with all the resource build in it ,then i use the

function : LoadLibrary to Load the resource dll. last i use
AfxSetResourceHandle(hCurrLanguageInstanceHandle);still now the application
can run.

but when i change the visual style. for example i change the style to office
2007(blue style), the application will stop at line 7 below..

can someone help me. thanks !!!!!!

1 CTagManager tm;
2 if (!tm.LoadFromResource(GetStyleResourceID(m_Style), AFX_RT_STYLE_XML))
3 {
4 #if !defined _AFXDLL
5 TRACE(_T("\r\nImportant: to enable the Office 2007 look in static
6 TRACE(_T("include afxribbon.rc from the RC file in your
8 #endif
9 if (hinstResOld != NULL)
10 {
11 AfxSetResourceHandle(hinstResOld);
12 }
14 return;
15 }