|
Fantastic! Thanks guys, you saved me a late night!
|
|
|
|
|
int s are value types. The int that is in tmparray[0] is different from the int that is MyInt1. Read up on value types and reference types.
Colin has answered Q2 very well, so I'll just skip that.
Cheers,
Vikram.
"But nowadays, it means nothing. Features are never frozen, development keeps happening, bugs never get fixed, and documentation is something you might find on wikipedia."
- Marc Clifton on betas. Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
Hi,
we are using vs 2005, for reporting purpose we are using .rdlc file. Here i want to set a parameter field, in design mode. pls help me in this regard
Selva..
|
|
|
|
|
Hi,
Can you help me how to "synchronize" .NET DateTime.Tick and C++ time (CTime, LPSYSTEMTIME, t_time doesn't matter which one) . I need to write certain time to file (using .NET C# -> write Ticks value) and than read it in C++ == create time structure (constructor with !same! ticks or something...) . I'm using old VS 6 C++ !!!
thanx
|
|
|
|
|
I would imaging that the TickCount of DateTime does in fact syncronise to one of the time concepts in c++, but I'm not sure.
If you need to communicate between programs, why not use WM_COPYDATA, or C++/CLI ? Are you using the file to send the time, or does the file have it's own purpose ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
File has it's own purpose, it contains a lot of license data, and some of them is time structure. File is created on server(in C#) and sent to client(and red in C++)...
now I'm looking at DateTime.ToFileTime() method, which maybe resembles _FILETIME structure in C++, but those constructors... omg
|
|
|
|
|
Hello.
So this is my problems:
I have to find a way to save a class of mine to a file.
Solution:
I found serialization and I thought it might work.
But... When I tried BinarySerialization, some chars would just disapear, and I'd get an exception for "not a correct format", so BinarySerialization is OUT of the question (and I tried it in a few ways).
XmlSerialization is throwing non-stopable exceptions, I just went to the one after, so that's out of the question also.
I tried SOAP serialization, but now I came across another problem.
I need to serialize a generic collection which I built. This gives me an exception, saying that it cannot serialize a generic class. (that's after successfuly serializing List<t>).
Another thing that I have with SOAP serialization is that i'm not sure that it'll work in Linux (I was unable to install mono), since I need to import the SOAP class from Windows folder.
Can anyone recommend me on what to do?
Waiting for your help.
NaNg.
|
|
|
|
|
I use C#.net to create datagrid,and I don't know how to add sub columns in grid.
Example:
NANE PRODUCT
PROA PROB
I want to add columns PROA PROB under columns PRODUCT,any body please help me.I have code like this:
Store = new DataTable();
DataRowCollection rows = Store.Rows;
Store.Columns.Add(new DataColumn("Name", typeof(string)));
Store.Columns.Add(new DataColumn("PRODUCT", typeof(string)));
DataRow newRow = Store.NewRow();
newRow[0] = strDocname;
newRow[1] = strProductA;
newRow[2] = strProductB;
Store.Rows.Add(newRow);
myDatagrid.DataSource = StoreView;
StoreView = new DataView(Store);
thank you
|
|
|
|
|
Hi all,
More trouble with unmanaged code calls from C#: I am trying to call a function in C++ that looks something like this:
int DoSomething(const char* string1,const char* string2,const char* string3,<br />
const struct1* someStruct, const bool yesno, int* pos, struct2* anotherStruct)
The corresponding wrapper function in C#:
public static extern bool Do_Something(<br />
[MarshalAs(UnmanagedType.LPStr)] string str1,<br />
[MarshalAs(UnmanagedType.LPStr)] string str2,<br />
[MarshalAs(UnmanagedType.LPStr)] string str3,<br />
StructOne someStruct,<br />
bool YesNo, <br />
ref int pos,<br />
out StructTwo anotherStruct);
The two structs in the unmanaged code (struct1 and struct2) have similar corresponding definitions in the C# code (in this example, called StructOne and StructTwo). These struct defintions are preceded by the following line:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]
Admittedly, I am not quite sure what it does (I'm adding onto someone else's code and am new to C#) but I suppose it has something to do with mapping the C# version of the struct to its C++ counterpart.
The problem: I'm having trouble passing the parameters from the C# wrapper to the C++ routine and am getting AccessViolationExceptions. On stepping through the C++ code, I have found that all the parameters from struct1 onwards are null (the YesNo bool is always false regardless of how it is set in the C# wrapper). All the strings are passed correctly. My feeling is that I have failed to set something up correctly (thus resulting in the program trying to use 'protected' memory), but having checked and rechecked the code (ensuring for instance that there are equivalent members for each of the two C# structs and its corresponding mate in C++), I cannot locate the offending part of the program.
Can anyone help?
thanks
|
|
|
|
|
Hi,
in C# a struct is a value type, but your native function expects a struct pointer,
hence a reference. Adding ref to your wrapper function Something may be sufficient
(depends on the kinds of members in your struct).
AccessViolation typically means some pointer is bad, in this case struct data is used
as a pointer...
In general, to get interop debugged, my advice is add logging code to both sides,
and reduce each problem to its simplest instance, then experiment if you dont
understand what is going on...
|
|
|
|
|
That was exactly what was missing. Works fantastically now. Thanks Luc
On your comment on logging, sounds like a great idea but what information could I garner from this method which I am not able to by debugging it conventionally? (This is not sarcasm, I'm still rather new to the whole software engineering thing and am still feeling my way around concepts like source control and logging)
cheers!
|
|
|
|
|
Hi,
logging provides the information automatically and systematically;
you can get the same info by debugging interactively, but one typically fails
to do that systematically, so I prefer to get log files and read them carefully
when something fails.
|
|
|
|
|
Thanks for the clarification.
cheers!
Joseph
|
|
|
|
|
How do I write to the Visual Studio Output window? Can I read user input from there like I can in Eclipse?
_____________________________
...and justice for all
APe
|
|
|
|
|
Console.WriteLine will appear there. I don't think you can read it, no.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Ok, thanks!
_____________________________
...and justice for all
APe
|
|
|
|
|
Hi frnz....this is an urgent requirement...plz help as soon as possible...
I am creating a tool which runs a batch process for color replacement....
I select a folder which contains all the bitmaps.
I give the input RGB color and the output RGB values.
In all the bitmaps the the color having input RGB should be replaced with a color having output RGB value...i dont know how to replace the colors using C#...plz help me out..
P.S. if anyone can tell me where i can get the color dropper code...that will be of gr8 help...
|
|
|
|
|
You need to read my image processing articles, they show how to access the bits of an image. It will need to be 24 or 32 bit, so the full range of colors is available, then color mapping is trivial
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thanx Chris...can u gimme the link for ur articles...
|
|
|
|
|
|
|
Hello there,
I'm having some weird issues using the "topmost" property of a form.
I want a form to be put on top of all other windows when a specific event occurs. So the code is triggered in a timer event, I just do:
this.TopMost = true;
this.TopMost = false;
This works ... most of the time, sometimes it does not make the form at the top at all, and in one machine I have access to when it works, it acts weird as it stays topmost although I click at other windows, until I click on the form and click back anywhere else, then it goes to the back properly.
Is there any documented/undocumented bug with topmost property in forms? I'm up to a point where I'm sure there is nothing in my code messing with that, and it's giving me some major headaches this issue.
|
|
|
|
|
I suspect that you're doing it too quick, try BringToFront instead. It's not normal to make a form topmost and then change it back right away.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I did actually tried BringToFront, with the exact same results. Let me explain further. The form in fact do go to topmost level most of the time, but sometimes it stops coming to the front, and the other issue with the "double focus" also happens using BringToFront.
|
|
|
|
|
Help me!
I want to know the face detection and face recognization in C#. Nobody known to help me.
Thank so much.
My Email: leminhtuan75@yahoo.com
Học, học nữa, học mãi.
V.I.Lê Nin.
|
|
|
|