|
I was running into great problems in attempting to compile a project with an IE Toolbar in once I had added the IInputObject interface (so that it could receive user input).
Upon adding the relevant lines, compiler produces errors:
error C2787: 'IInputObject' : no GUID has been associated with this object
error C2440: 'initializing' : cannot convert from 'unsigned long' to 'const struct _GUID *'
I have now got it to work by specifying _ATL_NO_UUIDOF in build settings as specified in MSDN docs on COM_INTERFACE_ENTRY Macros.
However, I not sure why this happening - I have other MSDN samples which do not require this - so if anyone can shed any light on what's going on I would be interested.
James
|
|
|
|
|
The errors you are getting are because the compiler can't find the defined interface. You are probably missing a #include that is neccessary, try inserting #include <comdef.h> into your stdafx.h and recompile. If that doesn't solve the problem then add #include <shlobj.h> into your stdafx.h header file and recompile.
The first option should do the fix since that is where the GUID is defined for IInputObject.
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|
|
Is there any easy example out,
placing a dialog resource in the bar ?
Or placing other controlls like buttons & co ?
Everything is working but I have no CWnd Class
for adding Buttons/ListBoxes & Co ...
|
|
|
|
|
I'm trying to add another toolbar to IE 5 using this wizard,
I tried creating a TOOLBARCLASSNAME window class in the RegisterAndCreateWindow function
m_hWnd= ::CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
WS_CHILDWINDOW|WS_VISIBLE|TBSTYLE_TRANSPARENT|TBSTYLE_LIST|TBSTYLE_FLAT|TBSTYLE_TOOLTIPS|CCS_NODIVIDER|CCS_TOP, 0,0,0,0, m_hWndParent, NULL, g_hInst, NULL);
MoveWindow(m_hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE);
However instead of drawing the toolbar in the newly created band, it draws it over the top most band. I've tried various methods of moving the toolbar window but it always seems to want to draw itself over the IE menu bar.
if i use the default static control it is drawn in the correct place,
Any suggestions?
Michael
|
|
|
|
|
That threw me for a loop as well
Everything other than "STATIC" would be possitioned at 0,0 - right over the IE menu band.
I ended up creating my own WTL::CToolBar superclassed window based on Erik Thompson's other cool wizard "CWindowImpl ATL Object Wizard" & everything worked fine.
My RegisterAndCreateWindow() now looks something like this....
{
RECT rcParent = {0};
::GetClientRect(m_hWndParent, &rcParent);
rcParent.right = rcParent.right - rcParent.left;
rcParent.bottom = rcParent.bottom - rcParent.top;
DWORD dwWinStyles = WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN;
DWORD dwTabStyles = TBSTYLE_TRANSPARENT|TBSTYLE_LIST|TBSTYLE_FLAT|TBSTYLE_TOOLTIPS;
DWORD dwCmnCtrl = CCS_NODIVIDER|CCS_NORESIZE|CCS_TOP;
// m_ToolBarWnd is a member of type "class CToolBarWnd : public CWindowImpl<CToolBarWnd, WTL::CToolBarCtrl>"
m_hWnd = m_ToolBarWnd.Create( m_hWndParent, rcParent, NULL, dwWinStyles | dwTabStyles | dwCmnCtrl );
return ::IsWindow(m_hWnd);
}
Tip #1 - don't forget to call your CToolBar's SetButtonStructSize() member - or you won't be able to add buttons.
Tip #2 - CToolBar::SetNotifyWnd(HWND) - use this to set which window gets the button clicks & other toolbar notifications ( only if you actually want to do something when a button is clicked )
|
|
|
|
|
Thanks for the assistance. It works fine now.
Michael
|
|
|
|
|
Can please post some detail example source code ?
by tramanan
|
|
|
|
|
The methodes SetNotifyWnd & SetButtonStructSize doesn't work.
i tried through Erik Thompson's CWindowImpl wizard .
it seems not working !
by
Max
|
|
|
|
|
The methodes SetNotifyWnd & SetButtonStructSize doesn't work.
i tried through Erik Thompson's CWindowImpl wizard .
it seems not working !
by
Max
|
|
|
|
|
Hi any help is appreciated.
Using the wizard I have created two separate band dll's.
Issues I am having are :
1.) When showing the bands if one is present the new band is hidden beneath the band all ready visbile.
Any ideas on where to look for a why to this?
2. When setting the size members of a band with a DBIF_VIEWMODE_FLOATING view mode in GetBandInfo() (Shown Below) I do not get what I expect for the size set.
=========//Start code snippet
STDMETHODIMP CFSrvDeskBand::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO* pdbi)
{
...
switch(dwViewMode)
{
...
// The band object is being displayed in a floating band.
case DBIF_VIEWMODE_FLOATING :
if (pdbi->dwMask & DBIM_MINSIZE)
{
pdbi->ptMinSize.x = 400;
pdbi->ptMinSize.y = 34;
}
if (pdbi->dwMask & DBIM_MAXSIZE)
{
pdbi->ptMaxSize.x = 0; // ignored
pdbi->ptMaxSize.y = 34; // max height Used this entry and -1L (for no max)
}
if (pdbi->dwMask & DBIM_ACTUAL)
{
pdbi->ptActual.x = 400;
pdbi->ptActual.y = 34 ;
}
break;
...
}//end switch
...
}//end GetBandInfo
=========//End code snippet
With the code above I *assumed* I would get a window with a 'x' or Width of 400 and 'y' or Height of 34.
What I do get is 'x' or Width of 34 and 'y' or Height of 400 when the ptMaxSize.y is -1L and a 34 x 400 when set as above.
I have switched the entries and this does make a difference but not what I would expect as the end result.
Am I missing something in the code above that would cause this problem?
All suggestions/help welcome.
TIA,
Eric Evans
Systems Programmer
CCG Systems Inc.
|
|
|
|
|
Hi I am developing a deskband and have installed the RBDeskBand wizard. And it work great, espcially compared to the MSJ and MSDN examples on deskbands.
But I have a problem in the development process.
I compile and then call regsvr32 on the dll to test it, then when I have to make some changes I first call regsvr32 /u MyBands.dll to remove it from the Toolbars popup menu. But when I recompile VC can't link because the OS has a lock on the MyBands.dll file.
How do I force the OS not to lock this file so I don't have to reboot each time I compile ?
-Jan
|
|
|
|
|
Jan,
First the reason for the problem. Deskbands once loaded are loaded for the life of the user session. The only way to unload it is to log off and log back on or reboot, if you don't know some tricks.
There are a couple of ways you can work around this when trying to develop a deskband. First workaround is to register it initially for debug purposes as a Communications band and do all your debug work within Interent Explorer. The second way is to kill the explorer.exe process in taskmanager before recompiling. If the explorer.exe process does not automatically restart, from the File|New Task menu item in Task Manager you can restart the explorer process yourself.
These are the 2 workarounds that I use when developing deskbands that don't resort to rebooting or logging off.
-Erik
|
|
|
|
|
Not entirely true. If you close down all instances of Internet Explorer and recompile, it works. I've tried this successfully on Windows 98 and Windows 2000, despite IE being part of the shell. See, only the IE control exposing IWebBrowser2 is loaded into the shell. The IE container is what enumerates the IDeskBand objects. If you close down all instances of the container, you should be okay.
This is using both IE5 and IE6b.
---
Heath Stewart
Systems Administrator / Developer
EsotericRealm / Palisade Systems
http://www.esotericrealm.com/~hstewart
|
|
|
|
|
Forgot to mention, what I typed above is only valid if you created an instance of your control in Internet Explorer. If you did it via Windows Explorer, then Erik is right. It's better, therefore, to just test your desk band in Internet Explorer. It uses a separate container than Windows Explorer, although both enumerate IDeskBand objects and can host them via IObjectWithSite.
---
Heath Stewart
Systems Administrator / Developer
EsotericRealm / Palisade Systems
http://www.esotericrealm.com/~hstewart
|
|
|
|
|
How can i take the view that i get from the wizard and take turn it into html file or url?
anybody?
|
|
|
|
|
I have added a sample project that contains a CWindowImpl class called CHTMLPageWnd. This class creates a HTML control in the window and loads a HTML page from a resource within the component. It does nothing fancy but provide a starting point for you to continue with your endeavors.
Hosted Web page resource
Cheers,
-Erik
|
|
|
|
|
hi,
thanks again..
Finally I installed Band Object in my IE.
But I can't clean the registry with DllUnregisterServer().
After I do this.. "Regsvr32 /u MyBand.dll"
there remains a key in my registry.
I think Category manager function below doesn't work properly.
....pcr->UnRegisterClassImplCategories(CLSID_Band, 1, &(CATID)CATID_InfoBand);
Can I use RGS file instead of Category manager function?
Anyway my buggy code is as follows.
-> This is what's left in my registry after DllUnregisterServer().
....HKEY_CLASSES_ROOT\CLSID\{06C8BE74-6666-4A8F-9D9F-A4B472FE3A3B}\
..........Implemented Categories
-> And here's my DllUnregisterServer() code.
STDAPI DllUnregisterServer(void)
{
...CoInitialize(NULL);
...ICatRegister* pcr = NULL;
...HRESULT hr = CoCreateInstance (CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister,(LPVOID*) &pcr);
...if(SUCCEEDED(hr) && pcr)
...{
......// CATID_CommBand, CATID_InfoBand, or CATID_DeskBand
......hr = pcr->UnRegisterClassImplCategories(CLSID_Band, 1, &(CATID)CATID_InfoBand);
......pcr->Release();
...}
...CoUninitialize();
#ifdef _MERGE_PROXYSTUB
...PrxDllUnregisterServer();
#endif
...hr = _Module.UnregisterServer(TRUE);
...return hr;
#include "Band.h"
}
-> This is my DllRegisterServer() and the result in my registry.
STDAPI DllRegisterServer(void)
{
#ifdef _MERGE_PROXYSTUB
...HRESULT hRes = PrxDllRegisterServer();
...if (FAILED(hRes))
......return hRes;
#endif
..._Module.RegisterServer(TRUE);
...CoInitialize(NULL);
...ICatRegister* pcr = NULL;
...HRESULT hr = CoCreateInstance (CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister,(LPVOID*) &pcr);
...if(SUCCEEDED(hr) && pcr)
...{
......// CATID_CommBand, CATID_InfoBand, or CATID_DeskBand
......hr = pcr->RegisterClassImplCategories(CLSID_Band, 1, &(CATID)CATID_InfoBand);
......pcr->Release();
...}
...CoUninitialize();
...return SUCCEEDED(hr);
}
....HKCR\CLSID\{06C8BE74-6666-4A8F-9D9F-A4B472FE3A3B}
.........Implemented Categories{00021493-0000-0000-C000-000000000046}
.........InprocServer32
.........ProgID
.........Programmable
.........TypeLib
.........VersionIndependentProgID
|
|
|
|
|
hwan,
Yes I know there are problems. Even more may exist with the proxy stub options, MTS, and support for MFC. I will check all these cases before distributing the next version of my band.
Cheers,
-Eri
|
|
|
|
|
If you're using an RGS file in your project, you can add the "ForceRemove" identifier before your CLSID = s '{<guid>' to force a remove on DllUnregister or to remove it before adding back again via DllRegister.
---
Heath Stewart
Systems Administrator / Developer
EsotericRealm / Palisade Systems
http://www.esotericrealm.com/~hstewart
|
|
|
|
|
hi,
thanks for the answer last time.
This time,...
I fixed DllRegisterServer(..) and build the code.
Then I tried to register the DLL file created like this,
RegSvr32 TestBand.dll
But nothin appears in IE. No Band Object available...
But I found the Band Object installed after I reboot
my computer.
What's wrong with my system?
I think the source of problem is the registry data of my own. I'm using window2000 professional.
Please give me any hint that you can think of on this kind of problem.
hwa
|
|
|
|
|
Yes I know there are a few issues with the wizard. I am working on fixes for them today. The issue may be that there is no threading model set. add the threading model to the registry script of your project.
Let me know if that still doesn't fix it.
Cheers,
-Eri
|
|
|
|
|
I created empty "ATL COM AppWizard" project,
which will make In-Proc dll with merged Proxy-Stub code.
Then I inserted this "DeskBand" object.
After that, I was going to correct the code of
DllRegisterServer function, as you directed on this page.
But I couldn't understand the comment given in the function.
It says I should remove 'return' keyword, after which
I couldn't compile the file.
Did I misunderstand the direction given?
Please help me with the code...
Here's my DllRegisterServer(),
STDAPI DllRegisterServer(void)
{
#ifdef _MERGE_PROXYSTUB
HRESULT hRes = PrxDllRegisterServer();
if (FAILED(hRes))
return hRes;
#error Code Section Has not been moved!!!
// REMARKS:
// Due to a limitation of the ATL Object creation wizard
// language, You need to manually remove the
// "return" keyword from infront of "_Module.RegisterServer
// (TRUE)". Then remove the #error line and
// these remarks.
CoInitialize(NULL);
ICatRegister* pcr = NULL;
HRESULT hr=CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL,CLSCTX_INPROC_SERVER, IID_ICatRegister,(LPVOID*) &pcr);
if(SUCCEEDED(hr) && pcr){
// CATID_CommBand, CATID_InfoBand, or CATID_DeskBand
hr = pcr->RegisterClassImplCategories(CLSID_LuckBand, 1, &(CATID)CATID_InfoBand);
pcr->Release();
}
CoUninitialize();
return SUCCEEDED(hr);
#endif
// registers object, typelib and all interfaces in typelib
return _Module.RegisterServer(TRUE);
}
|
|
|
|
|
Yes I know the code needs to be revised and I need to build a new version. Here's the solution to your problem. What I did was move the band registration code down where it should be and did what the code would have generated if proxy stub was not used.
Hope it helps,
-Erik
Revised: DllRegisterServer
STDAPI DllRegisterServer(void)
{
#ifdef _MERGE_PROXYSTUB
HRESULT hRes = PrxDllRegisterServer();
if (FAILED(hRes))
return hRes;
#endif
// registers object, typelib and all interfaces in typelib
_Module.RegisterServer(TRUE);
CoInitialize(NULL);
ICatRegister* pcr = NULL;
HRESULT hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL,CLSCTX_INPROC_SERVER, IID_ICatRegister,(LPVOID*) &pcr);
if(SUCCEEDED(hr) && pcr){
// CATID_CommBand, CATID_InfoBand, or CATID_DeskBand
hr = pcr->RegisterClassImplCategories(CLSID_LuckBand, 1, &(CATID)CATID_InfoBand);
pcr->Release();
}
CoUninitialize();
return SUCCEEDED(hr);
}
|
|
|
|
|
Is there any good way add a chevron to this or any other user deskband? Only thing I can think of doing is adding a gripperless rebar control inside the deskband, but that feels kludgy...Any ideas
|
|
|
|
|
Kyle,
There are alternatives. I weighed the possibility of using a rebar control in my deskband for the Color Picker so I could use the drop down arrows. But it also felt kludgy, So I created a button class that associated itself with a parent window that was notified when the dropdown arrow (button) was being pressed so it could react. You could do something similar. Create a button that reacts like it would in a rebar control. Have it float on top of the parent and have it send messages to the parent as the chevron would do in the rebar control. In my opinion it would be less kludgy and give you more control over the chevron and it's parent.
Hope this helps,
-Eri
|
|
|
|
|