473,396 Members | 1,785 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,396 software developers and data experts.

LocalAlloc

Hello,

I have following C++ code:
the Memory should be larger than the struct

STRUCT struct1 = (STRUCT) LocalAlloc(LPTR, 100);

how can I perform this in C#
I want this, because I need to call a C++ dll
Nov 15 '05 #1
1 3733

"Dirk Reske" <_F*******@gmx.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello,

I have following C++ code:
the Memory should be larger than the struct

STRUCT struct1 = (STRUCT) LocalAlloc(LPTR, 100);

how can I perform this in C#
I want this, because I need to call a C++ dll
Well, without seeing the structure, I'd probably say add a byte[] at the end
of the structure with a MarshalAs(UnmanagedType.ByValArray,SizeConst=100)
attribute applied to that field.

Nov 15 '05 #2

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

Similar topics

5
by: Allen | last post by:
Hi all, I want to make a buffer of structs but I don't want to have a static size; I want it to be as dynamic as possible. Ordinarily, I would use a list, but in this case I really want to...
7
by: Allen | last post by:
Hi all, I have an array that I don't know the size requirement until run-time. The way I handle this is: int* piMyData; piMyData = (int*)LocalAlloc(LPTR, sizeof(int)*iDataCount); ...
4
by: H?seyin | last post by:
I'm calling a function from a C DLL in .NET(C#). The func. seems so: void Sample(char *s) { s= calloc(6,1); strcpy(s, "hello"); }
0
by: grstefan | last post by:
Hi I am using the following code to grab an image to a byte array. The problem is, that it works for bibitcount 24 but not for 8. I read that it is possible to add a 8bit palette to make an...
2
by: dever | last post by:
I checked my color printers's Printersettings.SupportsColor, which all showed false. What is wrong that I could not use this property. Also, what other way to detect if a printer is color...
7
by: vansky | last post by:
Dear all, im porting a WIN APP to LINUX, and face some problems that r hard for me to solve, could u dear guys give me some hands? i'd like to reimplement the following funcs or replace them...
52
by: ¬a\\/b | last post by:
is it possible that a malloc function that use a nobody student is better than all yours :) How many errors do you see? Bug1: memory<13MB Bug2: it seems do you have to write you own sprintf...
2
by: =?Utf-8?B?QWxleCBLLg==?= | last post by:
Hi all My TreeView has unicode and english labels. The treeview shows OK on the screen. When I am trying to get an item's label using TVM_GETITEM API message, the buffer returned by SendMessage...
5
by: mahesh123 | last post by:
Hi Folks, I am to retrive the all URL's ie web sites from the system at a perticular time? Its Very Urgent for me. Regards ------------ Mahesh
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...
0
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...
0
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,...

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.