473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem with SAFEARRAY as property accessors.

i want to store binary data into my property. i read earlier positing on
"microsoft.public.dotnet.languages.vc" group with subject as SAFEARRAY in
attributed ATL7 Project. i followed the same approach but unfortunately i
failed to do that.
i declared the property accessors as follow in my idl file.

[propget, id(2), helpstring("property Data")] HRESULT Data([out, retval,
satype(byte)] SAFEARRAY * *pVal);
[propput, id(2), helpstring("property Data")] HRESULT Data([in,
satype(byte)] SAFEARRAY * newVal);

when i compile code i get following error.
error MIDL2025 : syntax error : expecting ] or , near "satype".

any body there to help me.

Thanks in advance.

Ahmad Jalil Qarshi


Nov 17 '05 #1
5 3082
"Ahmad Jalil Qarshi" <ah*********@SPAMhotmail.com> wrote in message
news:ui*************@tk2msftngp13.phx.gbl
[propget, id(2), helpstring("property Data")] HRESULT Data([out,
retval, satype(byte)] SAFEARRAY * *pVal);
[propput, id(2), helpstring("property Data")] HRESULT Data([in,
satype(byte)] SAFEARRAY * newVal);

when i compile code i get following error.
error MIDL2025 : syntax error : expecting ] or , near "satype".


In IDL, the syntax is different:

[propget, id(2), helpstring("property Data")]
HRESULT Data([out, retval] SAFEARRAY(BYTE) *pVal);
[propput, id(2), helpstring("property Data")]
HRESULT Data([in] SAFEARRAY(BYTE) newVal);

The syntax in your post is used in a .cpp file when building an
attributed project.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Nov 17 '05 #2
Thanks Igor!
i have done that according to your instruction. but still i get same error
twice which is here under.

error C2259: 'CComObject<class CTestLoadObj>' : 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
CTestLoadObj> >::CreateInstance(void *,const struct _GUID
&,void ** )'

could you plz tell me how to define these properties in .cpp file also.
i suppose that it would be like that:
STDMETHODIMP CTestLoadObj::get_Data(SAFEARRAY *pVal)
{
}
STDMETHODIMP CTestLoadObj::put_Data(SAFEARRAY pVal)
{
}
but i m sure that i m wrong that's y i m getting errors. please guide me.
Thanks in advance.
Ahmad Jalil Qarshi
"Igor Tandetnik" <it********@mvps.org> wrote in message
news:Ok**************@TK2MSFTNGP15.phx.gbl...
"Ahmad Jalil Qarshi" <ah*********@SPAMhotmail.com> wrote in message
news:ui*************@tk2msftngp13.phx.gbl
[propget, id(2), helpstring("property Data")] HRESULT Data([out,
retval, satype(byte)] SAFEARRAY * *pVal);
[propput, id(2), helpstring("property Data")] HRESULT Data([in,
satype(byte)] SAFEARRAY * newVal);

when i compile code i get following error.
error MIDL2025 : syntax error : expecting ] or , near "satype".


In IDL, the syntax is different:

[propget, id(2), helpstring("property Data")]
HRESULT Data([out, retval] SAFEARRAY(BYTE) *pVal);
[propput, id(2), helpstring("property Data")]
HRESULT Data([in] SAFEARRAY(BYTE) newVal);

The syntax in your post is used in a .cpp file when building an
attributed project.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925

Nov 17 '05 #3
"Ahmad Jalil Qarshi" <ah*********@SPAMhotmail.com> wrote in message
news:ur*************@TK2MSFTNGP12.phx.gbl
error C2259: 'CComObject<class CTestLoadObj>' : 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 CTestLoadObj> >::CreateInstance(void *,const
struct _GUID &,void ** )'

could you plz tell me how to define these properties in .cpp file
also.
i suppose that it would be like that:
STDMETHODIMP CTestLoadObj::get_Data(SAFEARRAY *pVal)
{
}
STDMETHODIMP CTestLoadObj::put_Data(SAFEARRAY pVal)
{
}


A SAFEARRAY(Whatever) parameter in IDL becomes SAFEARRAY* in C++.
SAFEARRAY(Whatever)* becomes SAFEARRAY**, and so on. In other words, in
C++ you always specify one extra level of indirection compared to IDL
syntax.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Nov 17 '05 #4
Thanks again!
i have done that. its compiled now successfully. but my object is not
persisting this safearray, whereas other properties of this object persist.
Isn't it possible to persist SAFEARRAYs.
Thanks.
Ahmad Jalil Qarshi

"Igor Tandetnik" <it********@mvps.org> wrote in message
news:uF*************@TK2MSFTNGP09.phx.gbl...
"Ahmad Jalil Qarshi" <ah*********@SPAMhotmail.com> wrote in message
news:ur*************@TK2MSFTNGP12.phx.gbl
error C2259: 'CComObject<class CTestLoadObj>' : 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 CTestLoadObj> >::CreateInstance(void *,const
struct _GUID &,void ** )'

could you plz tell me how to define these properties in .cpp file
also.
i suppose that it would be like that:
STDMETHODIMP CTestLoadObj::get_Data(SAFEARRAY *pVal)
{
}
STDMETHODIMP CTestLoadObj::put_Data(SAFEARRAY pVal)
{
}


A SAFEARRAY(Whatever) parameter in IDL becomes SAFEARRAY* in C++.
SAFEARRAY(Whatever)* becomes SAFEARRAY**, and so on. In other words, in
C++ you always specify one extra level of indirection compared to IDL
syntax.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925

Nov 17 '05 #5
"Ahmad Jalil Qarshi" <ah*********@SPAMhotmail.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl
i have done that. its compiled now successfully. but my object is not
persisting this safearray, whereas other properties of this object
persist. Isn't it possible to persist SAFEARRAYs.


ATL persistence implementation (IPersistStreamInitImpl et al) indeed
does not support safearrays. You will have to write your own.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: cody | last post by:
Does the clr allow more than one set and one get method for a property? Is it possible to use overloading for example set_Color(int c), set_Color(Color c)? from msdn: ...
11
by: milkyway | last post by:
Hello, I have an HTML page that I am trying to import 2 .js file (I created) into. These files are: row_functions.js and data_check_functions.js. Whenever I bring the contents of the files into...
5
by: Tronster Hartley | last post by:
I've written an ATL 7.1 component and have a C# 1.1 client that is consuming it. The ATL component has a method with a that returns a SAFEARRAY of INTs, but my C# component chokes on it. The...
8
by: intrepid_dw | last post by:
Hello, all. I've created a C# dll that contains, among other things, two functions dealing with byte arrays. The first is a function that returns a byte array, and the other is intended to...
11
by: wASP | last post by:
Hi, I've got a pair of int properties in a class. The properties in question are indexing values - but that's not relevant to my problem - or it's just symptomatic ... sort of. They are...
37
by: Joergen Bech | last post by:
(Slightly religious question): Suppose I have the following class: ---snip--- Public Class MyClass Private _MyVariable As Integer Public Property MyVariable() As Integer Get
7
by: none | last post by:
I'm trying to implement a simple repeateable property mechansism so I don't have to write accessors for every single instance variable I have. ------------ classMyObject: def __init__ (self):...
2
by: Ben Voigt | last post by:
The C# Language Specification says: A virtual property declaration specifies that the accessors of the property are virtual. The virtual modifier applies to both accessors of a read-write...
19
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I access a property of an object using a string?...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.