473,799 Members | 3,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with SAFEARRAY as property accessors.

i want to store binary data into my property. i read earlier positing on
"microsoft.publ ic.dotnet.langu ages.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("pro perty Data")] HRESULT Data([out, retval,
satype(byte)] SAFEARRAY * *pVal);
[propput, id(2), helpstring("pro perty 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 3112
"Ahmad Jalil Qarshi" <ah*********@SP AMhotmail.com> wrote in message
news:ui******** *****@tk2msftng p13.phx.gbl
[propget, id(2), helpstring("pro perty Data")] HRESULT Data([out,
retval, satype(byte)] SAFEARRAY * *pVal);
[propput, id(2), helpstring("pro perty 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("pro perty Data")]
HRESULT Data([out, retval] SAFEARRAY(BYTE) *pVal);
[propput, id(2), helpstring("pro perty 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<cla ss 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::CComCreato r<class ATL::CComObject <class
CTestLoadObj> >::CreateInstan ce(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::g et_Data(SAFEARR AY *pVal)
{
}
STDMETHODIMP CTestLoadObj::p ut_Data(SAFEARR AY 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********@mvp s.org> wrote in message
news:Ok******** ******@TK2MSFTN GP15.phx.gbl...
"Ahmad Jalil Qarshi" <ah*********@SP AMhotmail.com> wrote in message
news:ui******** *****@tk2msftng p13.phx.gbl
[propget, id(2), helpstring("pro perty Data")] HRESULT Data([out,
retval, satype(byte)] SAFEARRAY * *pVal);
[propput, id(2), helpstring("pro perty 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("pro perty Data")]
HRESULT Data([out, retval] SAFEARRAY(BYTE) *pVal);
[propput, id(2), helpstring("pro perty 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*********@SP AMhotmail.com> wrote in message
news:ur******** *****@TK2MSFTNG P12.phx.gbl
error C2259: 'CComObject<cla ss 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::CComCreato r<class
ATL::CComObject <class CTestLoadObj> >::CreateInstan ce(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::g et_Data(SAFEARR AY *pVal)
{
}
STDMETHODIMP CTestLoadObj::p ut_Data(SAFEARR AY pVal)
{
}


A SAFEARRAY(Whate ver) parameter in IDL becomes SAFEARRAY* in C++.
SAFEARRAY(Whate ver)* 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********@mvp s.org> wrote in message
news:uF******** *****@TK2MSFTNG P09.phx.gbl...
"Ahmad Jalil Qarshi" <ah*********@SP AMhotmail.com> wrote in message
news:ur******** *****@TK2MSFTNG P12.phx.gbl
error C2259: 'CComObject<cla ss 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::CComCreato r<class
ATL::CComObject <class CTestLoadObj> >::CreateInstan ce(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::g et_Data(SAFEARR AY *pVal)
{
}
STDMETHODIMP CTestLoadObj::p ut_Data(SAFEARR AY pVal)
{
}


A SAFEARRAY(Whate ver) parameter in IDL becomes SAFEARRAY* in C++.
SAFEARRAY(Whate ver)* 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*********@SP AMhotmail.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.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 (IPersistStream InitImpl 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
1738
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: PropertyInfo.GetAccessors Method () Return Value An array of MethodInfo objects that reflect the public get, set, *and other
11
1926
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 this HTML file, all is OK but whenever the functions are separated (as it is now), when I run the page, I get the following error: Line 73, object expected.
5
6929
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 C# code: // Display a message box with a value from the ATL control private void GoButton_Click(object sender, System.EventArgs e) {
8
10719
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 receive a byte array as one of its parameters. The project is marked for COM interop, and that all proceeds normally. When I reference the type library in the VB6 project, and write the code to call the function that returns the byte array, it works
11
1376
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 declared as follows:
37
2609
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
1501
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): self.initialize() def initialize(self): self._value=None
2
9764
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 property - it is not possible for only one accessor of a read-write property to be virtual. An abstract property declaration specifies that the accessors of the property are virtual, but does not provide an actual implementation of the accessors....
19
2638
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I access a property of an object using a string? ----------------------------------------------------------------------- There are two equivalent ways to access properties: the dot notation and the square bracket notation. What you are looking for is the square bracket notation in which the dot, and the identifier to its right, are replaced with a...
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10214
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9067
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5459
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5583
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.