|
This just works out of luck. std::vector iterators need not be pointers. &data[0] is the way to go.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Yup, you are right. I guess it is one of those things you see so often you forget it is .... WRONG.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I am working with a project which handles large compound files. Now I face a problem with IStream::Write().
IStream::Write()retuns an error STG_E_DOCFILETOOLARGE (Error:"The compound file is too large for the current implementation").
I am trying to write in a compound file created with 512 Byte sectors (Info MSDN see below). The current file size is about 300 MByte and the number of streams are about 100000 ! The error occurs only with Win 2000 SP3 and XP SP1. In Win NT 4.0 SP6a it works !!! When I create the file with 4096 Byte sectors in StgCreateStorageEx, IStream::Write works for Win 2000 and XP too. Now my question: Is this a bug?
Info from MSDN Library:
The compound file implementation can be configured to use 512 or 4096 byte sectors, as defined in the STGOPTIONS structure. File size limits: 512: 2 gigabytes (GB) 4096: Up to file system limits Number of elements in a file: 512: Unlimited, but performance may degrade if elements number in the thousands 4096: Unlimited
Mainul Hossain
Germany
Mainul Hossain
|
|
|
|
|
I am working on an ATL service. My problem is that I want to display an Icon whenever the service starts. Also on the click of icon it should display a menu from where I can stop the service.
I tried using NOTIFYICON data structure but it requires parameters such as handle to the parent window and to the icon. How do I get handles to the window as there is no UI for an ATL service
|
|
|
|
|
Interesting problem. One solution is to design an interface (GUI) for the service and have it communicate with the user.
Kuphryn
|
|
|
|
|
Can it not be done without a UI??
|
|
|
|
|
Create a seprate trayicon.exe application that can communicate with your service.
Todd Smith
|
|
|
|
|
Maybe I am wrong, but I remember than when I some time ago did something with event log, I have first register a message before use the eventlog - the message format was something like
messageID=XYZ; "Some error occured in function %s"
This message definition is stored somewhere in registry I guess...
Then when I wanted to write such an error to eventlog I only refer to the definition and add the string to be completed (say "main").
ReportError( XYZ; "main" );
in eventlog viewer it appears to be:
"Some error occured in function main"
I think that this is because it can save a quite big amount of space in the evt file, because they can store only the "main" string in each entry instead of the whole message.
I don't think, that this will help you a much, but at least you know reason why it doesn't work for you now.
|
|
|
|
|
What is the error? What flags do you use for FormatMessage? Is it possible that not all the messages came from the same message DLL? How do you deal with parameters?
|
|
|
|
|
I am implementing interface to handle event . I am stuck in defining _ATL_FUNC_INFO .
Sample of my code is
/////////////////////////////////////////////////////////////////////////////
class CCTIHPPCHelper;
#define EVENT_SOURCE_CTI 1
#define CTIHPPCEventDIID HiPathProCenterLibrary:IID__IMediaManagerEvents
typedef IDispEventSimpleImpl<event_source_cti, cctihppchelper,="" &ctihppceventdiid=""> SCTIHPPCEventImpl;
and in .tlh file i have
_IMediaManagerEvents : IDispatch
{
//
// Wrapper methods for error-handling
//
// Methods:
HRESULT EventOccurred (
struct IMediaEvent * MediaEvent );
};
My problem is how should i define _ATL_FUNC_INFO as parameter in "EventOccurred" is a struct type and what should be my BEGIN_SINK_MAP definition.
Is there any other way for implementing interface.
Thanks
|
|
|
|
|
Hi,
I didn't get your question completelly, but the general approach how to handle the events is very simple in ATL.
Assume you have class CWantEvents and you want to receive the event you described.
Then you have to define the sink map as follows:
<br />
BEGIN_SINK_MAP(CWantEvents)<br />
SINK_ENTRY_EX(0, __uuidof(_IMediaManagerEvents), 1, OnEventOccurred)<br />
END_SINK_MAP()<br />
<br />
void __stdcall OnEventOccurred( IMediaEvent* ipMediaEvent )<br />
{<br />
};<br />
Then when you attach to the event source (using DispEventAdvise ), you have to be able to receive such an event.
Hope this helps.
Ya, and note - the member marked in my sample as dispid might be different for you (depend on dispID of the real event method you want to receive)
|
|
|
|
|
Ok, if I got this right, event sinking is when you listen for COM events?
I am trying to listen for Internet Explorer events (idc_print, idc_printpreview) from an ActiveX control within internet explorer. I was wondering if someone can help me out or point me in the right direction.
MoMad the NoMad
|
|
|
|
|
idc_print? idc_printpreview? Take a look at the DWebBrowserEvents2 dispinterface. Those are the events you can sink. (At least what's been published by Microsoft. )
--
tlhIngan maH! Heghlu'meH QaQ jajvam!
|
|
|
|
|
In ATL6 (VS6) creating an interface like this
interface ICtrl1 : IDispatch<br />
{<br />
typedef enum {Diedel, Doedel, Doing} DUMMY;<br />
[id(1), helpstring("method Foo")] HRESULT Foo([in]DUMMY Dummy);<br />
};
in Foo.idl the file was properly compiled by MIDL.
However doing the same in ATL7 in the controls headerfile
__interface ICtrl1 : public IDispatch<br />
{<br />
typedef enum {Diedel, Doedel, Doing} DUMMY;<br />
[id(1), helpstring("method Foo")] HRESULT Foo([in] DUMMY Dummy);<br />
};
results in an error MIDL2025 : syntax error : expecting a type specification near "DUMMY".
I have no idea what I am doing wrong here
Rainer
|
|
|
|
|
I am little bit rusty in IDL, but I do not think enum inside of interface is valid syntax (granted that VC6 compiled that). Compile in VC6, use OleView on the resulting tlb, my guess is that older MIDL just silently moved that typedef out of interface definition during compilation.
|
|
|
|
|
|
Use stream manipulators. See this[^].
Pavel
Sonork 100.15206
|
|
|
|
|
Hi,
i am new to ATL.i want to send a simple mail with an attachment using the ATL DLL.Can anyone help me out of this problem?If possible pls paste the code/syntax.
Thanks for all in advance
|
|
|
|
|
Your going to need a library that supports SMTP, or implement your own version from the RFC. There are a few libs on this site, but you need to make sure that they don't make use of MFC, unless your happy to link to MFC in your ATL projects, but it will bloat them.
Here is an Win API version, but its very basic
http://www.codeproject.com/internet/zsmtp.asp[^]
This next article has a very good implementation that I can vouch for, but says its MFC based. On the whole its not, it just makes use of CString, which is now avaliable in ATL without binding to MFC. PJ points out that it does not use the MFC socket classes as they are message loop based which is no good if you need to write an NT service.
http://www.codeproject.com/internet/csmtpconn.asp[^]
Quote from a clever bloke :
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein
|
|
|
|
|
ATL7 have support for SMTP out of the box
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi, everyone!
Please look at the following codes. I think I overload the
operator clearly. But compiler still say that it is ambiguous.
Here are the source codes and related error message.
Source:
--------
#include <iostream>
#include <map>
#include <set>
#include <string>
using namespace std;
class employee_data {
public:
employee_data() : name (""), skill(0), salary(0) {}
employee_data(string n, int s, long sa) :
name (n), skill (s), salary (sa) {}
string name;
int skill;
long salary;
friend ostream& operator<< (ostream& os, const employee_data& e);
};
ostream& operator<< (ostream& os, const employee_data& e) {
os << "employee: " << e.name << " " << e.skill << " " << e.salary;
return os;
}
class employee {
public:
employee (int i, employee_data e) :
identification_code (i), description (e) {}
int identification_code; // key expression to identify an employee
employee_data description;
bool operator< (const employee& e) const {
return identification_code < e.identification_code; }
};
int main()
{
set <employee, less<employee> > employee_set;
multiset <employee, less<employee> > employee_multiset;
map <int, employee_data, less<int> > employee_map;
multimap <int, employee_data, less<int> > employee_multimap;
employee_data ed1 ("john", 1, 5000);
employee_data ed2 ("tom", 5, 2000);
employee_data ed3 ("mary", 2, 3000);
employee e1 (1010, ed1);
employee e2 (2020, ed2);
employee e3 (3030, ed3);
pair<const int, employee_data> a[2] = { make_pair (2020, ed2),
make_pair (3030, ed3) };
employee_map.insert (&a[0], &a[2]);
employee_data d = employee_map[2020];
cout << d << endl;
return 1;
}
--------
Error message:
--------
C:\Program Files\Microsoft Visual Studio\MyProjects\testMap1\testMap1.cpp(86) : error C2593: 'operator <<' is ambiguous
--------
Thanks in advance,
George
|
|
|
|
|
Hi, everyone!
I have tried it in VC7.0 and Linux gcc. Both OK, something
wrong with VC6.0?
George
|
|
|
|
|
Templates with VC6 sort of stink. :/
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thanks, Tim buddie!
George
|
|
|
|
|
It works OK in VC++6.0 sp5. Maybe you should consider installing that service pack.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|