|
I found a nightmare when I develop a ActiveX control with vc.net 2003 ATL. The derived class dosen't response to many standard messages, such as WM_KEYDOWN WM_KEYUP WM_CHAR , and it dosen't Send WM_H(V)SCROLL with wParam as SB_THUMBTRACK.
Without those, I can't finish the ActiveX control at all. Could anyone be so nice to help me?
|
|
|
|
|
|
I am creating an activex treeview control (ATL, VC++ 6, Win2000) to use it from an MSAccess form.
I bind the control value to a field (RegionID, integer) in the form, and also bind a combo box in the same field. When I click some node on my activex control I fire an xxx_Updated event, and expect to see the combo box value change, but nothing happens, until my activex control loses the focus.
Is this the normal behaviour or am I doing something wrong, because I was expecting the other controls on the form that are bound on the same field like my activex control to be updated immediately when I fire the _Updated event, and not wait until my control loses the focus.
Thanks in advance for any help.
The code I use to fire the event is shown below.
<br />
LRESULT CTreeView::onclick(UINT uMsg, WPARAM wParam, LPARAM lParam, <br />
BOOL& bHandled)<br />
{<br />
if (FireOnRequestEdit(DISPID_VALUE) == S_FALSE)<br />
{<br />
bHandled = FALSE;<br />
return 0;<br />
}<br />
<br />
UNUSED_ALWAYS(wParam);<br />
UNUSED_ALWAYS(uMsg);<br />
<br />
POINT pt;<br />
TVHITTESTINFO hti;<br />
<br />
POINTSTOPOINT(pt, lParam);<br />
hti.pt = pt;<br />
HTREEITEM hItem = TreeView_HitTest(m_ctlSysCtrl.m_hWnd, <br />
&hti);<br />
<br />
if (hti.flags & (TVHT_ONITEMICON | TVHT_ONITEMLABEL))<br />
{<br />
TV_ITEM tvi = {0};<br />
tvi.hItem = hItem;<br />
tvi.mask |= TVIF_PARAM;<br />
TreeView_GetItem(m_ctlSysCtrl.m_hWnd, <br />
&tvi);<br />
put_Value(tvi.lParam);<br />
FireOnChanged(DISPID_VALUE);<br />
FireViewChange();<br />
SendOnDataChange(NULL);<br />
bHandled = TRUE;<br />
}<br />
else<br />
bHandled = FALSE;<br />
<br />
return 0;<br />
}<br />
...Plug & Pray...
|
|
|
|
|
Hi all
I had an control and i want to implement Width and Height properties of one.How i can do this witn ATL in VC7.0 so what i can change size of control not only design time by mouse ,but and by change a value in properties window of respective properties.
THANKS.
|
|
|
|
|
I suppose you want to change the size of AX control, when you resize the container, is it, then you must be knowing that Active(AX) control ZOOMs itself into the window, where you have placed...for example,
m_hWnd // is your parent window...ok
HWND myWND = CreateWindow(....//Rest of your paramater goes here
...
RECT....
m_hWnd); //or the Container Window
As you rezise you parent or container...your AX will auto adjust
regards
Balkrishna Talele
|
|
|
|
|
When I use CoGetObject for accomplishing my task...it shows me the dialog with following contents
"Installling Com Componenets" I dont want user to see this Dialog...and I alos know why does this dialog come..bcoz I unregistered my Service...How can I do that....how can i by pass this dialog
regards
Balkrishna Talele
|
|
|
|
|
Hi all,
1. I have three activeX aTL control,
a.ParentFullcontrol (Full control),
b ChildCompControl(composite control)
c.ChildFullControl( Full control).
Now I want ChildCompControl and ChildFullControl as a child of ParentFullcontrol.But i don't know how and where to create these control?
and which APIs to use.
Can anyone help me out.
Thanks in advance
Abhishake
|
|
|
|
|
According to what I understood you question..the answer si as follows.
If you want to place you child ActiveX coiontrols on the parent controls....u need to use AtlAxCreateControlEx(....)...but remember the HWND of parent and child to put them on proper window...if this is not what you want , please do elobrate your question...I shall be gald to anwer the same
regards
Balkrishna Talele
|
|
|
|
|
Thanks Balkrishna,
One more question in relation to this,
Can you please tell me where i should create two child control, for time being i am creating it in OnDraw() of parent something like this
// hwndParent is the handle to Internet Explorer_Serversever Object
HRESULT OnDraw(ATL_DRAWINFO& di)
{
// other stuff
CAxWindow MyWindow(hwndParent);
hr = MyWindow.CreateControl('CLSID of 1st control',NULL,NULL);
hr = MyWindow.CreateControl('CLSID of 2nd control',NULL,NULL);
return S_OK
}
My 1st Control is a Composite control.
And 2nd control is again Full Control.
MyWindow.CreateControl for 2nd control returns me S_OK.
But now i cannot see the other Full control. Can you explain me why?
Again Thanks in Advance,
Abhishake
|
|
|
|
|
According to the scenario What I feel is, you shouldnt create the control in OnDraw, you must do that all these stuff in OnCreate...,in OnDraw you control will get create again n again. and secondly Composite controls are use to hold the other controls (like full control or simple object)
What I did for such scenario is/was
I createed window in OnCreate..and remembered the handle to that window, this window was created on Internet explorer toolbar. Then I placed my composite control....Where in I created second window inside Composite control...as i explained before ..Composite control acts as container and holds other onjects. and placed Full control inside the composite control..or inserted inside composite control..and they ran smoothely...
if this dosent solve your problem. Just do let me know.
regards
Balkrishna Talele
|
|
|
|
|
Hi everybody,
Does anybody know, how I can use a WTL splitter window instead of a CSplitterWnd in an MFC 6.0 project? I want to have a more flexible splitter window in my application. please explain it in detail because I don't know much about WTL.
thanks in advance,
Roozbeh.
|
|
|
|
|
|
Ive just finished coding a graphics active X control and I wanted do drop it straight into a visual basic application iam working on, but for some reason all of the properties that ive added to me control (such as position angle etc) dont appear in the properties editor in VB. Do I need to create a property page or do something in order for this to happen. As I can happily change my control properties in a VBsciptlet in a HTML page so why not VB???
[] /\ () X
|
|
|
|
|
If they're marked correctly in the IDL file (the Get method is marked propget , the Set method propput or propputref and both have the same dispid) and the interface is marked default , they should have appeared in VB's Properties page.
If you want to do extended property handling, such as categorisation, see the following MSJ article: http://www.microsoft.com/msj/0399/atl3activex2/atl3activex2.aspx[^].
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I have the properties marked correctly such as:
[propget, id(1), helpstring("property angleX")] HRESULT angleX([out, retval] double *pVal);
[propput, id(1), helpstring("property angleX")] HRESULT angleX([in] double newVal);
Where is the interface supposed to marked as default? And how is this done in code?
Is it something like this?
[default] interface Iviewer;
Also in visual basic ive noticed that when I goto add my control to the tool bar i have the options of either adding my control as a "Control" or a "insertable object". When I add it as a control it crashes upon use? Whichs should be using because it appears one is defintaley differant to the other?
[] /\ () X
|
|
|
|
|
You mark the default interface in the coclass statement in the IDL file, using the [default] attribute. Visual Basic can use non-default interfaces (unlike scripting clients) but will only show the properties on the default interface.
You should be adding your control as a control. "Insertable object" is for Active Documents, such as inserting a Word document into your project. You can debug the interaction with Visual Basic by setting VB6.EXE as the executable to debug in Project Settings.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
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
|
|
|
|
|