|
Hey Luc!
Thats not good news!
I did a search on DLLImport & varargs and i was able to find someonthing HERE[^].
Right above the examples it explains the enum types. I found
Cdecl -- The caller cleans the stack. This enables calling functions with varargs,
which makes it appropriate to use for methods that accept a variable number of parameters, such as Printf.
I see in the example how they are using it in the printf. Do you think if i was to change my signature to
private static extern void ic_subcall(string sub_name, long sub_name_len, ref long code, long num_args, icstring var_args1, icstring var_args2, ..., ...);
and used the calling convention documented that i would work?
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
OK, I never tried it this way. I keep my P/Invoke stuff always as simple as possible.
Seems like maintaining stack will not be a problem, but I am still very worried
about marshaling types. Of course, simple value types (int, double, ...) and
strings will probably just work fine, but what about structures, class objects, etc?
|
|
|
|
|
I tried it and it still didn't work. But i think your right, i think its the struct that is messing it up. Thanks anyways for the help!
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
teejayem wrote: I have an unmanaged dll and I'm trying to make a wrapper around it so it can be used in a multiple projects.
In my experience creating a managed wrapper for native code is far simpler using C++/CLI than trying to do it in C#.
led mike
|
|
|
|
|
hey led mike,
Yeah, I actually already have the C++ implementation and i did create a C++/CLI wrapper around it. But when u deploy the CLI dll to the target machine the C++ redistributable package needs to be installed or the dlls need to be deployed w/ it and my boss doesn't wanna deal with that
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
teejayem wrote: and my boss doesn't wanna deal with that
Well your boss is wrong and probably an idiot. I feel your pain brother.
Also, have you verified that? I wouldn't be surprised if the VC runtime DLL's are installed as part of the .NET platform.
led mike
|
|
|
|
|
We're a furniture company, and the latest technology isn't in the companies best interest But, i did verify it. I actually had the problem before on a personal project, and i found that if a C++/CLI, MFC, or Win32 app is created from vs the target machine is supposed to have Microsoft Visual C++ 2008 Redistributable Package (x86)[^] (there's also one for 2005). Maybe there is some setting to fix that, but i didn't look into it too much. I do think it is pretty stupid that even a pure win32 application depends on these dlls!
Don't be overcome by evil, but overcome evil with good
modified on Wednesday, July 30, 2008 7:48 AM
|
|
|
|
|
teejayem wrote: I do think it is pretty stupid that even a pure win32 application depends on these dlls!
Depending on the VC++ version and the target environment they can already be there. This is what I am talking about.
What version of the .NET platform are you requiring be installed. I imagine some version of the C++ runtime is installed with that. Use the version of VC++ that matches that and you might be able to avoid using the redistributable.
led mike
|
|
|
|
|
Hi body...
I have the following problem: I fill a datarow with some data coming from another program, when I try to do DataTable.AddMyRow(Myrow), I get the following exception:
Cannot set column 'BeneficiaryName'. The value violates the MaxLength limit of this column.
Is there a way to set the DataTable in order to "auto truncate" the exceeding length?
Thank you
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
I found my own answer...
I have to use the ColumnChanging event on the table and use the following code:
void ColumnChanging(object sender, DataColumnChangeEventArgs e)
{
if (e.Column.DataType == typeof(string))
{
if (e.ProposedValue.ToString().Length > e.Column.MaxLength)
e.ProposedValue = e.ProposedValue.ToString().Substring(0, e.Column.MaxLength - 1);
}
}
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
Hi,
A treeview control is populated with data
i.e.:
item1
subitem1
subitem2
...
Not sure why when I click on a subitem, the image changes. There are no events that fire this.
When assigning the images, I do assign using imageindex and selectedimageindex
Note that clicking on the parent i.e. the item does NOt change the image whereas clicking on the subitem does.
Do you know why this is occuring please?
Thanks
|
|
|
|
|
Hi,
There are duplicate properties for unselected and selected items, e.g.
TreeView.ImageIndex and SelectedImageIndex.
Check the documentation.
|
|
|
|
|
Hi,
Do not understand what you mean.
Coul dyou please explain?
p.s. I am still searching the msdn for this.
Thanks
|
|
|
|
|
Hi,
PLease note that the image index for both selectedimageindex and imageindex are set to be the same
So the question is why the image changes when i click on a subitem.
Thanks
|
|
|
|
|
arkiboys wrote: why the image changes
from what to what? from one of your images to another one of your images?
If anything is wrong, I expect it to be either a bug in your code which we haven't seen,
or a Windows bug which I personally haven't heard of.
|
|
|
|
|
Yes, it changes to an image with the index 0
When I click away then the original comes back on.
There must be a bug in my code and that is why I am trying to solve this.
Thanks for your time.
|
|
|
|
|
Open up note pad, hold the left control and press backspace. You will produce a rectangle box character which i am not sure if it has any function or not in the operating system but when i pull data from my database, these characters appear where i believe are to be carriage returns.
is there a way to parse/seperate those garbage characters out while still leaving them in the database? If the data is bound to a richtextbox control, the text appears formated with carriage returns correctly
im stuck...
|
|
|
|
|
is it possible that the data is Unicode and you're treating it as normal ascii, or vise versa? i've accidently set varchar columns in the db to use nvarchar and it did some wierd things until i changed it back. they could also be special formatting characters that work in rich text, but a singleline textbox cant show them.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
|
you could use regular expressions to filter the output for testing(until you figure out whats wrong) and only allow certain characters or classes of characters and see what fixes your problem, it isnt a very good permanent solution but it should let you quickly see what is causing the problem and figure out a way to prevent it from bieng loaded into the db or find a way to quickly get rid of it.
Ive found this useful[^]
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hello...
I have a collection, derive from CollectionBase.
If I put that collection to PropertyGrid, I cannot see the item in list.
It shows only Capacity and Count.
How to do that ?
Thx...
|
|
|
|
|
|
|
Hi,
I'm trying to find out if this is possible, and if so how to do it. From a machine running XP or Vista, as I understand it, when you send something to print, Windows/the print drivers render the file into a format the printer can read and understand (a spool file?). This file is sent to the printer then the local copy is deleted. I believe this file is held briefly in the 'C:\WINDOWS\system32\spool\PRINTERS' folder, which is effectively the shared print queue folder. for all printers on that machine.
My question is whether you can capture this 'raw' spooler data (I've managed to copy and paste to capture the files that appear in the spool folder, but you have to be fast!), and crucially, once you've captured it, can you then somehow send it to print again?
I have a feeling this is more complicated than I think. Presumably there are different formats of spooler data etc? Is there a utility that can do the printing/viewing of captured files?
|
|
|
|
|
You could write something to monitor that directory and capture files that were created. I'm not sure if your copy of those files would cause problems in the printing process if the file is in use (the program copying it) when it is attempting to be deleted.
There are ways to send the raw files right back to the printer to print again. But you need to realize that each printer has its own language. The Windows printer drivers take the documents and convert them to the language of the printer. So I'm not sure you could create something generic for all printers...
How to send raw data to a printer by using C#.[^]
Hogan
|
|
|
|