|
Hi
first, as pete pointed out already it's a good idea to pass the char* with a string builder.
second, the BOOL *bUserActive looks to me like a ref value. so you might have to change your call as follows:
[DllImport("WN_USER_SECURITY.dll",EntryPoint="FindUser2") ]
public static extern bool FindUser2(
StringBuilder strFileName,
StringBuilder strUserPassword,
StringBuilder strUserName,
StringBuilder strUserPriveledge,
StringBuilder strUserID,
StringBuilder strUserComments,
[In,Out ]ref bool bUserActive,
StringBuilder strErrorReason);
it might work without the marshalAs Attributes because on "normal" datatypes, the clr automatically marshals the data correctly.
hope this helps
m@u
|
|
|
|
|
Well, I still can't get past the "Entry point not found" exception. I've examined the DLL using dumpbin and Dependency Walker, and they both show the entry point "FindUser2" as existing at ordinal 1. For some reason the C# app just wont see it.
|
|
|
|
|
Did you get the exception in application run or in method calling?
________________________________________________________________
There are 10 kind of people: those who knows binary and those who doesn't.
|
|
|
|
|
The exception occurs when I try to call the method.
|
|
|
|
|
Dio22 wrote: The exception occurs when I try to call the method
So the function is there. Maybe you´re checking another dll.
________________________________________________________________
There are 10 kind of people: those who knows binary and those who doesn't.
|
|
|
|
|
Hi,
here are some suggestions:
1.
make sure there is only one WN_USER_SECURITY.dll file.
Maybe you are looking at one file with dumpbin, but your app is looking at another (older) one,
hidden in the Windows PATH somewhere.
2.
Does the app find other methods in the DLL?
does another app work fine with that DLL?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
hmm.. i'm not a c++ guru, but i once wrote a little c++ demo lib that was callable from c# and i'm not sure if this is important, and if you can do anything about it but:
1) in my method-declaration i used the stdCall keyword:
void __stdcall foo(unsigned int *param1, unsigned char *param2, unsigned char *param3, void *Handle)
--> i think the default calling convention for pInvoked Method is stdCall so if it's not declared that way it might fail..
2) in the exports.def of the library i had to put this in order to make it work:
EXPORTS<br />
foo @1
--> if this is missing, it might explain the EntrypointNotFound - exception
greets
m@u
|
|
|
|
|
Hello friends,
I hope this is the right forum to place this question, if it isn't, please apologize me.
I'm thinking in taking the C# certification examinations and I need some help finding the right book or documentation to study.
If any of you did it before, perhaps can give a hand telling me the books you used so I can buy it.
Thanks a lot.
|
|
|
|
|
|
|
Thanks for all your answers. Help very appreciated.
I will check them and get the book.
pd: Any other opinion is welcome.
|
|
|
|
|
Hello.
I am trying to write the text given by the user onto an image and save the image. If i save it once using the Save method of the Bitmap object, it works. But if i try again, i get an exception because the file is locked. I have to restart the application to save the file again. Does anybody know a solution?
Thanks
|
|
|
|
|
Yes, make sure you Dispose of any Bitmap or File you are using!
|
|
|
|
|
I did that. Here is my code:
Font f = new Font("Arial", 48);
Bitmap b = new Bitmap("some path");
Graphics g = Graphics.FromImage(b);
g.DrawString(textBox.Text, f, Brushes.White, 50, 50);
g.Flush();
try
{
b.Save("result path", ImageFormat.Jpeg);
b.Dispose();
b = null;
pictureBox.Image = Image.FromFile("result path");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message); //Displays "A generic error occured in GDI+"
}
I wrote the message on the forum after i tried this code. So Dispose doesn't really work as I had expected. Any other ideas?
|
|
|
|
|
Hi,
images that get created from a file, lock that file for as long as the Image exists.
This holds true for Bitmap b=new Bitmap(path) as well as pictureBox.Image = Image.FromFile(path) .
As long as your PictureBox is showing an image, loaded from a file like that, you won't be
able to delete or modify that file.
There are basically two solutions:
1. load the image, copy it to a second image immediately (as in new Bitmap(image) ), and dispose of the first image;
2. create a FileStream to the file, and load the image using FromStream, this does not lock
the file that your stream refers to.
FileStream stream=new FileStream(fileSpec, FileMode.Open, FileAccess.Read);
Image localImage2=Image.FromStream(stream);
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Dear All,
I'm really stuck with my serial communication algorithm.
I receive the binary number sent to the serial port properly as "1000001" when i check in the hyperterminal, but i cannot convert it to the corresponding decimal value using my C# program.
Any help regarding this will be really appreciated.
Thank you.
|
|
|
|
|
Hi
Is this a string containing "10000001"? if so, and you want to convert it to an int or a long, you can use the Convert.ToInt32 or Convert.ToInt64 method:
long l = Convert.ToInt64("110101101",2);
greets
M@u
|
|
|
|
|
oh my - never noticed that you can convert from different bases - thx.
|
|
|
|
|
Hi,
i'm beginnig to write the code for a drag/drop component.Basically,i want to create a map-like control,where the user can drag & drop items chosen from a set.
So i will have a control's portion with the items to choose from (with a drag operation) and a "work" area where to drop the chosen items.
Now i'm concerned about various things(like zooming,handling the size of the map when there are many items in the map etc...),and,most important,i am still a newbie developer,so,before starting from scratch, i ask you:do you know some similar control/example that could put me on the right way?
Surely something similar to Microsoft Visio would help,but i need some sample code
Thanks in advance!
|
|
|
|
|
I would use the scrollwheel event within the "work" area to zoom, and set the AllowDragDrop property on the same to "true". Then override the OnDragEnter (or OnDragOver) and OnDragDrop methods for the "work" area. In the source area, override the OnClick and MouseMove event handler to start the drag (Using a call to DoDragDrop on the object). There is an article on MSDN about drag-drop into textbox here[^]. Hope this helps,
-Jeff
|
|
|
|
|
Can any one please tell me how to make entire grid editable.
I have done the usual way of making only the particular Row editable when cliked on EDIT button on the Row.
But I have to make the entire grid editable on a button click ..
Thanks in advance
|
|
|
|
|
Get it
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
Hello,
I was playing around with the listbox control in visual c# express edition and I become frustrated when I couldnt find events such as OnInsert / AfterInsert and so on. Has Microsoft reduced events?
|
|
|
|
|
There has no OnInsert or AfterInsert, but listbox has ControlAdded and ControlRemoved, see if it's help.
|
|
|
|
|
I have looked at both events(ControlAdded and ControlRemoved) prior to my post, the documentation states they are for controls, not items. How to get notified after new item has been added to the listbox ?
|
|
|
|