|
disinterface is not getting created for my component. i dont find anything starting with a "_"(underscore)ISample" i mean _ISample. how to generate it? can we mannually add a disinterface? please help. time critical!
thanks
v
|
|
|
|
|
Are you talking about event source interfaces? If the class wizard has screwed up (which it often does), then create a new ATL project, and create a dummy class. Create the event source interface in its IDL file, and make the classwizard generate the proxy code. Then simply copy the code from that project to your old project.
All that's needed really is a block in the type library, and the proxy code (for easy generation of events).
--
Keep talking! You're the fool, I'm the preacher.
|
|
|
|
|
jorgen, ya your are right, i'm missing the "Fire_"menthods (for raising events) inside template class, which is given in the header file like,
[code]
#ifndef _ATL21CP_H_
#define _ATL21CP_H_
template <class t="">
class CProxy_IIATL21Events : public IConnectionPointImpl<t, &diid__iiatl21events,="" ccomdynamicunkarray="">
{
public:
};
#endif
[/code]
even thought i create methods with the right sequence, only the interface definition is getting created like,
[code]
[id(2), helpstring("method UseCount")] void UseCount([in]long Total);
[/code]
actually, the definition for Fire_ event should have generated in the header file , like
[code]
VOID Fire_UseCount(SHORT Total)
{
T* pT = static_cast<t*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<iunknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<idispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = TotalMarks;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
[/code]
So, whatz the problem with my wizard?so everytime should i copy it from the dummy proj(actually its not being generated in the dummy proj also, i'm just copying from another working source)? cant we fix it?
[I HOPE BOTH ARE TALKING ABOUT THE SAME ISSUE]
Thanks buddy
V
|
|
|
|
|
Frankly, I don't know why the wizard acts like that. IIRC, the wizards use special "markers" in the code, to determine where to inject code. What those markers are, I am not sure.
Have you tried recreating the solution/project? If it's not more than 10-20 files, and has few and non-complex build configurations, then it might be worth the effort to generate a new project, and then add back everything by using the wizard. Be sure to retain the old CLSIDs and IIDs, if your components have been published earlier.
I'm sorry I can't be of much help
--
Keep talking! You're the fool, I'm the preacher.
|
|
|
|
|
ya jorgen, i had to do like that (copying the the definition from another project). its working fine, but its annoying when i find the class empty. ok thank u so much for ur response pal
thanks
V
|
|
|
|
|
hi buddy, i've a good news for u, after screwing it up for so long , i found out how to kick it to make it generate the code. before "implementing the connection points", we must compile the .idl file, then its generating the code for Firing Events.. are u happy about my discovery??
regards,
V
|
|
|
|
|
Ah, I assumed you had done that already! I knew about that "glitch" in VS.NET. Thanks for the notification though, I appreciate it!
--
Keep talking! You're the fool, I'm the preacher.
|
|
|
|
|
you knew it? hmmm.. ok, well some meet again with someother problem, so we'll keep "speaking" ([note]i wont say "talking!!" )about ATL ..!
bye dude,
Regards,
V
|
|
|
|
|
Vivekuniq wrote:
, so we'll keep "speaking" ([note]i wont say "talking!!" )
My signature isn't aimed at anyone.. it's a line from a song. But I think you figured that out.
Next time I won't assume so much.
--
Keep talking! I'm the preacher, you're the fool!
|
|
|
|
|
Hello everybody,
I'm working on an WTL application which has among its tasks to display video files (avi and mpeg). In fact, I don't know at all from where to start!! Can someone give me a little help or orientation? Thanks.
Madjid
-- modified at 6:04 Monday 26th September, 2005
|
|
|
|
|
Hello,
I am trying to write an OLEDB consumer in C++ and having problems with it. The database that i am trying to access has 3 binary columns. So i have to use more then one accessor to get the data and that is where i am facing problem. It works fine when there is one binary data column but fails if there are more than one binary column in a talbe. Following is the code
class COLLABORATION
{
public:
TCHAR m_ID[TCHAR_COL_LENGTH];
TCHAR m_PARENTID[TCHAR_COL_LENGTH];
ISequentialStream* m_DATA;
ULONG m_DATA_LENGTH;
ULONG m_DATA_STATUS;
ISequentialStream* m_TEMPDATA;
ULONG m_TEMPDATA_LENGTH;
ULONG m_TEMPDATA_STATUS;
BEGIN_ACCESSOR_MAP(COLLABORATION, 3)
BEGIN_ACCESSOR(0, true)
COLUMN_ENTRY(1, m_ID)
COLUMN_ENTRY(2, m_PARENTID)
END_ACCESSOR()
BEGIN_ACCESSOR(1, false)
BLOB_ENTRY_LENGTH_STATUS(1
, IID_ISequentialStream,
STGM_READ, m_DATA,
m_DATA_LENGTH, m_DATA_STATUS)
END_ACCESSOR()
BEGIN_ACCESSOR(2, false)
BLOB_ENTRY_LENGTH_STATUS(1
, IID_ISequentialStream,
STGM_READ, m_TEMPDATA,
m_TEMPDATA_LENGTH, m_TEMPDATA_STATUS)
END_ACCESSOR()
END_ACCESSOR_MAP()
};
void CMyDlg::Func()
{
CTable <CAccessor<COLLABORATION> > collabSourceTable;
hr = collabSourceTable.Open(seSource,_T("COLLABORATION"),&propset);
CString strName;
if ( hr == S_OK )
{
if (collabSourceTable.MoveFirst()==S_OK)
{
while(TRUE)
{
hr = collabSourceTable.GetData(1);
strName = collabSourceTable.m_NAME;
hr = collabSourceTable.MoveNext();
if ( hr != S_OK )
break;
}
}
}
}
Now i cant understand how to get binary data from the multiple accessors?. When i pass zero to the collabSourceTable.GetData(0);. It returns HR_OK. But when i pass 1 to collabSourceTable.GetData(1) to get the binary data. It gives error, hr = DB_E_UNSUPPORTEDCONVERSION. Can anyone help me with this. Thank you.
-- modified at 5:36 Monday 26th September, 2005
|
|
|
|
|
Hello to everybody!
Let us say, I want to create all the application that uses WTL by my own hands (avoiding using wizards). I want to create a modal dialog, and put some controls there. I write this code :
<br />
#include <atlbase.h><br />
#include <atlapp.h><br />
<br />
extern CAppModule _Module;<br />
<br />
#include <atlwin.h><br />
#include <atlctrls.h><br />
#include <atlframe.h><br />
<br />
#include "resource.h"<br />
<br />
CAppModule _Module;<br />
<br />
<br />
<br />
<br />
class CMyDialog: public CDialogImpl<CMyDialog> {<br />
public: <br />
enum {IDD=IDD_DIALOG1};<br />
<br />
BEGIN_MSG_MAP(CMyDialog)<br />
COMMAND_ID_HANDLER(IDOK,OnOk)<br />
COMMAND_ID_HANDLER(IDCANCEL,OnCancel)<br />
END_MSG_MAP()<br />
<br />
<br />
LRESULT OnOk(WORD,WORD,HWND,BOOL&) {<br />
EndDialog(0);<br />
return 0;<br />
}<br />
<br />
LRESULT OnCancel(WORD,WORD,HWND,BOOL&) {<br />
EndDialog(1);<br />
return 0;<br />
}<br />
};<br />
<br />
<br />
int WinMain (HINSTANCE hInst,HINSTANCE,LPSTR,int) {<br />
_Module.Init(NULL,hInst);<br />
<br />
CMyDialog diag;<br />
int res=diag.DoModal();<br />
<br />
_Module.Term(); <br />
return 0;<br />
}<br />
Than let's create a dialog with IDD=IDD_DIALOG1. I have VS6, so I go to the item in main menu Insert -> Resource... (QUESTION : IS THIS THE RIGHT WAY ?), then I choose Dialog etc. Then I add resource.h and test.rc (let it have that name) to my project. Compiling.... Ok. Running... ALL RIGHT. Now. I take a slider and put it on the dialog. Compile... OK. Running... Ooops. The variable res in the line int res=diag.DoModal() return -1. And of cource I cannot see anything on screen, application terminating.... If I put a button or combo on dialog, everything would be OK. I noticed, that if I put some other controls on dialog then I would have the same trouble ! What's wrong with this ? I suspect, that I do something wrong with resource adding..
|
|
|
|
|
how to copy a BSTR to char array? :-?
char sz[20];
BSTR *bstr;
[i tried the below code, but didn't work]
strcpy(sz,W2T(bstr));
Err:
D:\PROJ\CTI MFC FW\ATL53\AT53.cpp(16) : error C2065: '_lpw' : undeclared identifier
D:\PROJ\CTI MFC FW\ATL53\AT53.cpp(16) : error C2440: '=' : cannot convert from 'unsigned short ** ' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
D:\PROJ\CTI MFC FW\ATL53\AT53.cpp(16) : error C2065: '_convert' : undeclared identifier
Thanks
V
|
|
|
|
|
Insert USES_CONVERSION before using one of the conversion macros.
|
|
|
|
|
W2A means Wide to Ascii
W2T means Wide to TCHAR, and TCHAR is Wide or Ascii, depending on if _UNICODE is defined or not. You will want to use W2A.
Good music: In my rosary[^]
|
|
|
|
|
Hello All,
I am developing two different application in MFC. but i want to access same address space which is created by one. i want to create linklist created by one application and accessing by another.
I am beginner in COM & DOCM. if any one knows please help me.
Thanks in advance
Regards
Rajesh
|
|
|
|
|
rajesh_kapure wrote:
I am developing two different application in MFC. but i want to access same address space which is created by one. i want to create linklist created by one application and accessing by another. I am beginner in COM & DOCM. if any one knows please help me.
These are you options on Windows:
Windows Interprocess Communications[^]
|
|
|
|
|
Thanks, but i want to access same memory location from different application.
and for sharing same address space that artical contain only one solu'n 'File Mapping'.
Is any solu'n for accessing same address space.
waiting for reply.
Regards,
Rajesh
|
|
|
|
|
rajesh_kapure wrote:
Thanks, but i want to access same memory location from different application.
and for sharing same address space that artical contain only one solu'n 'File Mapping'.
Memory for Win32 programs is protected (in principle). You can define global variables that are accessible from more than one program. Don't remember how you do it (you need some sort of pragma) and it's very bad style anyway.
|
|
|
|
|
I implemented a ATL service in VC++ which notify me if any new file is created at certain path. But i want to know to the information about the file like it's name, creation time, size etc.
How can i do this.
please help me.
|
|
|
|
|
i'm able to add methods to an Interface that returns integer value, like i declared
[Add method]
method name : MathAdd
parameters : int x,int y,[out,retval]*int sum;
[/Add method]
and the implementaion,
STDMETHODIMP StATL::MathAdd(int x, int y, int *sum)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
*sum = x + y;
return S_OK;
}
and i'm using this in a VB application thru referncing.
Now, how do i make a method thats gonna return a char value,
i tried like ,
[Add Method]
Method Name : ReturnString
Parameters : char * inpString,[out,retval]char *outString
[Add Method]
STDMETHODIMP StATL::ReturnString(char *inpString, char *outString)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
strcpy(outString,inString);
return S_OK;
}
but i get the following errors, (see the following thread, it looks akward if i put it here)
plz note : this is my first attempt in ATL
thankx
Vdio\vc98\atl\include\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" cstatl=""> >::CreateInstance(void *,const struct _GUID &,void
** )'
[/stink] .
how to go
plz note : this is my first attempt in ATL
thankx
V
|
|
|
|
|
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(1827) : error C2259: 'CComObject<class cstatl="">' : cannot instantiate abstract class due to following members:
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" cstatl=""> >::CreateInstance(void *,const struct _GUID &,void
** )'
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(1827) : warning C4259: 'long __stdcall IStATL::ReturnString(unsigned char *,unsigned char *)' : pure virtual function was not defined
d:\proj\stratl\stratl.h(80) : see declaration of 'ReturnString'
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" cstatl=""> >::CreateInstance(void *,const struct _GUID &,void
** )'
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(1827) : error C2259: 'CComObject<class cstatl="">' : cannot instantiate abstract class due to following members:
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" cstatl=""> >::CreateInstance(void *,const struct _GUID &,void
** )'
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(1827) : warning C4259: 'long __stdcall IStATL::ReturnString(unsigned char *,unsigned char *)' : pure virtual function was not defined
d:\proj\stratl\stratl.h(80) : see declaration of 'ReturnString'
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" cstatl=""> >::CreateInstance(void *,const struct _GUID &,void
** )'
V
|
|
|
|
|
|
yeah.. i get u . thanks
V
|
|
|
|
|
did it work for you? how? because I tried it out using BSTR as the type of property to return but when I tried to put a string or even a character to the variable
STD....... (BSTR *pVal)
{
....
*pVal = "Hello";
}
error about conversion occurs for the above code snippet
|
|
|
|
|