|
Hi, i dont have much (actually any) experience using ActiveX controls, Say i want to use one like the WinSock Control, or maybe the MSFlexGrid, on my application, How do i do it?, can someone point me in the right direction?
Thanks!
|
|
|
|
|
There are visual ActiveX controls, and windowless ActiveX controls. I assume you are talking about visual controls.
Once the WTL setup is installed, copy the WTL class wizard (AtlApp60.awx + setup.js) files in the Microsoft Visual Studio \ Common \ MSDev98 \ IDE \ Bin.
Then two new project templates should appear when you create new projects.
Choose ATL/WTL App Wizard. In the wizard pages, be sure to check "ActiveX controls".
Once done, go into the resource tab, open a dialog box, right-click on it and choose "Insert Active Controls". You are done!
Technically speaking, a WTL dialog that intends to support ActiveX controls derives from the CAxDialogImpl base class. Which is what you automatically get by checking the appropriate box in the WTL wizard.
|
|
|
|
|
Thanks for your answer!, if i may bother you with just another question, Say i use the Winsock control, how do it "control it"? what i mean is, how do i programatically set its properties, recive notifications from it, etc??
Thanks for your patience! i have some WTL and W32 API experience, but like i said, cero experience in ActiveX!
|
|
|
|
|
1. import the type-library
2. create a running winsock object instance
3. use it
Code is as follows :
1. insert this line in your precompiled headers :
#import "C:\WINNT\System32\MSWINSCK.OCX"
2. add this code in your .cpp :
MSWinsockLib::IMSWinsockControlPtr wscks(_uuidof(MSWinsockLib::Winsock));
3. use intellisense to call methods as they appear in intellisense
wscks-> (intellisense!) ;)
|
|
|
|
|
Thanks!
|
|
|
|
|
I have an ATL project that have a simple class and interface. It contains one object. I wanted my class to implement another interface (IFunctoid from BizTalk Server 2002), so I right-click on the class (in ClassViewer) and choose Implement Interface... from the menu.
I choose the correct DLL that contains the interface definition, and the C++ code is happily added to the existing code when I choose the interface. All C++ seem fine.
The problem is that the IFunctoid interface don't show up in Oleview when I choose View Typelib (it does when I choose Create Instance). It does not show up in COM+ either (the default interface does, but not the IFunctoid interface).
I noticed that the .idl file does not contain any reference to the IFunctoid interface, and there is no such thing like functoid.idl to include in my project.
There is the code generated by the wizard when I chose Implement Interface (I didn't edit the code yet):
#ifndef __SECURITYFUNCTOID_H_
#define __SECURITYFUNCTOID_H_
#include "resource.h"
#import "C:\Program Files\Microsoft BizTalk Server\XML Tools\CannedFunctoids.dll" raw_interfaces_only, raw_native_types,\
no_namespace, named_guids
class ATL_NO_VTABLE CSecurityFunctoid :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CSecurityFunctoid, &CLSID_SecurityFunctoid>,
public IDispatchImpl<ISecurityFunctoid, &IID_ISecurityFunctoid, &LIBID_SECURITYCALCULATIONLib>,
public IDispatchImpl<IFunctoid, &IID_IFunctoid, &LIBID_BTSCannedFunctoidsLib>
{
public:
CSecurityFunctoid()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_SECURITYFUNCTOID)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CSecurityFunctoid)
COM_INTERFACE_ENTRY(ISecurityFunctoid)
COM_INTERFACE_ENTRY2(IDispatch, ISecurityFunctoid)
COM_INTERFACE_ENTRY(IFunctoid)
END_COM_MAP()
public:
STDMETHOD(get_Version)(LONG * pVersion)
{
if (pVersion == NULL)
return E_POINTER;
return E_NOTIMPL;
}
STDMETHOD(get_FunctionsCount)(LONG * plCount)
{
if (plCount == NULL)
return E_POINTER;
return E_NOTIMPL;
}
STDMETHOD(GetFunctionDescripter)(LONG lIndex, FUNC_CATEGORY * pFuncCategory,
SCRIPT_CATEGORY * pScriptCategory,
FUNC_TYPE * pFuncType,
BSTR * pbstrName,
BSTR * pbstrTooltip,
LONG * plBitmapID,
LONG * plParmCount,
LONG * pFuncId)
{
if (pFuncCategory == NULL)
return E_POINTER;
if (pScriptCategory == NULL)
return E_POINTER;
if (pFuncType == NULL)
return E_POINTER;
if (pbstrName == NULL)
return E_POINTER;
if (pbstrTooltip == NULL)
return E_POINTER;
if (plBitmapID == NULL)
return E_POINTER;
if (plParmCount == NULL)
return E_POINTER;
if (pFuncId == NULL)
return E_POINTER;
return E_NOTIMPL;
}
STDMETHOD(GetFunctionParameter)(LONG funcId,
LONG lParameter,
LONG * plConnectionType)
{
if (plConnectionType == NULL)
return E_POINTER;
return E_NOTIMPL;
}
STDMETHOD(GetScriptBuffer)(LONG cFuncId,
LONG lInputParameters,
BSTR * pbstrScriptBuffer)
{
if (pbstrScriptBuffer == NULL)
return E_POINTER;
return E_NOTIMPL;
}
};
#endif //__SECURITYFUNCTOID_H_
|
|
|
|
|
Find .tlb file delete it, and rebuild the project.
Somtimes VS messes up....
Brian
|
|
|
|
|
|
Hi. I know how to convert strings to BSTR, COleVariant, and ect.. but how do you convert them back to regular ansi that the Windows API requires.
Thanks in advance.
Martin.
|
|
|
|
|
Well, refer to the ATL String Conversion Macros[^].
Basically you'd be using one of these: OLE2CA (which will make ole/bstr into ansi const char*), OLE2CW (same, but for unicode), or just OLE2CT (which converts depending on your settings for using ANSI / _UNICODE)
|
|
|
|
|
I want to learn ATL.
But when I want to insert a new ATL object using Menu Insert==>New ATL Object.A error was throwed out as "error Invoking ATL Object Wizard Component" .I can't solve the problem.
And I resetup VC++6.0 ,the error exist yet.
And I resetup the system(win2000) and VC++6.0.The error exist yet.
How can I do?
Don't look at me in that way!
|
|
|
|
|
Why does ostream_iterator not work for the second scoped code block in main below?
In VC6 you get an error something like:
"d:\program files\microsoft visual studio\vc98\include\iterator(203) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'const struct std::pair<int,int>' (or there is no acceptable conversion)"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct MyClass
{
MyClass(int f, int s)
: first(f), second(s) {}
int first;
int second;
};
ostream& operator<<(ostream& stream, const MyClass& m)
{
return stream << "First: " << m.first << ", Second: " << m.second;
}
typedef pair<int, int> MyClassPair;
ostream& operator<<(ostream& stream, const MyClassPair& m)
{
return stream << "First: " << m.first << ", Second: " << m.second;
}
int main(int argc, char* argv[])
{
{
vector<MyClass> coll;
for (int i = 1; i <= 10; i++)
{
MyClass m(i, i);
coll.push_back(m);
}
copy(coll.begin(), coll.end(),
ostream_iterator<MyClass>(cout,"\n"));
}
{
vector<MyClassPair> coll;
for (int i = 1; i <= 10; i++)
{
MyClassPair m(i, i);
coll.push_back(m);
}
copy(coll.begin(), coll.end(),
ostream_iterator<MyClassPair>(cout,"\n"));
}
return 0;
}
Kevin
|
|
|
|
|
This seems like a bug to me. Try supressing using namespace std; and prefixing with std:: as necessary to see the effect.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Yes, that does it. This problem seems to have come up a number of times in the C++ newsgroups, though none offered this solution. This behaviour seems to occur in VC5/6 and in at least VC7 Beta 2.
Kevin
|
|
|
|
|
Optionally, try defining the second overload as
ostream& operator<<(ostream& stream, const pair<int,int>& m) If either this or the former rewriting gets a clean build, then you've hit a compiler bug.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Dear Friends,
I have one Media Player .exe and 3 .dll and one .vg2 file. I have code also to run a media player.I have to customize the product.
After executing the file first control winow opens from which can select a .vg2 file and it displays.But it displays in a particular size and I have to display it in a maximize mode as default.
So kindly help me to make the necessary changes in the code to solve the problem.
It is very urgent so kinly reply me accordingly ASAP.
Thanking you in adavnce.
Your Friend
|
|
|
|
|
with the following snippet:
<br />
struct A<br />
{<br />
BSTR bstrA;<br />
BSTR bstrB;<br />
};<br />
<br />
struct B<br />
{<br />
int countA;<br />
[size_is(countA) A *a;<br />
};<br />
<br />
__interface IService<br />
{<br />
HRESULT AllocateSomeBs([out] int *countB, [out, retval, size_is(, countB)] B **bs);<br />
};<br />
The above will compile, but the WSDL generation fails....if I eliminate the comma in the size_is attribute, the code will compile and the WSDL generation will succeed. According the documentation the difference between having a comma and not having a comma in the size_is attribute is as follows:
With a comma: the pointer is a pointer to a pointer to an array of B
W/o a comma: the pointer is a pointer to an array of pointers to B
The documentation for the soap types says that size_is works as documented for MIDL but I'm not seeing this in reality...anyone know anything more about this?
|
|
|
|
|
I think that you simply lost the * symbol before the array's counter.
HRESULT AllocateSomeBs([out] int *countB, [out, retval, size_is(, * countB)] B **bs);
With best wishes,
Vita
|
|
|
|
|
Hi all, this is kind of a tricky question, so let me give you some background on my app.
I have an SDI app with a view based on CListViewCtrl. The list is set to operate on "virtual mode", (via LVS_OWNERDATA style on creation), so it asks for it´s items text instead of storing them itself.
However, if i want it to work properly i MUST add this to the view´s parent(CMainFrame) message map:
CHAIN_MSG_MAP_MEMBER(m_view)
If i dont add this TO THE PARENT (CMainFrame), the view NEVER recives the LVN_GETDISPINFO notification!, this is because the view(wich is a superclassed listview) by default, like most common controls, sends its notifications to its parent, (CMainframe in this case).
So the question is: is there a more "proper" way of reflecting the notification messages back to the view? or is there a way to specify that the control (listview) will handle it´s messages itself? (ibe tried setting the WS_EX_NOPARENTNOTIFY style but it wont work).
Thanks!
|
|
|
|
|
The Proper Way is to reflect the notifications, not chain them. In the frame's msg map:
BEGIN_MSG_MAP(CMainFrame)
....
REFLECT_NOTIFICATIONS()
END_MSG_MAP() That makes any unhandled WM_COMMAND and WM_NOTIFY messages get sent back to the control that generated the message. Then in the list ctrl class, add two entries:
BEGIN_MSG_MAP(CYourListView)
....
REFLECTED_NOTIFY_CODE_HANLDER(LVN_GETDISPINFO, OnGetDispInfo)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP() DEFAULT_REFLECTION_HANDLER() should go at the end, and makes sure that unhandled reflected messages get sent on to DefWindowProc() . There is also a REFLECTED_NOTIFY_CODE_HANLDER_EX() macro if you are using the enhanced message map macros in atlcrack.h.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Outstanding!, the more i learn about WTL, the more i love it!
Thanks Mike!
|
|
|
|
|
I need just to have an ie control window in my dialogbox.... something like the popup who appear when you login into messenger chat....
I have a simplest win32 console application, without MFC.
I maked CreateDialog, to open a dialog box window, from a dialog resource.
In that dialog i put an dll control of Microsoft Web Browser Object, from controls.
How to connect to that object and tell him Navigate2 ?
(with mfc is very simple is automatticaly link a m_spBrowser variable....)
Adrian Bacaianu
|
|
|
|
|
Intro:
I have a simple VB application that lives in the sys tray. It basically allows me to right click and select from a list of projects I am currently working on so that I accurately keep track of what time I spend on the job and what I spend reading CodeProject.
Problem:
Whne explorer.exe is reloaded (i.e. because IE/windows explorer hung and needed to be killed) The icon for my application does not get reloaded into the systray.
How can I solve this?
TIA
|
|
|
|
|
> have a simple VB application that lives in the sys tray.
What any of this have to do with WTL/ATL/STL....
[rant start]
VB is brain dead, defective framework, designed for masses, who can not spend couple of month learning something better.
[rant end]
Anyway you need to m_mTaskbarRestart = RegisterWindowMessage(_T("TaskbarCreated"));
and when you got it recreate your icon.
Two lines in C++, but I have no clue about VB.
Brian
|
|
|
|
|
i'm using the copy method of the basic_string<tchar>. i'm a little confused about the first parameter. could someone please post a simple example of copying from one basic_string<tchar> to another?
thanks
melinda
|
|
|
|
|