Hi,
Environment: VS2005 standard, programming app/service for WinCE 5.0
I'm trying to use the Win32 DeviceIoControl (...) from C# with P/
Invoke.
In my managed C# code the inbuffer of DeviceIoControl is defined as
int[], but the data (type of buffer) I want to use is not. Actullay is
an array of a selv-defined class:
TPhonebook[] myPonebook = new TPhonebook[100];
The error description says: cannot convert from TPhonebook[]' to
'int[]'.
In C++ it is very easy to force a type conversion, but how is this
accomplished in C#?
Regards,
Jonas 2 1355
<ti********@hot mail.comwrote:
Environment: VS2005 standard, programming app/service for WinCE 5.0
I'm trying to use the Win32 DeviceIoControl (...) from C# with P/
Invoke.
In my managed C# code the inbuffer of DeviceIoControl is defined as
int[], but the data (type of buffer) I want to use is not. Actullay is
an array of a selv-defined class:
TPhonebook[] myPonebook = new TPhonebook[100];
The error description says: cannot convert from TPhonebook[]' to
'int[]'.
In C++ it is very easy to force a type conversion, but how is this
accomplished in C#?
Have a look at Array.ConvertAl l. Basically, you provide a converter
delegate which can convert a TPhoneBook into an int, and
Array.ConvertAl l will produce a new int[] for you.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jonas,
In C#, you are going to have to iterate through the array of
classes/structures and assign the values you want to a new integer array
instance.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
<ti********@hot mail.comwrote in message
news:11******** **************@ y80g2000hsf.goo glegroups.com.. .
Hi,
Environment: VS2005 standard, programming app/service for WinCE 5.0
I'm trying to use the Win32 DeviceIoControl (...) from C# with P/
Invoke.
In my managed C# code the inbuffer of DeviceIoControl is defined as
int[], but the data (type of buffer) I want to use is not. Actullay is
an array of a selv-defined class:
TPhonebook[] myPonebook = new TPhonebook[100];
The error description says: cannot convert from TPhonebook[]' to
'int[]'.
In C++ it is very easy to force a type conversion, but how is this
accomplished in C#?
Regards,
Jonas This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nitin Bhardwaj |
last post by:
Hi all,
It is said that C++ is a strongly typed language and thus a type-safe
language (unlike C). So how does one explain the following behaviour :
int main(void)
{
char *p = NULL;
p = "A String Literal";//the compiler isuues no error/warning here
// but ideally it should...as p is a non-const
|
by: Master of C++ |
last post by:
Hi,
This is a simple question. In the following example,
.. class Vector
.. {
.. private:
.. int *Numbers;
.. int vLength;
..
|
by: pgconnolly |
last post by:
/* foreach does implicit type conversion on elements of a params argument or
Generic.List.
* This is not good.
* Examples of evil follow...
*/
using System;
// I love it when C# is strict with me...
using System.Collections.Generic;
|
by: Enekajmer |
last post by:
Hi,
1 int main()
2 {
3 float a = 17.5;
4 printf("%d\n", a);
5 printf("%d\n", *(int *)&a);
6 return 0;
7 }
|
by: Martin v. Löwis |
last post by:
I've been working on PEP 353 for some time now.
Please comment, in particular if you are using 64-bit
systems.
Regards,
Martin
PEP: 353
Title: Using ssize_t as the index type
Version: $Revision: 42333 $
| |
by: Xah Lee |
last post by:
in March, i posted a essay “What is Expressiveness in a Computer
Language”, archived at:
http://xahlee.org/perl-python/what_is_expresiveness.html
I was informed then that there is a academic paper written on this
subject.
On the Expressive Power of Programming Languages, by Matthias
Felleisen, 1990.
http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
|
by: NM |
last post by:
I am given an int and have to tell whether the bit representation of that
int is a palindrome or not.
Here is what I have come up with
bool isIntPalindrome(int num)
{
unsigned int temp = num;
int reversed = 0;
while (num != 0) {
|
by: zaeminkr |
last post by:
I got a good answer here I have still confusing part.
I have two very simple classes
class DRect
{
private :
double x0, y0, x1, y1;
public :
DRect(double a, double b, double c, double d) : x0(a), y0(b),
|
by: Steven |
last post by:
Hello, everyone!
I find a version of strcpy(), I don't know why it return the unsigned
char value.
Can I change it into return *s1-*s2?
int strcmp(const char *s1, const char *s2)
{
while (*s1 == *s2)
{
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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,...
|
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...
|
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...
|
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();...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |