all groups > dotnet interop > july 2006 >
You're in the

dotnet interop

group:

C# and activex


C# and activex Valentino Ricci
7/26/2006 5:12:02 AM
dotnet interop:
I've an ActiveX made using MFC that has a method that shows a modeless dialog
box containing a Tree control (SysTreeView32).
This ActiveX is used inside a C++ MFC application and it works fine.
When I use this ActiveX inside a C# application the bitmaps associated to
each item belonging to the tree are not shown.
What can I do?
Re: C# and activex Dmytro Lapshyn [MVP]
7/27/2006 12:00:00 AM
Hi,

How exactly the ActiveX loads those bitmaps? Are they an embedded resource
in the ActiveX DLL?

--
Regards,
Dmytro Lapshyn [MVP]
http://blogs.vbcity.com/DmytroL

"Valentino Ricci" <Valentino Ricci@discussions.microsoft.com> wrote in
message news:7E76082E-B35D-4786-81B0-6D80F674D382@microsoft.com...
[quoted text, click to view]
Re: C# and activex Valentino Ricci
7/27/2006 2:46:02 AM
Bitmaps are embedded inside the rc file.

To give you more informations I include part of the code I use:

BOOL CDlgLayerTree::OnInitDialog()
{
CDialog::OnInitDialog();

m_ShowLayer.LoadBitmap(IDB_SHOWLAYER);
m_HideLayer.LoadBitmap(IDB_HIDELAYER);
m_DiscardLayer.LoadBitmap(IDB_DISCARDLAYER);
m_ImageList.Create(12, 18, ILC_COLOR32, 0, 4);
m_ImageList.Add(&m_DiscardLayer, RGB(0, 0, 0));
m_ImageList.Add(&m_HideLayer, RGB(0, 0, 0));
m_ImageList.Add(&m_ShowLayer, RGB(0, 0, 0));
m_LayerTreeCtrl.SetImageList(&m_ImageList, TVSIL_NORMAL);

....

return TRUE;
}

HTREEITEM CDlgLayerTree::AddTreeLayer(CLayer* Layer, HTREEITEM hParent,
HTREEITEM hInsertAfter)
{
...

HTREEITEM root = NULL;
CString descr = Layer->GetDescription();

if (Layer->IsShownInLayerTree())
{
TVINSERTSTRUCT tvInsert;
tvInsert.hParent = hParent;
tvInsert.hInsertAfter = hInsertAfter;
tvInsert.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE |
TVIF_SELECTEDIMAGE;
tvInsert.item.pszText = (LPSTR)(LPCTSTR)descr;
enum State ItemState = Layer->GetCurrentVisibility();
int ItemImage = ( (ItemState == layerShown) ? 2 :
(ItemState == layerHidden) ? 1 : 0);
tvInsert.item.iImage = ItemImage;
tvInsert.item.iSelectedImage = ItemImage;
tvInsert.item.lParam = (LPARAM)Layer;

root = m_LayerTreeCtrl.InsertItem(&tvInsert);

...
}
return root;
}


[quoted text, click to view]
Re: C# and activex Valentino Ricci
7/27/2006 6:11:01 AM
I made this check.
I saw that the attributes m_ShowLayer and so on contained a valid value for
the HBITMAP and that also m_ImageList seems to have a good value.
I also saw that SetImageList returns 0x000000c0.

All seems to work fine but finally bitmaps are not shown.

Below I also attach the debug output window result:
Loaded 'C:\Test\Phoenix\Phoenix\MapViewer\bin\Debug\MapViewer.exe', no
matching symbolic information found.
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\mscoree.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\EntAPI.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\psapi.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\netapi32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll', no
matching symbolic information found.
Loaded
'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd\msvcr80.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shell32.dll', no matching symbolic information
found.
Loaded
'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comctl32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Culture.dll', no
matching symbolic information found.
Loaded
'C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\91903202640a844e88a642aded7aec78\mscorlib.ni.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\uxtheme.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\MSCTF.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll', no
matching symbolic information found.
Loaded
'C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System\c57ac9784c24b049aed0f8654cb9af5f\System.ni.dll', no matching symbolic information found.
Loaded
'C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Drawing\9b03b8c80b98d54292de541fbd439c0f\System.Drawing.ni.dll',
no matching symbolic information found.
Loaded
'C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Windows.Forms\468f9b1529a55545b5021b5aa2c7dc1a\System.Windows.Forms.ni.dll',
no matching symbolic information found.
Loaded
'C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Configuration\75be31408031da43a281605ad0c1e65e\System.Configuration.ni.dll',
no matching symbolic information found.
Loaded
'C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Xml\d61cb4ca3a322049ad7a54145b62637a\System.Xml.ni.dll', no matching symbolic information found.
Loaded 'APP01.EXE', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rsaenh.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorsec.dll', no
matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wintrust.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\crypt32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\msasn1.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\imagehlp.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\riched20.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\softpub.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\xpsp2res.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\userenv.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\secur32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\netapi32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\cryptnet.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\wldap32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\winhttp.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\sensapi.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\ws2_32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\ws2help.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\mswsock.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\hnetcfg.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\wshtcpip.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\rasapi32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\rasman.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\tapi32.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\rtutils.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\winmm.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\msv1_0.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\iphlpapi.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\dnsapi.dll', no matching symbolic information
found.
Loaded 'C:\WINDOWS\system32\rasadhlp.dll', no matching symbolic information
found.
The thread 0xAB8 has exited with code 11001 (0x2AF9).
The thread 0x1518 has exited with code 0 (0x0).
Loaded
'C:\WINDOWS\assembly\GAC\Infragistics.Win.UltraWinToolbars.v2\2.0.5000.32__7dd5c3163f2cd0cb\Infragistics.Win.UltraWinToolbars.v2.dll',
no matching symbolic information found.
Loaded 'APP02.EXE', no matching symbolic information found.
Loaded
Re: C# and activex Dmytro Lapshyn [MVP]
7/27/2006 2:39:43 PM
OK, can you compile a debuggable version of the ActiveX, attach the debugger
to the client app and step through the code in debugger to see what fails
when the ActiveX is instantiated in a C# application?

--
Regards,
Dmytro Lapshyn [MVP]
http://blogs.vbcity.com/DmytroL

"Valentino Ricci" <ValentinoRicci@discussions.microsoft.com> wrote in
message news:41CC6673-7E17-43C6-8E59-C8FB1F391F1F@microsoft.com...
[quoted text, click to view]
Re: C# and activex Valentino Ricci
8/28/2006 5:42:02 AM
Still here after holidays...

I also see that the TreeView aspect is different if I run the activeX from
An MFC application and a C# application.....

[quoted text, click to view]
AddThis Social Bookmark Button