|
|
Thanks, I will.
im learning WTL too. because, its independent with MFC. I think wtl(atl too) as perfect practice of C++ concepts. And have you read the book i said before, if so, i hope i can ask you some puzzling questions about that book.
|
|
|
|
|
I have a book titled "ATL Internals" but I'm not sure if it is the same one you have. What is/are the name/s of the author/s ?
Bio.
|
|
|
|
|
Book Name:
ATL Internals: Working with ATL 8
Book Authors:
Christopher Tavares
Kirk Fertitta
Brent Rector
Chris Sells
maybe yours is the first edition
|
|
|
|
|
Yes, I think I have the book at home. Would be most glad to help if you need any explanation.
- Bio.
|
|
|
|
|
OK. Its very kind of you.
|
|
|
|
|
I'm planning to port my Firefox addon to IE. I'm wondering if there's any code library I could use to make my task easier.
|
|
|
|
|
Don't know of any such library but the ATL Wizard will help you here.
When you add a COM Simple Object using the Add Class wizard, there is an option to choose if IObjectWithSite[^] needs to be supported. Check that and you're ready to go.
Read more about BHOs here -
Browser Helper Objects: The Browser the Way You Want It[^]
«_Superman_»
I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)
|
|
|
|
|
Hi, yet again I'm having a problem with some C++/WTL, this time it's the toolbar. I want to change the background color of the rebar it's placed in. The rebar is created using CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); and the toolbar is added using AddSimpleReBarBand(hWndToolBar); but how do i chance the color of the rebar/toolbar/menu?
|
|
|
|
|
CFrameWnd has a m_hWndToolBar member, which holds the HWND of the rebar. So send that window whatever messages are necessary, like RB_SETBKCOLOR.
--Mike--
Dunder-Mifflin, this is Pam.
|
|
|
|
|
The menu item is present on the Tools menu, but is disabled.
I did a full install of VS2008, so it should be available, but ...
Has it been pulled?
Are there some extra steps required to activate?
NOTE: I don't think it matters, but I am running Windows 7
Thx
NIK
|
|
|
|
|
I see the same as you. I'm running XP. I installed VS2008 with all options turned on, but the executable that the tool entry references doesn't exist.
Your best bet is probably just to find it in an older release of VS and alter the VS2008 tool definition to point at whichever one you find. The tool itself probably hasn't been modified in years.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Yeah, I found something to that effect here: http://channel9.msdn.com/forums/TechOff/260742-ActiveX-Test-Container/
However, even after building the old sample code and applying the linker workaround I still encountered run-time issues. I tried upgrading to VS2008 SP1 and grabbed the SP1 samples, but the sample tstcon won't even compile. So it gets worse going forward.
I am pretty disgusted with Microsoft right now. Pretty pointless to publish a tutorial that relies on a tool that is no longer supported, and to ship sample code that won't even build let alone run.
Thanks for the reply.
|
|
|
|
|
Hi all,
I've just posted an article on the VC++ blog about this tool. It is still available as a sample in Visual Studio 2008 and Visual Studio 2010.
See the article here: http://blogs.msdn.com/vcblog/archive/2010/03/18/activex-test-container-application-is-still-available.aspx
Pat Brenner
Visual C++ Libraries Development
|
|
|
|
|
I have two questions.
1. The first on is how to change the text of a rebar button. I tried UISetText, but it didn't work, I don't know what excatly I should add in the update map concerning the button text. (The button already has text on it, I achieved this through AddStrings. So I think the style is not the problem.)
2. My goal is to create a dropdown button, which pops up a button menu (not an ordinary text menu, but a button menu - each item is a button(with an image and a string)).
P.S. I am using a CToolBarCtrl and have created a rebar.
Thanks.
|
|
|
|
|
Hey, folks,
I use windowless richedit control. therefor, there is no window handle for such control. and, i cannot use function like MoveWindow and SetWindowPos. can i just use message to control the windowless control's "window" position and size?
Thanks,
Hawk
|
|
|
|
|
I got it. we should use ITextServices::TxDraw() to flush the size into the widowless control.
|
|
|
|
|
I am trying to add an imagelist to a treeview control, but it only shows the last 16x16 pixels in the bitmap, at every entry in the list, instead of moving on as if i use CreateFromImage and internal resources.
HINSTANCE hDLL = LoadLibrary(_T("Resource.dll"));
if(hDLL)
{
CImageList imgList;
imgList.Create(16, 16, ILC_MASK, 0, 16);
imgList.Add(LoadBitmap(hDLL, MAKEINTRESOURCE(104)), RGB(255,0,255)));
ctrlTree.SetImageList(imgList);
FreeLibrary(hDLL);
}
as you can see, the bitmap is placed in a dll, but even if i load it directly from the app instead, it makes the same weird stuff. Any ideas of how i make it work?
|
|
|
|
|
Update on my problem, found out it added it as 1 large bitmap and didn't make it into a list as CreateFromImage does, then i've tried to make the bitmap into icons and adding them like this:
HINSTANCE hDLL = LoadLibrary(_T("Resource.dll"));
if(hDLL){
CImageList imgList;
imgList.Create(16, 16, ILC_MASK, 0, 16);
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(104)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(105)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(106)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(107)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(108)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(109)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(110)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(111)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(112)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(113)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(114)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(115)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(116)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(117)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(118)));
imgList.AddIcon(LoadIcon(hDLL, MAKEINTRESOURCE(119)));
ctrlTree.SetImageList(imgList);
FreeLibrary(hDLL);
}
with this solution it only adds the last icon, and leaves a load of blank spaces. only showing the first 16x16 pixels.
|
|
|
|
|
Did some debuging and at turns out the imagelist is created correctly with this code
HINSTANCE hDLL = LoadLibrary(_T("Resource.dll"));
if(hDLL){
CImageList imgList;
imgList.Create(16, 16, ILC_MASK, 16, 0);
imgList.Add(LoadBitmap(hDLL, MAKEINTRESOURCE(104)), RGB(255,0,255)));
ctrlTree.SetImageList(imgList);
FreeLibrary(hDLL);
}
So it's the ctrlTree that's not moving forwards in the image list. I made it move through the image list using TVIF_IMAGE, tvi.item.iImage, TVIF_SELECTEDIMAGE and tvi.item.iSelectedImage when constructing the CTreeViewCtrl items and.
|
|
|
|
|
class MyDlg
: public CDialogImpl<MyDlg>,
public CUpdateUI<MyDlg>,
public CIdleHandler,
{
BEGIN_UPDATE_UI_MAP(MyDlg)
UPDATE_ELEMENT(ID_FILE_PAUSE, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_FILE_CANCEL, UPDUI_MENUPOPUP)
END_UPDATE_UI_MAP()
BEGIN_MSG_MAP(MyDlg)
COMMAND_ID_HANDLER_EX(ID_FILE_PAUSE, OnPopupFileMenu)
COMMAND_ID_HANDLER_EX(ID_FILE_CANCEL, OnPopupFileMenu)
CHAIN_MSG_MAP(CUpdateUI<MyDlg>)
END_MSG_MAP
Here's the improtant part ofOnPopuFileMenu:
LRESULT MyDlg::OnPopupFileMenu(UINT , int , HWND )
{
UIEnable(ID_FILE_SEND, nEnableSend);
UIEnable(ID_FILE_PAUSE, nEnablePause);
UIEnable(ID_FILE_CANCEL, nEnableCancel);
UIEnable(ID_FILE_REMOVE, nEnableRemove);
return 0;
}
My goal is to call the OnPopupFileMenu when the head of the File menu is clicked (File) and to enable/disable some items from the file menu. But this does not happen.
What happens is that when I click File->Cancel (for example) the OnPopupFileMenu method is called and only then.
I achieved my goal by handling the raw WM_ENTERMENULOOP, but I don't like it this way, I want to use WTL's functionallity instead.
P.S.: I'm not sure whether I should have UPDATE_ELEMENT(and a corresponding COMMAND_ID_HANLER_EX) for each menu item I want to update, or a single one can do the job (because at each call of OnPopupFileMenu I know the state of all items in the menu).
Thanks for _any_ pointers.
|
|
|
|
|
itzuke wrote: What happens is that when I click File->Cancel (for example) the OnPopupFileMenu method is called and only then.
That's not so surprising - you 've declared OnPopupFileMenu as a handler for the menu's commands.
The BEGIN_UPDATE_UI_MAP defines what UI elements (menu, toolbar etc) should be updated when using functions like UIEnable. You call functions like UIEnable when the state that defines the UI state changes - WTL does not call UI update handlers like MFC.
See these two[^] articles[^] by Mike Dunn - in fact, see all of his WTL articles, they're all good!
[edit]You probably want to handle the WM_INITMENUPOPUP message and check what menu's being popped up to set menu item statuses like that.[/edit]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Do you know the values of nEnable* before the menu is accessed? If so, call UIEnable when you know those values. CUpdateUI handles WM_INITMENUPOPUP and will set the menu item states accordingly.
If you must do this processing when the menu is accessed, handle WM_INITMENUPOPUP and call UIEnable in that handler. Be sure to call SetMsgHandled(false) so that the message is passed on to CUpdateUI.
--Mike--
Dunder-Mifflin, this is Pam.
|
|
|
|
|
Hi
Here is sample code....
LocoDetails *locoValue = new LocoDetails(str1, ltime, latitude, longitude, speed, direction,
trackPos, trackNum, alarmsNum, failsNum);
Later i just add this to a STL map
locoDetailsList.insert(pair<std::wstring,LocoDetails*>(locoValue->GetLocoID(),locoValue));
for(pastIterater = locoDetailsList.begin();pastIterater != locoDetailsList.end();pastIterater++)
{
locoDetailsList.erase(pastIterater++);
}
Will the memory occupied by locoValue get removed or there a memory leak.
How can i solve this........
Thanks
|
|
|
|
|
The map only holds a pointer to the object. You're responsible for deleting the object itself.
--Mike--
Dunder-Mifflin, this is Pam
|
|
|
|
|