|
Never mind. The problem with using MSDN samples is not being clear on Wizard options selected. Anyway, as I was perusing the process of running sproxy.exe for Console App linkage to ATL Web Services, I came across the .wsdl file that needed to be generated. .NET Studio does this under the Add Rerferences utility, however you first have to open the .disco file to get the http path to your web service. Studio then generates the XML document to link your client to the soap handlers ( .wsdl file). Tis done and tis works.
Whew!
|
|
|
|
|
Hello,
I have a appWizard generated ATL project "with MFC support" (VC++ 6.0 SP5). I try to use Project->Add to Project->Files to add a MFC class (.cpp & .h files). The class shows up in the class view but Class Wizard does not recognize the existance of the new class.
Am I doing something wrong? Any suggestions or different ways to do this. Using Add "New" class works, but I need to use an existing class from files, I do not what to have to recreate a bunch of classes from scratch.
Thanks,
Joe Colosi
|
|
|
|
|
I have a stored procedure that returns more than one result set (mulitiple select statements). I am using ATL Server and have found an example from Microsoft called OnlineAddressBook. This example has helped me considerably with the OLEDB Consumer Template, specifically db_command and db_column. However, all though it indicates the possibility of moving thru more than one result set it doesn't give any clear example, such as syntax or whether or not binding can be manual or has to be automatic. I am sure this is a simple process but it is eluding me and I cannot find any examples or user posts anywhere on this.
I have:
[
db_command(L"{CALL dbo.spTranscriptGetStudents(?, ?, ?) }")
]
class CGetStudents
{
public:
// In order to fix several issues with some providers, the code below may bind
// columns in a different order than reported by the provider
[ db_column(1) ] LONG m_StudentNum;
[ db_column(2) ] TCHAR m_LastName[DB_MAX_FIELDLEN + 1];
[ db_column(3) ] TCHAR m_FirstName[DB_MAX_FIELDLEN + 1];
[ db_param(1) ] DBTIMESTAMP m_asofdate;
[ db_param(2) ] LONG m_schnum;
[ db_param(3) ] LONG m_schyear;
};
|
|
|
|
|
I think I solved this one also. At least it compiled, have to run it to test that it works. Basically bind the columns of the first result set to the db_command using db_column. Then in the receiving method check to see if you can .MoveNext record in the first result set if not use the .GetNextResult method to move to the next one.
Heres the code:
while (S_OK!=GetStudents.MoveFirst())
{
GetStudents.GetNextResult(&numRecs, true);
}
|
|
|
|
|
I'd like to know how to host a windowless ActiveX control in WTL, a Flash control in particular.
In MFC, I add it to the dialog via the resource editor, change the control's window property to transparent and when I run the program I see in the debug output that 'Control wants to be windowless'.
And indeed, the flash control is completely transparent.
But when I follow the same steps in WTL, I can't get the control to lose its window.
Thanks
|
|
|
|
|
You always get a window that hosts the window less control. It might be the case that in MFC, the dialog itself acts as a host for a window less control. Not sure about that.
But if you use the CAxWindow class in ATL (suitable for WTL), it'll contain one window for window less controls (the hosting window) and two windows for windowed controls (one window for hosting the control, and one window which is the control itself).
I'd advise you to use CAxWindow. It's fast and easy. Be aware of problems however if you are using WTL 3.x/7.0 with ATL7. WTL 3.x/7.0 uses the old ATL3 way of dealing with CComModules, which can be a hassle if you don't know the "tricks" (assertions firing all the time )
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
Thanks for the reply, but I still have no idea what I have to do
Are you suggesting the problem is with my base class, CAxDialogImpl? Or should I subclass the control's window in a certain way?
Thanks
BTW, I'm using WTL 7.1.
|
|
|
|
|
I just had a peek at the implementation of CAxDialogImpl. I saw that it uses CAxWindow (and CAxWindow2) for hosting the actual controls. It does not host the controls directly, hence you'll always get at least one window per activex control.
There's not much you can do, unless you implement your own dialog which hosts the controls directly (tricky business).
But what's so wrong with an extra window? Your control will function properly!
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
This is bad news, because my intentions were to experiment with a GUI completely built in flash, and I can't do it with window background around it (if I want to use WTL, that is).
Nonetheless, I thank you for your efforts and clarifications!
But before I give up on WTL to do this job, can you give me some hints about hosting the control directly? How much coding and knowledge does it involve?
|
|
|
|
|
Forjer wrote:
This is bad news, because my intentions were to experiment with a GUI completely built in flash, and I can't do it with window background around it (if I want to use WTL, that is).
Interesting concept. How exactly is the flash stuff supposed to be laid out? Should it cover the entire client area, or can you instantiate windowless flash controls and tie them together in some way?
I also don't think you can "escape" the extra window in MFC. I'm not 100% sure about how MFC implements active x control hosting, but I suspect it does it similar to ATL/WTL.
Forjer wrote:
But before I give up on WTL to do this job, can you give me some hints about hosting the control directly? How much coding and knowledge does it involve?
That's quite a daunting task I imagine. There are a number of interfaces you'd need implement. ATL::CAxHostWindow is a good place to start I guess. IIRC, this is the window I've been talking about which hosts the actual control. Perhaps you could derive from it or use code from it to achieve your goal.
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
Jörgen Sigvardsson wrote:
Interesting concept. How exactly is the flash stuff supposed to be laid out? Should it cover the entire client area, or can you instantiate windowless flash controls and tie them together in some way?
There will be only one flash control which will be the entire client area. Flash can communicate with its hosting program via a special command in its ActionScript, which fires an event. Together with the interface we get a two-way communication.
Jörgen Sigvardsson wrote:
I also don't think you can "escape" the extra window in MFC. I'm not 100% sure about how MFC implements active x control hosting, but I suspect it does it similar to ATL/WTL.
When I try it in MFC I get a debug output of 'control wants to be windowless'. When I override WM_ERASEBKGND, the flash control has no window around it.
A search for the debug message led me to the file occsite.cpp, which led me to the ATL class IOleInPlaceObjectWindowlessImpl.
I don't know if I can make something useful from the information, as I'm very new to the COM architecture, but if I do I'll probably write an article
|
|
|
|
|
Forjer wrote:
There will be only one flash control which will be the entire client area. Flash can communicate with its hosting program via a special command in its ActionScript, which fires an event. Together with the interface we get a two-way communication.
CAxWindow will do just fine for you, honest! CAxWindow offers an interface much like CWindow/CWnd . Just make it span over all your client area.
First create it with (pseudo code) CAxWindow::Create(hWndParent, clientrect, _T("ProgId.For.Flash"), WS_CHILD | WS_VISIBLE); . Then use CAxWindow::QueryControl to acquire a reference to an interface, which you can advise for events.
I'd suggest you create a WTL SDI-project using the WTL wizard. In the wizard, uncheck the "use a view window" checkbox. Click OK to generate project. Then in CMainFrame::OnCreate at the bottom, do something like this:
m_hWndClient = m_activex.Create(*this, rcDefault, _T("flash.prog.id or {clsid}"), WS_CHILD | WS_VISIBLE);
UpdateLayout(); The frame window will then resize your activex control automatically. About _T("flash.prog.id or {clsid}") see the Create method for CWindow in the MSDN docs. CAxWindow interprets the window text as a control class id/prog id. CAxDialogImpl uses this "trick".
It *will* work, and it'll save you from reimplementing the entire OLE hosting code (which is a lot, and not the easiest thing if you're new to COM).
Forjer wrote:
A search for the debug message led me to the file occsite.cpp, which led me to the ATL class IOleInPlaceObjectWindowlessImpl.
That impl stub is used by controls that implement activex interfaces - the interface IOleInPlaceObjectWindowless is used by the container to communicated with the control.
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
Your efforts are very kind, but I think you missed the point. If I understand the code correctly, it won't make the control windowless, which is my *only* problem.
I have to make it windowless because I only want to show the flash GUI and nothing else. The only way I can achieve this without a windowless control would be to build a square GUI - but that would be unesthetic.
|
|
|
|
|
Ah.. then I think you're out of luck. Now, I may be wrong on this one, but I can't seem to find anything in the OLE/activex interfaces which indicate non rectangular controls.
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
I Developed a com service using ATL and added one interface to it. During the development time the serivce was registered as /RegServer.
For Release version i need to register it as /Service and when i do so i get the following error.
0x80004015 The class is configured to run as a security id different from the caller
what should i do to solve this problem thank you.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
You need admin rights.
When most installtion programs run into this kind of situtation, they just tell the user they don't have enough rights.
I don't think there's a way around it - as that would be insecure.
|
|
|
|
|
I guess i found the solution, i was not registering the right version as /service.
If you try to register a debug build as /service it fails and gives that error message.
I compiled the code with mindependency release then tried to register it. It got registered and it works.
Thanx for replying anyways.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
There is this huge STL map created inside a class object that is unique (meaning, there is only ONE such class object).
It reaches a point where I DON'T want to add anything more to the map, but would like to keep reusing it (meaning, empty out some of its content and keep the map for reuse). Because of its size, it seems almost impractical to do a "find" on the thousands of keys I would like to eliminate, thereby making room for the new entries I would like to insert.
I am looking for a way to accomplish what I'm trying to do, without having to make C++ do it (meaning, I would like to see if there is a way to have STL take care of the situation itself).
Thanks for any insight.
William
Fortes in fide et opere!
|
|
|
|
|
check out STL algorithms. (use remove_if())
sample codes below.
using namespace std;
int main()
{
vector<int> coll;
INSERT_ELEMENTS(coll,2,6);
INSERT_ELEMENTS(coll,4,9);
INSERT_ELEMENTS(coll,1,7);
PRINT_ELEMENTS(coll,"coll: ");
//remove all elements with value 5
vector<int>::iterator pos;
pos = remove (coll. begin(), coll.end(), //range
5); //value to remove
PRINT_ELEMENTS(coll,"size not changed: ");
//erase the "removed" elements in the container
coll. erase (pos, coll.end());
PRINT_ELEMENTS(coll,"size changed: ");
//remove all elements less than 4
coll.erase(remove_if (coll.begin(), coll.end(), //range
bind2nd(less<int>(),4)), //remove criterion
coll.end());
PRINT_ELEMENTS(coll,"<4 removed: : ");
}
for replacing element in container. Use replace_copy_if(...)
BTW, my sample code is not using std::map but more or less the same I suppose.
Hope this helps.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Thanks for replying.
Yes, I recognized your sample as the one on page 379 of Josuttis' book, "The C++ Standard Library." However, if you were to look on the page before that, page 378 (the third bullet from the bottom), it reads, "Due to modifications, you cannot use these algorithms for an associative container." One of the algorithms it is referring to, is "remove_if()".
Map is an associative container, and therefore you cannot use "remove_if()" on it!!
William
Fortes in fide et opere!
|
|
|
|
|
WREY wrote:
Map is an associative container, and therefore you cannot use "remove_if()" on it!!
Well, that's a finer version of the truth. The truth is that associative containers are designed such that client code cannot reorder the elements. The sole reason for that design reason was to allow implementations to use binary search trees and hash maps - data structures which does not allow arbitrary order of elements.
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
Write your own remove/filter function?
template <typename Coll, typename Predicate>
void filter(Coll& coll, const Predicate& p) {
typename Coll::iterator i = coll.begin(), end = coll.end();
while(i != end) {
if(p(*i))
i = coll.erase(i);
else
++i;
}
}
struct MyFilter {
bool operator()(const std::pair<Key, Value>& v) const {
}
};
filter(myColl, MyFilter());
That ought to work?
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
Thanks for replying.
What you have described above, looks very similar to the "for_each" algorithm, which is what I'll probably end up using in combination with "stable_partition".
William
Fortes in fide et opere!
|
|
|
|
|
I'm sorry, but stable_partition can't be used with associative types, as you cannot control the order of the items (which is what stable_partition does).
Also, be aware that for_each cannot be used to manipulate the collection which you iterating. You may manipulate the individual items, but not the overall collection, because you could end up screwing up iterators for for_each.
--
They say the most horrible things, but I hear violins.
When I close my eyes, I'm at the center of the sun.
|
|
|
|
|
Thanks again for replying.
Having reread my earlier reply, I can see where I misrepresented my intent in the ways I proposed using "stable_partition" along with "for_each" (and I'm glad you caught me on that point).
My thoughts are (and it starts off this way), "OK. I am thinking about using a list (or a vector) container to arrive at a workable solution for what I'm doing. The map container currently being used, is so huge, I definitely have to find another way to ease its load (meaning, not adding anything more to it) while NOT creating another 'map' as part of the solution. A better solution (it seems) must come with the ability for that next container to be able to expand and contract (considering maps do not lend themselves handily for doing that, hence the 'vector', or the 'list' is what comes to mind). However, I'd like to obtain the ability to do bsearch on that new container, hence the thought about 'stable_partition'." (End of Part 1.)
"Part 2" deals with the use of the "for_each" algorithm with regards to the continuing support of the map, currently being used. Through the use of "for_each" with its function object, I am thinking about doing "in-place" updates, thereby freezing the size of the map (so to speak), making no more addition to it.
Therefore, my proposed solution to the current map situation lies in using both "for_each" and "stable_partition" combined, but in different routines.
I'm glad you caught me on that point because I can see where some explaining was in order.
William
Fortes in fide et opere!
|
|
|
|
|