|
|
Are you using VC++ 2005 Express? If so, you're out of luck - Microsoft don't ship ATL or MFC with the Express version - you need a paid-for version (Standard or Pro).
If you're not using VS2005 Express, try re-installing VS2005 - it does come with atlbase.h - I just checked.
|
|
|
|
|
|
Make sure the ATL/MFC include directory is in the include path:
1. Open Tools->Options
2. Expand the 'Projects and Solutions' branch of the tree in the options dialog.
3. Select VC++ Directories in the tree in the options dialog.
4. In the 'Show directories for:' combo-box, select 'Include files'
5. Check if the directory string '$(VCInstallDir)atlmfc\include' is in the list of include directories. If not, add it.
|
|
|
|
|
I reinstalled it and now its working...
I guess so in the first time I didn't install the MFC without realizing
Thanks a lot
|
|
|
|
|
I have created ATL project with ATL Control and ATL Property Page. How I can set value of property directly from ATL Control class? Can I make this or I must use some Helper class for creating Property Page?
|
|
|
|
|
hi everyone,
well I gotta say this, I'm not a gr8 fan for programming in ATL/MFC but now I'm in a situation where I have to do this stuff. I'm using MSXML 4.0 in a project where I need to develop an XML log as the functions get called.
I'm trying to pass a CString to the nodeTypedValue or NodeValue functions and its giving the error
error C2064: term does not evaluate to a function taking 1 arguments
the Code is given below
CString t = "No Error";
pRetCode->nodeTypedValue(_variant_t(t));
Its also giving this error on this
CString t;
t.Format("0x%x",hr);
pRetCode->nodeValue(_variant_t(t)); code>
Can u plz tell me what to do here???
Thanks in advance
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Have you included comdef.h?
|
|
|
|
|
yup now i have a still no change... Everythings the same
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
pRetCode->nodeValue(_variant_t((LPCTSTR)t));
|
|
|
|
|
well actualy that problem got solved when i did something like this
pTempNode->nodeTypedValue = _T("MixNSplit 12");
pNode->nodeValue = _variant_t(ObjType);
Thanks I think that LPCTSTR would also come in useful somewhere for me
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Olen'!
when you open first parenthesis - what you see in help tooltip? There is should be enumerate of parametres in function, yes? So, how many parameteres in that function?
Actually, I have meet that problem - in MS .NET Studio and MS VS 6.0 count of parametres in MSXML namespace function are dfferents. But don't wory - the absent parametr is result of DWORD types.
So,
pRetCode->nodeValue(_variant_t(t));
transform to
DWORD dw;
pRetCode->nodeValue(_variant_t(t), &dw);
or some looks like thiat
|
|
|
|
|
template<typename _InterfacePtr> HRESULT _QueryInterface(_InterfacePtr p) throw()
{
HRESULT hr;
if (p != NULL) {
Interface* pInterface;
hr = p->QueryInterface(GetIID(), reinterpret_cast<void**>(&pInterface));
Attach(SUCCEEDED(hr)? pInterface: NULL);
}
else {
operator=(static_cast<Interface*>(NULL));
hr = E_NOINTERFACE;
}
return hr;
}
I've got another problem now. I sorted that previous one earlier but now its reporting an error here on the variable p. I havent even touched the code in this file and I dont have any idea how this one came about. Can u give me any suggestions for this? Its using typedef to define the _Interface type but I havent foiund any typedef statement for _InterfacePtr. I tried toadd it but to no avail.
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
I think the problem in your code when you (or system) have call QueryInterface. You can review call stack and determinate where this error ocure.
|
|
|
|
|
Hello,
I have been trying to figure out a way to implement a collection class using C++/ATL so that they could be used in VB.
For e.g., in VB, it should be loopable, like
for each Order in Orders
.. do something with that Order item...
Next
Now, Order is an item in collection Orders. What interfaces should I implement such that an Orders class in a C++/ATL can become a collection?
Thanks all in advance for your help.
None
|
|
|
|
|
ATL has CComEnum . If you have your data in an STL collection, check out ICollectionOnSTLImpl and CComEnumOnSTL .
|
|
|
|
|
Hi
Actually I have created a toolbar for IE which will be changed after user loggs into our site and will be changed again after he logs out.These things I have done ,but the problem comes when it is session expiry.if the user does not do anything for 20 minutes in our site,then the session will expire and according to that the toolbar should also be changed again.How can I achieve that?My idea was to get the cookie value for that user when he logs in and firing a MySql query with the cookie value to our database each time when there is a page navigation or page refresh.If my query returns with no value,then it will mean that session has expired and according to that I will change the toolbar.I am retrieving the cookie value.But there are some problems:
1.I need to fire the query in DownloadBegin or DownloadComplete,but this is making IE very slow and IE is crashing.Moreover what I have dicovered is that,in IE6 if I dont do a page refresh or site navigation,simply if i just move the mouse over the page,then also the flow is coming to downloadbegin too many times,means that many times the query will be fired......oooops..that will be dangerous.where should I fire the query then?
|
|
|
|
|
|
hi,
I have a vector of a structure. I want to find a value of a element of structure, so that i can get that elememt in vector. I m not able to get any algo in STL so solve this problem. If you hv any idea please tell me.
Remember my vector is a vector of structure.
There is a function
_InIt find(_InIt _First, _InIt _Last, const _Ty& _Val)
doesn't for it.
Thanks & Regards
Pankaj Jain
|
|
|
|
|
That should work, unless the object/class allocates memory and it does not have a comparison method (operator==). The default comparison does a bitwise comparison, which will not work if the class (_Val) allocates memory (naturally).
Each collection type and each algorithm requires certain minimum requirements and the minimum requirement for find is a valid “operator ==”.
If that is not the problem, then I have no idea.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Perhaps something like this:
----------------------------
// Console.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Data
{
Data(int Num1, int Num2) : m_Num1(Num1), m_Num2(Num2) {}
int m_Num1;
int m_Num2;
friend bool operator==(const Data &lhs, const Data &rhs)
{
return (lhs.m_Num1 == rhs.m_Num1) && (lhs.m_Num2 == rhs.m_Num2);
}
};
void main()
{
// Create and populate the collection.
typedef vector<Data> coll_t;
coll_t coll;
coll.push_back(Data(3, 1));
coll.push_back(Data(4, 1));
coll.push_back(Data(5, 9));
coll.push_back(Data(2, 6));
coll.push_back(Data(5, 3));
// Find first (5, 9).
coll_t::const_iterator i = find(coll.begin(), coll.end(), Data(5, 9));
if (i != coll.end())
{
cout << "Found at index: " << (i-coll.begin()) << endl;
}
}
Steve
|
|
|
|
|
Hi
I have a vector of ClassA which has 5 public data member, X1,X2,X3,X4,X5. Now I want to find maximum and minimum value of X1 data member only. vector has more than 500 elements.
===========
class A
{
public:
int X1;// day , example only
int X2; // month
int X3 // year
double X4;
double X5
// only one function
CStrng GetData();// which format the date and return
}
==============
vector<class a=""> DataA;
A someDataA;
for (int i = 0; i < 500; i++)
{
// fill date members of someDataA;
DataA.push_back(someDataA); //
}
=================
Now I want to find the maximum and minimum value of X1 among all 500 data.
I don't want to compare object to object instead data member to data member.
I am new to STL/
So any code example will help. such as
max_element(0, 500,..) but how i will make sure it will compare specific data member only.
Thank you all.
msc
|
|
|
|
|
Look up “max_element”, there are 2 versions. The one you want takes a “predicate function object”. That “function object” does the comparison and you need to supply that. The same is true for the “min_element” algorithm.
I would normally just write my own loop to find the minimum and maximum in one pass, but too each their own.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
hi all, i have a class derived from CDialogImpl<>,i want to catch the Message WM_Keydown, and identify if that key is esc then dont close the dialog.
i have managed to do that in MFC application using Pretranslate function but that function is not working in ATL class,
i have tried to override DialogProc() but this function also not called, similaraly other option like CMessage::PreTranslateMessage and but same result these function are not called.
how to get equalent of MFC's PreTranslateMessage() in this class.
thanks in advance.
Regards.
Tasleem Arif
|
|
|
|
|
hi all,
i am having a sdk with fires an event.
i am trying to catch that event in other C++ console application,
i have derived my CEventSink class from IDispEventImpl
EventSink.h:
#pragma once
static _ATL_FUNC_INFO OnEvent = {CC_STDCALL, VT_EMPTY, 5, {VT_UI4, VT_BSTR, VT_BSTR, VT_I2, VT_BSTR}};
class ATL_NO_VTABLE CEventSink : public IDispEventImpl<1, CEventSink, &__uuidof(_ISourceEvents)>
{
public:
BEGIN_SINK_MAP(CEventSink)
SINK_ENTRY_INFO(1, __uuidof(_ISourceEvents), 1, OnEventES , &OnEvent )
END_SINK_MAP()
CEventSink(void);
~CEventSink(void);
HRESULT STDMETHODCALLTYPE OnEventES (DWORD dwSession, BSTR bszFilePath, BSTR bszName, SHORT Action, BSTR bszMessage);
};
OnEvent method from the sdk is:
[id(0x00000001), helpstring("method OnEvent ")]
HRESULT OnEvent (
[in] long dwSession,
[in] BSTR bszFilePath,
[in] BSTR bszName,
[in] short Result,
[in] BSTR bszMessage);
TestApp.cpp:
#include "stdafx.h"
#include "eventsink.h"
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
ISource *spEventFiringObject = NULL;
CEventSink* pEventSink = NULL;
HRESULT hr = CoCreateInstance(CLSID_Source, NULL, CLSCTX_ALL, IID_ISource, reinterpret_cast<void **="">(&spEventFiringObject));
if(SUCCEEDED(hr))
{
pEventSink = new CEventSink();
hr = pEventSink->DispEventAdvise(spEventFiringObject, &__uuidof(_ISourceEvents));
}
CoUninitialize();
return 0;
}
but DispEventAdvise returns something like
hr = 0xc0000005 The instruction at "0x
what is wrong here?
Thanx in advance.
|
|
|
|
|