|
Very well written answer indeed i like your style
You know you're obsessed with computer graphics when you're outside and you look up at the trees and think, "Wow! That's spectacular resolution!"
Only kings, presidents, editors, and people with tapeworms have the right to use the editorial "we."
|
|
|
|
|
|
I have an SDI application. This SDI application has a Splitter control, which has Pane controls and the pane controls themselves have other child controls. So, there is a hierarchy of controls. Now, If I have the handle of any child control, I want to get the Handle of the SDI application window. Is there any way to achieve this?
GetParent() may work, but I would certainly not know how many GetParent()s I am supposed to call. For Example, if I have the HWND of the PaneControl, I would have to call GetParent() twice. One for the Splitter control and the other for the application Window. Similarly, if I have the handle of the Splitter control, I would have to call GetParent() only once. This is the why I think GetParent() is not such a good idea. Any other options?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
I think AfxGetMainWnd will do.
--
======
Arman
|
|
|
|
|
Is there an AfxGetMainWnd in ATL/WTL?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
Is there an AfxGetMainWnd in ATL/WTL?
Ah sorry, not sure. I though of MFC forum, sorry again.
--
======
Arman
|
|
|
|
|
Imagine.. in the ATL implementation, we have a collection or an array, ie :
<br />
int num[5];<br />
num[0]=100;..... [5]=500;<br />
Now in my client, (i.e VB) , I need to access them like,
(Imagine collection is the property which points to the array I've mentioned above}
<br />
msgbox (MyComp.Collection[0])<br />
(and like this too..)<br />
MyComp.Collection(0).length --> this should pop "3"<br />
It should popup 100.
-- modified at 11:24 Monday 10th July, 2006
|
|
|
|
|
Try using a SafeArray on the ATL side.
|
|
|
|
|
Hi, you have variuos options in this case, you can try and use some kind of collection enumeration based on the variant safearrays to try to please com clients like VB, or you can use the raw and simply way of having a property that inputs an index and returns the value in the array.
Something like:
idl:
HRESULT get_CollectionItemName([in]long Index,[out,retval]BSTR* pVal);
ClassName.cpp
STDMETHODIMP ClassName::get_CollectionItemName(long Index,BSTR* pVal)
{
lookup vector or container using index
copy item or item member on return value *pVal
return S_OK;
}
This method is fairly simple of implement, you don't need to get very involved in com specific code, and you can use simple datatypes and the kind of array of your choice.
|
|
|
|
|
I was very well able to create toolbar and buttons on it .
but how to use TBSTYLE_DROPDOWN and create the DropDown Button.
SendMessage(m_hWnd, TB_BUTTONSTRUCTSIZE, (2 * sizeof(TBBUTTON)), 0);
SendMessage(m_hWnd, TB_SETMAXTEXTROWS, 1, 0L);// Decides size of button (length)
HICON mh1 = LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON1));
HICON mh2 = LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON2));
m_hImageList = ImageList_Create(16,16, ILC_COLOR16, 1, 0);
int iI1 = ImageList_AddIcon(m_hImageList, mh1); //NO USE OF iI1
int iI2 = ImageList_AddIcon(m_hImageList, mh2);
// Set the toolbar's image
::SendMessage(m_hWnd, TB_SETIMAGELIST,0, (LPARAM)m_hImageList);
TBBUTTON Button1;
ZeroMemory((void*)&Button1, sizeof(TBBUTTON));
Button1.idCommand = IDM_GETQUOTE1;
Button1.fsState = TBSTATE_ENABLED;
Button1.dwData = 0;
Button1.iBitmap = MAKELONG(0, 0);
::SendMessage(m_hWnd, TB_INSERTBUTTON,0, (LPARAM)&Button1);
TBBUTTON Button2;
ZeroMemory((void*)&Button2, sizeof(TBBUTTON));
Button2.idCommand = IDM_GETQUOTE2;
Button2.fsState = TBSTATE_ENABLED;
Button2.dwData = 0;
Button2.iBitmap = MAKELONG(1, 0);
::SendMessage(m_hWnd, TB_INSERTBUTTON, 0, (LPARAM)&Button2);
We can write Buttonxyz.fsStyle |= TBSTYLE_DROPDOWN;
but how to add extra buttons.
|| ART OF LIVING ||
|
|
|
|
|
I want to know, What Design Pattern does ATL/COM is based upon, I dont want what ATL/COM support, What I need is ON WHAT DESIGN ATL/COM is build upon???
regards
Balkrishna Talele
|
|
|
|
|
If you using VC++ then you hardly worry about com interiors
ATL will internally take care and you will feel like using additional MFC.
But If you are a VC++ programmer do not even dare to develop com component
using c++ without training. It is very much far from normal programming flow
of inheritance using languages.
ATL hides all details of COM inside and you feel like using additional MFC
though it is not.
|| ART OF LIVING ||
|
|
|
|
|
Balkrishna Talele wrote: What Design Pattern does ATL/COM is based upon,
ATL/Com is nothing just the Runtime Polymorphism! all the concept based on that only!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I am getting a memory leak in the following lines.whats wrong?
bool CreatorObject::doesSinkSupportElement(IHTMLElement* pelem)
{
//If type is m_iidtype the nwe support element.
USES_CONVERSION;
CComBSTR bsttag;
CComVariant vartype(VT_NULL);
std::string sttype="";
std::string sttag="";
HRESULT hr;
hr=pelem->get_tagName(&bsttag);
if(FAILED(hr))
return false;
sttag=OLE2A(bsttag);
CComBSTR type(_T("type"));
hr=pelem->getAttribute(type,FALSE,&vartype);//GET TEH TYPE ATTRIBUTE OF THE ELEMENT
if(FAILED(hr))
return false;
hr=vartype.ChangeType(VT_BSTR );
if((SUCCEEDED(hr)) && (vartype.vt==VT_BSTR))
{
CComBSTR bsttype(vartype.bstrVal);
vartype.Clear();
sttype=OLE2A(bsttype);
}
....
....
}
I am gettign the memory leak in the ChangeType line.How is that to be avoided?
|
|
|
|
|
I have a executable which creates a thread to perform a particular routine.
HANDLE hThread = CreateThread(NULL, 0, ThreadAdvise, pStream, 0, &dwThreadID);
WaitForSingleObject(hThread,1000);
CloseHandle(hThread);
The thread is created with a specified timeout duration.
If the routine takes more than that duration,then the thread exits irrespective of the state of the routine.
Now,in the case of such a forced abort,how do i ensure that all memory allocated for the routine is cleaned up prior to exit?
Is there a hook/API which can be used to do clean-ups for forced thread abortions?
|
|
|
|
|
What you are doing is just closing the thread's handle without notifying the thread about its exitance. Generally, a thread is considered to exit in a normal manner if it returns from its subroutine. In other words, the client side should somehow notify the thread to return (you may use events).
--
======
Arman
|
|
|
|
|
I'm in the process of developing a demonstration application that will allow password auto-fill for both forms and HTTP-AUTH... however I cannot find any reference on how to handle the HTTP-AUTH requests.
I'm developing a BHO so that I can hook into IE's system and perform lookups on username/password... potentially asking to save new passwords.
Since I cannot seem to find a way to intercept the password manager/autocomplete so that HTTP-AUTH and forms would work.. I am trying to shoehorn form parsing and the as-yet-unknown method of intercepting HTTP-AUTH box to do what I need.
I'll also be developing a similar thing for Firefox, and having both methods present a similar interface to a scripting language so I can do the 'dirty work' with easy-updates/fixing... (However the browser interface seems to be the real dirty work...).
|
|
|
|
|
Hi,
The application i'm writing at the moment is multi-lingual so we're working with std::strings.
I'm generating an html on-the-fly in my application. I do it by using
place holders so i need an efficient "replace" function but i coulnd't find an efficient replace methond for std::strings.
Does anybody have an idea?
thanks in advance.
Snir
Singleton Technologies Ltd.
|
|
|
|
|
String class does have a replace method.
|
|
|
|
|
Igor Vigdorchik wrote: String class does have a replace method.
std::string even has 9 replace functions!
|
|
|
|
|
Define efficient - i.e. why std::string::replace isn't suitable.
You may be better off generating a new string using original string and placeholder replacements, i.e. scan through the original string, copying it to the new one, and when you see a placeholder, copy the replacement text to the new string rather than the placeholder (which you (obviously) step over).
|
|
|
|
|
snir_ya wrote: The application i'm writing at the moment is multi-lingual so we're working with std::strings.I'm generating an html on-the-fly in my application. I do it by using place holders so i need an efficient "replace" function but i coulnd't find an efficient replace methond for std::strings.
You need to write a function that copies your string contents to a new string object thereby replacing all 'place holders' in one pass with the actual strings. Try find_first_of to find a place holder.
|
|
|
|
|
I am right now having third party application to modify and they are very well
integrating WTL in VC++ by mere adding " using namespace WTL;"
I am for practice developing applications on same background.
But As soon as VC sees word WTL it gives error.
I added all WTL header files direcly in my project,at times I kept them just
in the folder tried different combinations.
VC/Common also I have WTL ,but It doesnot want to recognise word WTL
Does any one have any solution.
Third party application is keeping direct downloaded WTL folder inside project
including samples!!!
So one thing is sure they have not customised any thing inside WTL
Let me know what need to be done.
|| ART OF LIVING ||
|
|
|
|
|
There is no need to add the WTL headers to the project as they are just a bunch of template classes. Just add the WTL include directory to your VC++ include directories list. You might also want to install the AppWizard that is in the AppWiz directory.
atlapp.h automatically adds using namespace WTL; unless you #define _WTL_NO_AUTOMATIC_NAMESPACE so writing using namespace WTL; isn't even neccessary if it atlapp.h was included in stdafx.h.
|
|
|
|
|
I seen artical in
www.codeproject.com/atl/rbdeskband.asp page.
I seen it requires that i have to download a zip file and extract it in to particular path. But i m working with
VC-2005 . In it i have not found that path...
How can i do that.
|
|
|
|