|
|
OK, so when you call it from the VS2008 DLL, what function call fails (is it CoCreateInstance possibly) and what error status does it return?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
It is throwing compilation errors. Not identifying Interface identifier.
|
|
|
|
|
Right, that's kind of an important detail.
If I were you, I'd take note of what Roger said, and use #import[^] to get a reference to the VS80 DLLs. The code generated by MIDL has changed enough between VC6 and VS2008 that I wouldn't guarantee that VS2008 MIDL code will compile under VC6.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
First of all: are we talking about a compile time error or a runtime error?
rana ray wrote: my vs 6.0 com dll is not identifying VS 2008 com dll's interface.
I have included my vs2008's _i.c file and header file as well in my VS 6.0 com dll.
What does this mean?
How do you "import" the COM server you're trying to use? Are you using the #import statement? If you are: what does it look like?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
As there are 2com dll. I am using one com dll to import other. so in first one i have used cocreateinstance to instantiate my vs 2008 com dll.
|
|
|
|
|
The class name for the WMP ActiveX control is with the name of WMPVideoWindow.
I can use MSAA tech to retrieve the IAccessible* and IServiceProvider*, but I don't know how to get the WMP related interfaces.
Who can give me some ideas?
thanks.
|
|
|
|
|
Hello All,
I am trying to convert a list of Strings in LPWSTR* array. I am using the following way to convert it. But here the problem occurs in the returning array items. It contains all the elements same in the array. I found the problme is due to memset() which updates the memory address everytime same as earlier. Please help me out----
for(DWORD i = 0; i < itemIds->Count; i++)
{
ATL::CComBSTR itemWChar;
itemWChar = ::GetAtlBstr(itemIds[i]);
WCHAR _itemWChar[_MAX_PATH];
memset(_itemWChar, 0, sizeof(_itemWChar) / sizeof(_itemWChar[0]));
memcpy(_itemWChar, static_cast<bstr>(itemWChar), itemWChar.ByteLength());
items[i] = _itemWChar;
}
ANURAG VISHNOI,
Sr. Software Engineer,
|
|
|
|
|
Firstly, make sure you have the checkbox labelled "Auto-encode HTML when pasting?" ticked before you paste code. That way, your template parameter lists won't get hidden.
Secondly, your problem is that you are assigning the same string to each element of items. Nothing to do with memset.
Try this:
for(DWORD i = 0; i < itemIds->Count; i++)
{
ATL::CComBSTR itemWChar;
itemWChar = ::GetAtlBstr(itemIds[i]);
WCHAR* _itemWChar = new WCHAR[itemWChar.ByteLength()];
memset(_itemWChar, 0, sizeof(_itemWChar) / sizeof(_itemWChar[0]));
memcpy(_itemWChar, static_cast<bstr>(itemWChar), itemWChar.ByteLength());
items[i] = _itemWChar;
}
This allocates a new block of memory for each BSTR copy (don't forget to delete[] it!). BTW - if your BSTRs definitely contain wide characters, then you should probably use this code instead:
for(DWORD i = 0; i < itemIds->Count; i++)
{
ATL::CComBSTR itemWChar;
itemWChar = ::GetAtlBstr(itemIds[i]);
WCHAR* _itemWChar = new WCHAR[itemWChar.Length()+1];
wcsncpy(_itemWChar, static_cast<bstr>(itemWChar), itemWChar.Length());
_itemWChar[itemWChar.Length()] = 0;
items[i] = _itemWChar;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello Stuart,
You really put my life in heaven.
Thanks Alot dude.....
ANURAG VISHNOI,
Sr. Software Engineer,
modified on Thursday, April 23, 2009 5:49 AM
|
|
|
|
|
How to compute difference and intersection of two sets?
There are functions set_difference and set_intersection which requires two pairs of iterators of source sets and output iterator of resulting set. Here, set can be any sorted container with incrementable iterator. There is another requirement that the output should be large enough to contain the destination range.
For STL-set, however, you cannot set the size of it and using an empty set as output leads to assertion. In fact, output iterator of destination empty set is equal to end() and incrementing iterator does not add elements to a set.
So how to compute this?
|
|
|
|
|
Use std::inserter[^] or std::back_inserter[^] for the output iterator. That causes the items to be inserted into the container without having to know what size it should be before you've constructed it.
If you're using a vector or list as the output, I'd use std::back_inserter. For a set, std::inserter is required. Here's an example:
#include <vector>
#include <set>
#include <iostream>
#include <algorithm>
#include <iterator>
int main()
{
std::set<int> a, b, c;
a.insert(1);
a.insert(2);
a.insert(3);
a.insert(4);
b.insert(2);
b.insert(4);
b.insert(5);
b.insert(7);
std::vector<int> d;
std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(c, c.end()));
std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::back_inserter(d));
std::copy(c.begin(), c.end(), std::ostream_iterator<int>(std::cout, " "));
std::copy(d.begin(), d.end(), std::ostream_iterator<int>(std::cout, " "));
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
HI
i need to convert a vc6 project to dotnet2008. i took ATL new project and i added my old vc++ files.
i got some more errors..that everything i fixed...exept one..that is
Error 1 error LNK2001: unresolved external symbol _CLSID_ABC ABC.obj AppFast<br />
Error 2 fatal error LNK1120: 1 unresolved externals .........ABC.dll 1 ABC
the code is like this..in my header file
EXTERN_C const CLSID CLSID_ABC;
#ifdef __cplusplus
class DECLSPEC_UUID("97676011-B0FA-40cf-AECC-7BD3FF54BE4E")
ABC;
#endif
what is wrong...i dont know much about c++
i m working in c# and vb in dotnet2005
Please ,,,i m expecting helps
Regards
Raj
|
|
|
|
|
Rajeesh MP wrote: i need to convert a vc6 project to dotnet2008. i took ATL new project and i added my old vc++ files.
You probably should just have opened the VC6 project in VS2008 - it would have converted it to the right format just fine.
Rajeesh MP wrote: EXTERN_C const CLSID CLSID_ABC;
I suspect that DECLSPEC_UUID doesn't mean quite the same as it used to or something. You need to add a definition of CLSID_ABC to a .cpp file somewhere.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Dear Stuart
Uuid is same only..
i have a doubt
#ifndef __AppFastLib_LIBRARY_DEFINED__
#define __AppFastLib_LIBRARY_DEFINED__
EXTERN_C const IID LIBID_AppFastLib;
#endif /* __AppFastLib_LIBRARY_DEFINED__ */
this is generating at compiling time in ABC_i.h
if i m manualy trying to add my code. That would be deleted...
EXTERN_C const CLSID CLSID_ABC;
#ifdef __cplusplus
class DECLSPEC_UUID("97676011-B0FA-40cf-AECC-7BD3FF54BE4E")
ABC;
#endif
how do i add this class instant in ABC_i.h
Regards
Rajeesh
|
|
|
|
|
I've just had a look at an ATL project I've got. The CLSID for my class is defined in my equivalent of ABC_i.c - is that file (ABC_i.c) being compiled and linked in your project?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
i dont know much more abt this vc++..
how do i link my class to this ABC_i.c
i need to give any reference or any alternate methord..??
After compiling...ABC_i.c is generating...with out my CLSID of my class
|
|
|
|
|
Right-click on ABC_i.c in Solution Explorer and select Properties. Under Configuration Properties->General, the 'Excluded from Build' property should be set to 'No'.
Now rebuild the project. At some point, in the output window, you should see mention of ABC_i.c - that means it is being compiled. Hopefully the project will automatically link with ABC_i.c - if it doesn't, I'm not sure why....
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
there is no luck for me...
//======================================================================================
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 7.00.0500 */
/* at Sat Apr 18 14:23:13 2009
*/
/* Compiler settings for .\AppFast.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, robust
error checks: stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING( )
#pragma warning( disable: 4049 ) /* more than 64k source lines */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__
#ifndef __ABC_i_h__
#define __ABC_i_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __ABCLib_LIBRARY_DEFINED__
#define __ABCLib_LIBRARY_DEFINED__
/* library ABCLib */
/* [helpstring][version][uuid] */
EXTERN_C const IID LIBID_ABCLib;
#endif /* __ABCLib_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif
//======================================================================================
this is my generated ABC_i.c....
After this code
EXTERN_C const IID LIBID_ABCLib;
i need to add want to add this code...
EXTERN_C const CLSID CLSID_ABCPP;
#ifdef __cplusplus
class DECLSPEC_UUID("D85DDEB0-0354-44A0-842C-D264885B8A92")
ABCPP;
#endif
is it possible....Please ...
Regards
Rajeesh
|
|
|
|
|
See, you've confused me now. First you have a linker error, which means that CLSID_ABC was declared in the header, but not defined anywhere. Now you're saying you need to add some code into the header...now, that's not going to help with your linker errors at all.
Rajeesh MP wrote: this is my generated ABC_i.c....
Also - you didn't actually post your ABC_i.c file.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
no dear... i will explain u very simply.....
if i am adding a class to my ATL application...that class id will generate automatically in our ABC_i.h....
but i m trying to add my existing file to my application...After compiling time this existing CLASSID is not generating in our ABC_i.h
so my question after adding this excisting ABC.cpp i need do something in our application settings..for generating this classid..
Regards
Raj
|
|
|
|
|
Rajeesh MP wrote: if i am adding a class to my ATL application...that class id will generate automatically in our ABC_i.h....
Fine - we agree on that
Rajeesh MP wrote: but i m trying to add my existing file to my application...After compiling time this existing CLASSID is not generating in our ABC_i.h
By 'existing file', I presume you mean the IDL file that contains that class and interface definition? Or not?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Good MOrning...Stuart
NO...directly i m adding ABCD.cpp and ABCD.h file
why..there is no other post...??only we are here...ha ha ha
Mr.Staurt ..can u add me on ur personel mail...
my id rajeeshmp@gmail.com
Regards,
Rajeesh MP
modified on Wednesday, April 22, 2009 12:16 AM
|
|
|
|
|
Rajeesh MP wrote: NO...directly i m adding ABCD.cpp and ABCD.h file
OK - finally, I think I'm clear on why you're having these problems
So...let me tell you what I've done and let's see if that helps.
I first created an ActiveX project called "ax-ctrl", with a simple ActiveX object called "test". That built fine. It contained files test.h and test.cpp (for the object) and axctrl_i.c and axctrl_i.h (for the ActiveX library).
I then created another ActiveX project called "ax-copy" and added test.cpp and test.h to that without moving them from the existing project. When I built that project, it complained about missing symbols like this:
3>test.obj : error LNK2001: unresolved external symbol _IID_Itest
3>test.obj : error LNK2001: unresolved external symbol _LIBID_axctrlLib
I then added axctrl_i.c to the ax-copy project and (after telling it not to use precompiled headers) it worked fine.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|