|
I have this done, but iam still with out success? The properties just dont appear . It does appear I can either add the control as "viewer.class" (Which is the name of the control) or 3Dviewer.dll (which is the name if the DLL) Which should I be adding as a insertable object, as the DLL crashes upon use, and if I use the class i cant change the properties?
Another quick question as you appear to be fluent in the language of ActiveX lol, but how do I change my DLL version number so when it gets downloaded on a webpage using CODEBASE, it doesnt just keep a version it already has?
[] /\ () X
|
|
|
|
|
Hello everyone:
I have a WTL combobox class, but when clicked Enter key, the
combobox can not get the key down message, how to get it?
Please help me.
BTW, I put the combobox in a dialog box and add "WM_KEYDOWN" to the combobox class, but it cannot get this message.
-Freehawk
|
|
|
|
|
|
Sorry for late response.
Subclass the edit part of combo and catch WM_KEYDOWN from it.
in .h file:
<br />
CContainedWindow m_Edit;<br />
<br />
...<br />
<br />
BEGIN_MSG_MAP(CYourClass)<br />
... <br />
ALT_MSG_MAP(1)<br />
MESSAGE_HANDLER(WM_GETDLGCODE, OnGetDlgCode)<br />
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)<br />
MESSAGE_HANDLER(WM_CHAR, OnEditInputMagnification)<br />
...<br />
END_MSG_MAP()<br />
in .cpp file:
in constructor: CYourClass::CYourClass() : m_Edit(_T("EDIT"), this, 1) {}
in OnInitDialog: m_Edit.SubclassWindow(::GetWindow(GetDlgItem(IDC_COMBO), GW_CHILD));
add if you want all keys add following:
<br />
LRESULT CYourClass::OnGetDlgCode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)<br />
{<br />
return DLGC_WANTALLKEYS;<br />
}<br />
and finally you can get KeyDown:
<br />
LRESULT CYourClass::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)<br />
{<br />
switch (wParam)<br />
{<br />
case VK_RETURN:<br />
{<br />
...<br />
}<br />
break;<br />
case VK_TAB:<br />
{<br />
...<br />
}<br />
break;<br />
}<br />
<br />
bHandled = FALSE;<br />
return S_OK;<br />
}<br />
|
|
|
|
|
Still in demand. Thanks,buddy.
|
|
|
|
|
I recently tried to create a property of an activex control that was of type LPCTSTR but after invoking the get and put methods in the test container nothing appears to change? Am I not allowed a variable of this kind for a property because it wasnt on the list when I used the add property wizard so I wrote it in? Help n e 1?
[] /\ () X
|
|
|
|
|
COM interfaces can have parameters of type LPCTSTR , but parameters of this type are not compatible with Automation, and cannot be supplied using IDispatch. Also, for COM, you should explicitly use either LPSTR or LPWSTR , rather than LPTSTR , so that you don't get problems when an application is compiled for UNICODE and the library for ANSI or vice-versa.
If you need to pass a string to an ActiveX control, use a BSTR (variant type VT_BSTR ).
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Kewl thanx Ill give it a try, Should I have any problems converting from a BSTR to LPCTSTR? And if so how will I do this (You have to excuse i know nothing really of c++!)
[] /\ () X
|
|
|
|
|
|
Thanx much appriciated I know so little of c++!
[] /\ () X
|
|
|
|
|
Ive recently coded a graphics control using ATL where all my draw code is performed using setPixelV directly to the HDC (device context). The problem is Iam trying to change the height and width of the control using the HEIGHT & WIDTH parameters that are declared in the HTML page (My control is IE deployed) upon object declaration. This seems to have some effect because instead of simply giving me a larger draw area it just tiles the existing draw across the screen in the specified height & width!?! Ive tried changing the m_sizeExtent.cx & m_sizeExtent.cy in the actually control code and this seems to be ok in the activeX test container but yet again fails in Internet explorer. Does anyone know how to solve this horrid problem .pretty please
[] /\ () X
|
|
|
|
|
i have the following problem, if i declare a variable in a local function and then assign a value in a try block under release min dependency the value is corrupt or the same as it was before the try block upon entering the catch. Please what am i doing wrong?? The code is below:
STDMETHODIMP CCMI_BioWrapper::QueryTemplate(BSTR Badge,BSTR *Response)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
int nRetCode;
CString strVal;
nRetCode = 0;
try
{
nRetCode = 99;
return S_OK;
}
catch(...)
{
// I would expect nRetCode to be 99 here
// however it is always 0, unless i do a debug build
// then it always works
strVal.Format("Q0 %d",nRetCode);
*Response = strVal.AllocSysString();
return S_OK;
}
}
|
|
|
|
|
I don't understand how you can ever be in the catch block. If you 'throw' before or during the code to set 'nRetCode' then its value in the catch block will be indeterminate. But your code cannot throw in its try block...
Paul
|
|
|
|
|
Sorry i left out the following line before returning from the try
RaiseException(0,0,0,0);
This is just a sample that creates the problem
Thanks for your reply
If i raise the exception manually i don't understand why the variable is corrupted.
|
|
|
|
|
AFAIK direct use of the 'RaiseException' API isn't really appropriate to throw a C++ exception, which is what catch (...) will catch.
This function always prints 'nRetCode = 99'.
void TestFn ()
{
int nRetVal = 0 ;
try
{
nRetVal = 99 ;
throw 0 ;
nRetVal = 1 ;
std::cout << "nRetVal = " << nRetVal << std::endl ;
}
catch ( ... )
{
std::cout << "nRetVal = " << nRetVal << std::endl ;
}
}
Perhaps your problem is down to a conflict between some Structured Exception Handling boilerplate in ATL and C++ exceptions?
Paul
|
|
|
|
|
Never knew that, thanks got rid of RaiseException and replaced with a throw, and the problem went away.
Thanks Again
|
|
|
|
|
I Have created an IE ToolBand, NON MFC, and I careted Owner Drawn Menu,
now my problem is, When I click on Owner-Drawn menu, I happen to see that my address bar dosent open the desired URL , It shows DONE on LHS and Progress bar is set to zero, DID any one encountered such problem, How to solve it..
regards
Balkrishna Talele
|
|
|
|
|
Hello everyone:
I made a combo box in a WTL tree view, when the WM_LBUTTONDOWN happened , how can i know whether the list box of combo box is clicked?
Thank you.
-Freehawk.
|
|
|
|
|
hi
Did you try by subclassing the listbox and editctrl on OnCtlColor . chk the MSDN knwoledge base article with id Q174667 for more details.
rgds..mil10
|
|
|
|
|
Hi!,
I want to create a read-only view of excel,word or powerpoint file using the ole techonology.
I use the default object handler provided in ole32.dll
I dont know what steps to follow after creating the object using:
hr=CoCreateInstance(clsid,NULL,CLSCTX_INPROC_HANDLER,
IID_IUnknown,(PVOID*)&pUkwn);
the object handler basically implements IDataObject,IOleCache and IViewObject.
IViewObject::Draw will draw on the specified device.
but before that I want to pass data to the object.
which interface shall I use?
thanks
Anshuman
|
|
|
|
|
I am using ATL with Visual Studio.NET 2003. I seem to be having a problem
with template member specialization involving the CComPtr<> class declared
in atlcomcli.h. In the declaration for CComPtr<> the last entry for a
member function is:
template <>
T* operator=(const CComPtr<T>& lp) throw()
{
return static_cast<T*>(AtlComPtrAssign((IUnknown**)&p, lp));
}
The code I am working with declares a template member specialization similar
to this:
CFoo* CComPtr<CFoo>::operator=(const CComPtr<CFoo> & lp)
{
...
}
In VS.NET 2002 this works just fine. However, in VS.NET 2003 I get compiler
error C2511 (overloaded member function not found ...). I can remove the
line 'template <>' from the CComPtr<> class declaration in atlcomcli.h
(shown above) and the code will then compile just fine. Is this a bug in
ATL or is there something I am not seeing?
Since I don't want to modify the original ATL files, I have made special
modified copies of atlcomcli.h and, by necessity, atlbase.h and I have
included them in the project in order to do a workaround. Is there a better
way?
Thank you,
Ray Gregory
|
|
|
|
|
In standard C++, you can't just specialize a single member function of a template class. You have to specialize the whole class template. Earlier versions of Visual C++ erroneously allowed this.
Why do you need to specialize CComPtr ? You should normally be using this class with COM interfaces; if you're trying to use it with something else, I suggest writing a smart pointer template of your own. Using CComPtr with something that isn't a COM object will just confuse people.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I have found that I can specialize the single member function just by removing the line 'template <> ' that immediately precedes the declaration of the operator= function in the delcaration for CComPtr in atalcomcli.h.
I have to specialize the operator= member function of CComPtr to avoid a compiler error about ambiguous conversions. The specialized function does the same thing as the default function with the exception of some typecasting.
|
|
|
|
|
The class CFoo is a COM interface. It inherits multiply from, among other things, IDropSource and IDropTarget . In fact this is the reason I need to specialize the asignment operator for CComPtr<CFoo> . If I don't, then the compiler signals ambiguous conversions between CFoo* and IUnknown* because both IDropSource and IDropTarget derive from IUnknown .
Unfortunately, the specialized copy asignment operator breaks in VS 2003 but not in VS 2002.
|
|
|
|
|
Could you show the lines that give the ambiguous conversion error?
Thank You
Bo Hunter
|
|
|
|