|
In my unscientific tests, I noticed that the Thread.Abort() method cannot cancel an interop call, only managed code.
It's not the fall that kills you: it's the sudden stop - Down by Law, Jim Jamursch (1986)
|
|
|
|
|
Daniel Turini wrote:
I noticed that the Thread.Abort() method cannot cancel an interop call, only managed code.
Huh? I'm not making any Interop calls in this function at all.
|
|
|
|
|
It's a gruesome suggestion, but just as a test, you might try resuming the thread and then aborting it.
|
|
|
|
|
Maybe, but according to the MSDN docs, the CLR already does that for you when you call Abort.
|
|
|
|
|
Marc Merritt wrote:
according to the MSDN docs, the CLR already does that for you when you call Abort.
I don't know if that has always been in the docs, but it certainly isn't what happens under .NET v1.0; in v1.1 it has been corrected and works correctly.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
|
Hi,
I am trying to print on serverside using C# on a WebForm. When I called the Print() of PrintDocument, I am getting the error
'No Printers Installed'. Perhaps this was because of different account with which it was running. I made impersonate true in web.config and in the class constructor did the following:
int userAuthToken = 0;
LogonUser("deepak","DeepakWorld","monkey",8,0,out userAuthToken);
WindowsIdentity.Impersonate(new IntPtr(userAuthToken));
System.Diagnostics.Trace.Write(WindowsIdentity.GetCurrent().Name);
where LogonUser is the method in advapi32.dll
Before print, when I queried the CurrentIdentity, it revealed and confirmed that it was running DeepakWorld/deepak. But still it is saying 'No Printers installed' I have printers installed.
When I directly asked it to print using
print.PrinterSettings.Printer = @"\\Kennel\GP142";
it says:
Tried to access printer '\\Kennel\GP142' with invalid settings.
Please advise on how to print from a WebForm.
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
What is the event that is fired when maximizing a form? or minimizing for that matter.
I currently have put a delegate on the Resize event and checking for FormWindowState.Maximized.
Is this the only way of doing it? or even the correct way?
Basically i dont want to actually maximize my form. I want to change its height to a certain value while not changing the top and left of the form. But the WindowsState is only changed to FormWindowState.Maximized when the form is actually maximized and not before when it starts.
Any help is appreciated.
--ABT
|
|
|
|
|
Hi
I had the same problem. .NET doesent raises any specific event when the windowState of a form changes except the resize event. Else u can catch the WM_XXX message in "WndProc" method
Thanks
Srinivas
|
|
|
|
|
Thanks but i have never overriden this method before. Where do i get the values of WM_XXX and other message constants?
|
|
|
|
|
Hi,
I want to generate a random number of fixed-size for passwords.
The size of the password must be 8 digits.
I'm using c#, .net 1.1
Cheers
Gerry.
|
|
|
|
|
Random rand = new Random();
string pwd = rand.Next(10000000, 99999999).ToString();
that should do the trick.
| Website: http://www.onyeyiri.co.uk
| Sonork: 100.21142 : TheEclypse
| "If a dolar was a chicken would the chicken be evil?"
|
|
|
|
|
DUH
I thought of doing that with int, but the size would be too large. So I thought of using an int array
Should've thought of using string instead
::Incredibly embarrased::
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
but the two parameters sent to Random.Next are int's, i checked the max value of int's just a minute ago using the Int32.MaxValue property, and it had more than 8 digits in it, i only converted it to string because it was a password.
| Website: http://www.onyeyiri.co.uk
| Sonork: 100.21142 : TheEclypse
| "If a dolar was a chicken would the chicken be evil?"
|
|
|
|
|
I'm just embarassing myself more and more, aren't I?
For a minute there, I was using Int16 ?!?!
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
Create an int array of size 8, and assign a random number(range 0 to 9) for each int.
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
Thanks for replying. But this random number generator isn't as secure as cryptography RGN's.
Something like the RandomNumberGenerator class.
Cheers,
Gerry.
Gerry.
|
|
|
|
|
In my windows application I need to open Excel application in background and read some data from excel files.
What I do is
Excel.ApplicationClass excelApp = new Excel.ApplicationClass();
Excel.Workbook WB;
excelApp.Visible = false;
Then I open workbook:
WB = excelApp.Workbooks.Open(filename,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing);
And now I want to read some data from this excel file. In access I did it in this way: WB.Names("name1").refersToRange.Cells(1,1), but here in C# there is no such method Cells(string Name), so I don't know how to access cell value in given Excel name????
Can anyone help me?
I am using office XP!
|
|
|
|
|
I had this same problem a while ago, and the solution I used was:
Assign the refering name to a variable
String sRef = (String)(nm.RefersToR1C1).Split("!"c)
which will get you something like "RxCy" where X is the row number and y is the Column number. Extract those value out, then
String Value = (String)WB.Sheets(sheetname).Cells.Item(row,col)
It's a long way to do it, but until Office 11 comes out, it's the only way I know
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
|
Basically, i dont care if a set of statements throws an exception but i dont want the program flow to be interupted. How can i do this? Something like the following:
int[] manyInts = new int[4];<br />
manyInts[0] = 1;<br />
manyInts[1] = 1;<br />
manyInts[2] = 1;<br />
manyInts[3] = 1;<br />
manyInts[4] = 1;<br />
manyInts[5] = 1;
So basically it executes every statement whether it thows an exception or not.
-- ABT
|
|
|
|
|
How about:
try
{
int[] manyInts = new int[4];
try {manyInts[0] = 1;}
catch {}
try {manyInts[1] = 1;}
catch {}
try {manyInts[2] = 1;}
catch {}
try {manyInts[3] = 1;}
catch {}
try {manyInts[4] = 1;}
catch {}
try {manyInts[5] = 1;}
catch {}
}
catch {}
...Powerful kludgy - but should work
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
HA. That is extactly the work around that i am using.
|
|
|
|
|
Sprinkle liberally with cheese and enjoy.
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
Do you know where I can get the whole gamut of Shell and OLE interfaces (like IOLEWindow, IViewObject, IContextMenu, IPersistStorage, etc.) in C# definitions?
I could write them myself, but oh, what a time-saver it would be to already have them written!
THANKS!
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|