|
try overloading the "<<" or ">>" operators.
|
|
|
|
|
Yep. I've started to do so.
class CDtLog
{
private:
std::ostringstream m_os;
bool bNewEntry;
int m_nPrio;
char* m_szGroup[40];
public:
CDtLog()
{
bNewEntry = true;
m_nPrio = 2;
m_szGroup[0] = NULL;
}
template<class T>
CDtLog &operator<<(const T &item)
{
if (bNewEntry)
{
m_os << "<entry prio=\"" << m_nPrio << "\" ";
if (m_szGroup[0]) m_os << "group=\"" << m_szGroup << "\" ";
m_os << ">";
bNewEntry = false;
}
m_os << item ;
return *this;
};
void print()
{
printf(m_os.str().c_str());
}
};
int _tmain(int argc, _TCHAR* argv[])
{
CDtLog test;
int i = 10;
test << "hejsan" << std::setfill(' ') << std::setw(10) << 12 << i;
test.print();
return 0;
} I need a modifier that tells me that a debugentry is done, similiar to endl, but instead of just flushing, it ends the xml tag and then flush it to the file.
I also need to check every entered character to see if it's a < or >, if so I need to translate it to > or <, or it will ****up the xml.
I also want modifiers that I can use to change the prio and group.
|
|
|
|
|
I am writing an ATL component to do some data access using ATO. I want to pass a _RecordsetPtr pointer or a _ConnectionPtr to a ATL function. I use code like this:
<br />
<br />
STDMETHODIMP CMyAtlObject::ReadData(LPDISPATCH pAdoRecordset, BOOL *pbSuccess)<br />
{<br />
_RecordsetPtr pRecordsetPtr;<br />
<br />
if (FAILED(pAdoRecordset->QueryInterface(IID_IDispatch, (void**) &pRecordsetPtr)))<br />
{<br />
return S_FALSE;<br />
}<br />
<br />
<br />
<br />
<br />
return S_OK;<br />
}<br />
<br />
But this doesn't work. The recordset pointer gets closed during the function call. If I pass an _ConnectionPtr as LPDISPATCH, the pointer becomes invalid.
So how can I pass valid ADO _RecordsetPtr's and _ConnectionPtr's to an ATL Object?
|
|
|
|
|
Although I use OLE DB directly rather than ADO, unless the function explicitly requires a smart pointer, I'd be inclined to use a regular interface pointer instead, to save an AddRef and Release on construction/destruction of the temporary object.
Steve S
[This signature space available for rent]
|
|
|
|
|
|
Where does your LPDISPATCH come from in the first place? That's an IDispatch, so using QueryInterface(IID_IDISPATCH, ...) is a no-brainer, it should just AddRef().
Are you using #import to pull in the ADO stuff?
To get the recordset ptr, you should use
__uuidof(_Recordset)
in place of IID_IDISPATCH. This will either fail or fill in your _RecordsetPtr properly.
Probably need more context to help more.
Steve S
[This signature space available for rent]
|
|
|
|
|
I have a windows installer .msi file problem. I updated my Features and Components and updated the old .msi file call it old.msi into a new msi file say new.msi. When I run new.msi it calls old.msi, why is that? What have I done wrong?
I am not an expert on windows installer, please help.
Actually, I want to run an Upgrade but old.msi does not have an Upgrade table, so I am trying to do a reinstall to the upgraded product.
If this is not the right location to post this question please let me know where to post it.
Thanks,
Ann
|
|
|
|
|
I need to implement IPropertSheet for ATL ActiveX Composite control.
How can I do ?
Any pointers or suggestions on the same.
Thanks in Advance
|
|
|
|
|
I am developing ATL ActiveX composite control. It contains some AtciveX controls and windows controls.I am inserting these controls in resource view.
I need to insert this composite control into some other composite control.
When I am doing so, i am not able view the composite control, which is inserted.Only the white has come up.
What should I do to get it to be shown? should I over-ride OnDraw function?
If so, how can i draw the Active controls, which i inserted in resource view?
Pls give some suggestions to how should I proceed?
|
|
|
|
|
I am looking for a book on ATL.
It must:
1.) Teach how to use ATL. Not just a browse through of ATL concepts/technologies, but in
depth explanation, expounding, and analysis on usage of ATL.
2.) Explain the workings of ATL.
In short I am looking for an ATL version of Bjarne's "The C++ Programming Language"
Can any of you guys suggest what should I read?
I am a Win32/MFC programmer. I think - am I right? - that common controls were implementated as ActiveX controls. If it is, can any of you guys provide/suggest an article/book that explains how the Redmondtians did this. Basically how an application through the Win32 api instantiate and interact with the common controls (Not an explanation of windows messaging or message routing, but on how message routing was implemented in Win32 api).
|
|
|
|
|
These are two excellent ATL books.
Developer's Workshop to COM and ATL 3.0 by Andrew Troelsen
ATL Internals by Brent Rector, Chris Sells, and Jim Springfield
Kuphryn
|
|
|
|
|
|
I'm fairly new to COM/ATL and found a couple tutorials at MSDN that I wanted to do. But they are all designed for VS7. The wizard looks different and has a tab for stock properties, interfaces, appearance. But I'm not sure how to accomplish the same things in VC++6. Is there a comprehensive article and what I have to do to get the same results as the vs7 wizard without installing VS7? Thanks for the feedback
paully
|
|
|
|
|
I'm trying to register an atl com object.
The self-registration succeeds in windows NT but not in win98.
http:??iesharp.8163.com
|
|
|
|
|
Are all of the required DLL's for the ATL object in the PATH variable for both operating systems?
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
YES
sdfsdfffffffffffffffffffffffasdf
|
|
|
|
|
When you use events with ATL, the default implementation of the Fire_XXX function is to to loop thru the clients list and invoke the event. the problem is that the client might hang when the event is called, so it will not return, and the hole atl server is stuck until you release the client.
This is not an acceptable situation. So what I've done is a try to do the invokation of the event in a diffrent thread for each client. It works most of the times, but some times it hangs the server, as if i got a dead lock.
So I figured, I'm probably not the first one to try to do it. Why not use a working implementation?
So everyone that have an idea / code of what can I do to make the invokation of the event in a diffrent thread for each client, please post me back.
thank you.
Arik Poznanski
COM is NOT dead.
|
|
|
|
|
see to this one: Q157437 Fireev.exe Fires Events from a Second Thread
it's for MFC , but it's a good starter.
The whole thing lies in fact, that you have to marshall the 'callback' interface when you pass it between threads.
If you're interested, sometime ago we did developed a specialized version of atlcom.h header, that does it automatically - you just have to include atlcommt.h instead the original atlcom.h . But it's for VC6 and I didn't test it on the new versions yet. But might be useful as source to look into.
|
|
|
|
|
Hey..
since I work with VC6, it would greatly help if you give me the atlcommt.h file, and some info about what you have changed.
mail me please at arikp@hotmail.co.il
and thank you very much..
Arik Poznanski
|
|
|
|
|
|
Hello ppl, i was going through Nishant's winsock tutorials and was trying them with WTL. In a simple console application, including winsock2.h works like a charm. but when i try it with WTL appwizard generated code, i get a huge list of 114 errors!!! (mostly type/macro redefinition errors). But if i change it to winsock.h, it works. i have included ws2_32.lib in my project settings also. can anyone give me a clue on this? thanks in advance.
I am using VC++ 6.0 with February 2003 platform sdk and wtl 7.0 on WinXP Pro.
-Tareq
|
|
|
|
|
Can anyone suggest the easiest way to print html documents from an ATL applications?
The computer will have Internet Explorer installed, can I use it to do all the work? And just specify the printer and document name?
Joanne;)
|
|
|
|
|
Hello Dears
I'm student. I've to make a plug-in for MS Outlook. This plug-in will take a particular date, and will delete all the attchments of the e-mails which are older than that specific date.
Kindly guide me for the task. Provide/guide me some sample code if possible. I'll be very grateful to you.
Waiting for your kind response.
Atif
Watch Your Thoughts for they will become your actions.
Watch Your Actions for they will become your habits.
Watch Your Habits for they will become your beliefs.
Watch Your Beliefs for they will determine your destiny.
|
|
|
|
|
This article[^] is a good starting point.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Hi
I have created a ATL COM dll.The component will be used in WINDOWS 2000 machines which will not have Visual Studio.What are the ATL com dlls that I have to distribute along with the COM component?Please help.
Rgds,
venkatesh
|
|
|
|