winapi - MS Excel SDK issue: Can't use ToolTip in Tree-View control in XLL add-in -


i have dialog window tree-view control user can drag items rearrange tree.

it looks , behaves differently when used in executable , in ms excel add-in xll.

it looks during drag operation when used in executable(this desired look):

enter image description here

but when use same dialog in ms excel add-in xll(where displayed when user selects command) looks this(notice missing tooltip, , icons expanded items):

enter image description here

what causing this? there way can make dialog way when used in executable?


i suspect has comctl32.dll version, following returns version 6.16 when called executable, 5.82 when called xll:

hinstance hinstdll = loadlibrary(lpszdllname); dllgetversionproc pdllgetversion =     (dllgetversionproc)getprocaddress(hinstdll, "dllgetversion"); 

i have following manifest in .cpp file.

#include <commctrl.h> #pragma comment(lib, "comctl32.lib")  // enable visual style #if defined _m_ix86 #pragma comment(linker,"/manifestdependency:\"type='win32' name='microsoft.windows.common-controls' version='6.0.0.0' processorarchitecture='x86' publickeytoken='6595b64144ccf1df' language='*'\"") #elif defined _m_ia64 #pragma comment(linker,"/manifestdependency:\"type='win32' name='microsoft.windows.common-controls' version='6.0.0.0' processorarchitecture='ia64' publickeytoken='6595b64144ccf1df' language='*'\"") #elif defined _m_x64 #pragma comment(linker,"/manifestdependency:\"type='win32' name='microsoft.windows.common-controls' version='6.0.0.0' processorarchitecture='amd64' publickeytoken='6595b64144ccf1df' language='*'\"") #else #pragma comment(linker,"/manifestdependency:\"type='win32' name='microsoft.windows.common-controls' version='6.0.0.0' processorarchitecture='*' publickeytoken='6595b64144ccf1df' language='*'\"") #endif 

if in dll have resource of type rt_manifest name isolationaware_manifest_resource_id (note exe need use createprocess_manifest_resource_id) loader create activation context our dll (and save in ldr_data_table_entry.entrypointactivationcontext) activate before call our dll entry point, , deactivate after return. - in process have many dlls - dll need activate context ? system activate activation context exe only. , dll - temporary, during call entry point. need use activation context (from our dll) during create window etc.

so strategy next:

get , save our activation context on dll_process_attach:

// global variables handle g_hactctx; boolean g_bactctxvalid;  case dll_process_attach:     //...     g_bactctxvalid = getcurrentactctx(&g_hactctx) != false;     //... 

when need create window, dialog, etc - need activate saved context:

ulong_ptr cookie; if (activateactctx(g_hactctx, &cookie)) {     createwindowexw(..);     deactivateactctx(0, cookie); } 

and finally, on dll unload - release context:

case dll_process_detach:     if (g_bactctxvalid)releaseactctx(g_hactctx); 

note not once answered here - example. 1 difference - in other solutions used createactctx api (with dwflags = actctx_flag_hmodule_valid | actctx_flag_resource_name_valid, lpresourcename = isolationaware_manifest_resource_id, hmodule = &__imagebase) - call create activation context again our dll. instead prefer use created system activation context our dll (this current context inside dllmain). not duplicate, reference created. getcurrentactctx instead createactctx


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -