|
I'm trying to run a web application inside a webbrowser component and I get java runtime errors, Those erros doesn't append when running into internet explorer 7.
The c# application I created is simply a window with a webbrowser in it, nothing else.
Jackd
|
|
|
|
|
I have installed an application on several xp machines. They all seem to be working fine.
Except one machine which has windows 2000. The application works but it is slow and sometimes it gives the following error:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Please note that in sql server 2005 Local and Remote connections is selected using tcpip
Any thoughts why only this machines sometimes gives this error when connecting to the sql server 2005 please?
Thanks
|
|
|
|
|
Try updating the MDAC components to the latest. YOu can get that here[^].
|
|
|
|
|
Hi all,
Can anyone tell me what happens (in the stack context) to the value type "x" after Init() method has been terminated:
--------------------
delegate void TestDelegate(ref int x);
class Program
{
static void Main(string[] args)
{
Init();
Console.WriteLine("Waiting");
Console.Read();
}
static void Init()
{
int x = 123;
int y = 123;
int z = 123;
TestDelegate t = new TestDelegate(TestFunc);
t.BeginInvoke(ref x, null, null);
}
static void TestFunc(ref int x)
{
Thread.Sleep(1000);
Console.WriteLine(x);
}
}
--------------------
Thanks,
________________________________________________________________
There are 10 kind of people: those who knows binary and those who doesn't.
|
|
|
|
|
|
Thanks!
Looking at the article, I figure out that passing int ref parameter (like Figure 13 example) will cause the value to be boxed - if the value is assigned to a object field - or simply copied - if the value is assigned to a int field - just like my example does.
Just assign some another value to "i" after BeginInvoke call and it will not affect the result.
The question is: Does the delegate class created has a "int" type or an "object" type to hold the value?
________________________________________________________________
There are 10 kind of people: those who knows binary and those who doesn't.
modified on Wednesday, December 05, 2007 2:44:19 PM
|
|
|
|
|
I'm trying to use P/Invoke to marshal some legacy code. I either get an "Entry Point Not Found" error, or a "Memory access violation"
I've run dumpbin on this dll, and i've verified that the entry point exists. I'm lost.
Here's the source for the function I'm exporting..
extern "C" BOOL FindUser2(char *cpUserFile,
char *cpPassword,
char *cpUserName,
char *cpUserPriveledge,
char *cpUserID,
char *cpComments,
BOOL *bUserActive,
char *cpErrorReason)
{...}
Here's my pathetic attempt to marshal it.
[DllImport("WN_USER_SECURITY.dll",EntryPoint="FindUser2") ]
public static extern bool FindUser2(
[MarshalAs(UnmanagedType.LPArray)]char[] strFileName,
[MarshalAs(UnmanagedType.LPArray)]char[] strUserPassword,
[MarshalAs(UnmanagedType.LPArray)]char[] strUserName,
[MarshalAs(UnmanagedType.LPArray)]char[] strUserPriveledge,
[MarshalAs(UnmanagedType.LPArray)]char[] strUserID,
[MarshalAs(UnmanagedType.LPArray)]char[] strUserComments,
[MarshalAs(UnmanagedType.Bool)] bool bUserActive,
[MarshalAs(UnmanagedType.LPArray)]char[] strErrorReason);
|
|
|
|
|
Try marshalling your char[] as StringBuilder objects instead.
|
|
|
|
|
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
|
|
|
|