|
Hi Alexander,
Thanks for the thorough research. I should have mentioned that running "mailto:user@yahoo.com" (or similar) works from the Start, Run box. Outlook opens with the To: info filled in.
I checked all your points above just for kicks and I have data in all places. I'm using Outlook 2003 and the last entry had some cryptic parameters:
"C:\PROGRA~1\MICROS~2\OFFICE11\OUTLOOK.EXE" -c IPM.Note /m "%1"
Other than that, I think the rest is ok and like I said, it works from the Start, Run box... which is why this is driving me nuts.
I'll make a smaller test app and try it from there and let you know what I find. We've had some strange things happen with threading.. depending on where we spawn threads in the code. Our application is pretty complex and I'll try to step back and use small test app. We've heard some strange things with regard to threading in version 1.1 of the Framework.
I'll let you know what I found...
Thanks!
Stretch
|
|
|
|
|
Alrighty then!... I just did a quick tester application and used the same code I'm having problems with in our company's app. Works just peachy. As I mentioned, our company app is pretty complex and one thing we had to do was switch from STAThread to MTAThread to accommodate a legacy system in Europe on Windows 98 (gag). Anyways, I tried switching STA to MTA in the tester app and bingo... same exception.
We 'should' not need to support that legacy system in Win 98 and I'm looking into that... but does anyone know why I have this issue using MTAThread and this type of Process that I'm running?
Thanks,
Stretch
|
|
|
|
|
Stretch,
Thanks for your reply. This is a very interesting issue, to say the least! I do not know enough about the Multi-Threaded Apartment state to say for sure what is going on, but I'm guessing, by the error message, that it has something to do with not being able to access part of the registry, or accessing the wrong part of the registry when in a multi-threaded aparatment model. I need to do a few more searches for information about this; I hope it is documented somewhere.
In the meantime, if you want a quick and dirty workaround, you can run cmd.exe and execute the command that way. Since the Command Line Interpreter won't understand the "mailto" keyword, you have to use the "start" command to have it execute properly. This is the code I tried in a test application with the MTAThread attribute set, and it worked fine:
string mailToAddress = "mailto:joe.mama@exception.net";
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "cmd.exe";
myProcess.StartInfo.Arguments = "/C start " + mailToAddress;
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.RedirectStandardOutput = false;
myProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
myProcess.Start(); Like I said, it's a little bit ungainly, but it does work. If I think of anything else, I'll let you know.
Sincerely,
Alexander Wiseman
|
|
|
|
|
I wish to transfer a session state from one page to another. Is there a simple way to transfer the state without storing it and then taking it back out in some complex almost useless way?
Thanks for all the help!
|
|
|
|
|
i want to start programming neural nets using c#.
plz help me
|
|
|
|
|
|
|
|
I am new to C# and .Net. I am trying to execute a bat file from inside a C# application. I continue to get a security error and no one here can help me out. Any ideas?
Thanks in advance.
|
|
|
|
|
ProcessStartInfo pi = new System.Diagnostics.ProcessStartInfo(@"batchfile.bat", @"arguments here");
pi.UseShellExecute = true;
Process.Start(pi); Difficult, me thinks not, of couse Security Error is probably something to do with the permissions set up on your computer and I can't help you with that since I'm the Administrator on mine.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
|
|
|
|
|
using Microsoft.Win32;<br />
<br />
...<br />
<br />
string fileName = "c:\\MYBATFILE.BAT";<br />
string args = "YOUR ARGUMENTS GO HERE";<br />
System.Diagnostics.Process proc = new System.Diagnostics.Process();<br />
proc.EnableRaisingEvents=true;<br />
proc.StartInfo.FileName=fileName;<br />
proc.StartInfo.Arguments=args;<br />
proc.Start();<br />
proc.WaitForExit();<br />
proc.Close();
|
|
|
|
|
Make sure that the bat file has permission for "Everyone"
|
|
|
|
|
This is the error message from DOS.
"
The action that failed was:
LinkDemand
The type of first permission that failed was:
System.Security.PermissionSet
The demand was for:
<permissionset class="System.Security.PermissionSet"
version="1"
Unrestricted="true"/">"
There was more if I need to send it..
thanks in advance
|
|
|
|
|
The below is the entire error...
Thanks and I truely appreciate any help.
Unhandled Exception: System.Security.SecurityException: Request failed.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly a
sm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, Secur
ityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object ass
emblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle
rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet gran
ts, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Objec
t assemblyOrString, SecurityAction action, Boolean throwException)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs
, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMet
hodHandle rmh, Assembly asm, SecurityAction action)
at ConsoleApplication_uisftp.HelloWorld.Main()
The action that failed was:
LinkDemand
The type of the first permission that failed was:
System.Security.PermissionSet
The demand was for:
<permissionset class="System.Security.PermissionSet"
version="1"
unrestricted="true">
The granted set of the failing assembly was:
<permissionset class="System.Security.PermissionSet"
version="1">
<ipermission class="System.Security.Permissions.EnvironmentPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
read="USERNAME">
<ipermission class="System.Security.Permissions.FileDialogPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
unrestricted="true">
<ipermission class="System.Security.Permissions.FileIOPermission, mscorlib, Vers
ion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
read="R:\C#2\ConsoleApplication uisftp\ConsoleApplication uisftp\bin\Debug\"
pathdiscovery="R:\C#2\ConsoleApplication uisftp\ConsoleApplication uisftp\bin\De
bug\">
<ipermission class="System.Security.Permissions.IsolatedStorageFilePermission, m
scorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
allowed="AssemblyIsolationByUser"
userquota="9223372036854775807"
expiry="9223372036854775807"
permanent="True">
<ipermission class="System.Security.Permissions.ReflectionPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
flags="ReflectionEmit">
<ipermission class="System.Security.Permissions.SecurityPermission, mscorlib, Ve
rsion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
flags="Assertion, Execution, BindingRedirects">
<ipermission class="System.Security.Permissions.UIPermission, mscorlib, Version=
2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
unrestricted="true">
<ipermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
url="file:///R:/C#2/ConsoleApplication uisftp/ConsoleApplication uisftp/bin/Debu
g/ConsoleApplication uisftp.exe">
<ipermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib
, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
zone="Intranet">
<ipermission class="System.Net.DnsPermission, System, Version=2.0.0.0, Culture=n
eutral, PublicKeyToken=b77a5c561934e089"
version="1"
unrestricted="true">
<ipermission class="System.Drawing.Printing.PrintingPermission, System.Drawing,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
level="DefaultPrinting">
The assembly or AppDomain that failed was:
ConsoleApplication uisftp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file:///R:/C#2/ConsoleApplication uisftp/ConsoleApplication uisftp/bin/Debug/Con
soleApplication uisftp.exe
Press any key to continue . . .
|
|
|
|
|
are you programming in a limited xp account? is so then dont.
or is this running in a secure NT network? if so... what kind of premissions do you have and what external(things other than your computer) resources are you trying to reach.
|
|
|
|
|
I have an issue with stopping threads in a windows service application I was wondering if anyone can help. let me set it up for you. In a windows service you have to use the OnStart method to initialize your application... but you cannot run any loops or sequence of events that contain loops or the state of the application will be in an "starting" service mode indefinitely. So I start a thread call Maint to handle the application. The application has threee main functions at the moment that interface with WAN file shares and a sql db. I run these parallel each in there own thread(and they dont interact with eachother). so in the OnStart method:
maint Maint = new maint();<br />
maintThread = new Thread(new ThreadStart(Maint.start));<br />
maintThread.Start();
in that start method i call:
importassets ia = new importassets();<br />
importThread = new Thread(new ThreadStart(ia.importasset));<br />
importThread.Start();<br />
<br />
updatereg ur = new updatereg();<br />
updateThread = new Thread(new ThreadStart(ur.runupdate));<br />
updateThread.Start();<br />
<br />
forcelogins fl = new forcelogins();<br />
loginThread = new Thread(new ThreadStart(fl.runlogins));<br />
loginThread.Start();<br />
<br />
int startTime = System.Environment.TickCount; <br />
int runTime = startTime+3600000;<br />
while(true)<br />
{<br />
int nowTime = System.Environment.TickCount;<br />
FAISservice fs = new FAISservice();<br />
if(!fs.isRunning)<br />
break;<br />
if(runTime < nowTime)<br />
{<br />
importThread.Abort();<br />
Thread.Sleep(3000);<br />
startImport();<br />
runTime = nowTime+3600000;<br />
}<br />
Thread.Sleep(10000);<br />
<br />
}
Now, all works fine until the OnStop() method gets called by the service being stopped or restarted. in the OnStop() method i run:
isRunning = false;<br />
<br />
maintThread.Abort();<br />
<br />
maint Maint = new maint();<br />
Maint.stop();
and in the stop() method i call:
importThread.Abort();<br />
updateThread.Abort();<br />
loginThread.Abort();
Now I'm locked in a "STOPPING" state and i have to kill the process... any clues? also... my above 3 threads start while(true) loops that only BREAK when isRunning=false.
|
|
|
|
|
We have a similar situation, and basically, in our thread classes, we have created a Shutdown() method.
The threads themselves this method at different points in their loops (where it is practical for them to gracefully stop), and simply shut themselves down when this method returns true. The threads do not stop immediately, like from a Thread.Abort(), but this way they are given a chance to terminate gracefully.
In the thread proc, the method is coded as so:
public class SomeThread
{
// This variable is used by multiple threads, so it must be thread-safe.
// Do not access it directly -- use the ShutDown property instead.
private bool m_bTimeToShutdown = false;
private Object ShutDownLock = new Object();
// Other variables and methods go here......
/// <summary>
/// This property can be set to tell the main loop to stop processing.
/// The main loop continues to run as long as this property is false.
/// </summary>
public bool ShutDown {
get {
bool rslt;
lock (ShutDownLock) {
rslt = m_bTimeToShutdown;
}
return rslt;
}
set {
lock (ShutDownLock) {
m_bTimeToShutdown = value;
}
}
}
}
Calling example (in the Main service):
/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
// TODO: Add code here to perform any tear-down necessary to stop your service.
log.Info("Shutting down some thread"); // This is just a sample logging call.
SomeThreadThrdProc.ShutDown = true;
}
I hope this helps you.
Tom Delany
|
|
|
|
|
Greetings,
I have the need to place an arraylist into a pageddataset that fills a repeater. The command buttons and total number of pages is all there, however, the pagelimit is not working. I have resolved the data source to iEnumerable, to no avail.
Can anyone assist? Here is the code...Thanks!!!
override
protected void OnLoad(EventArgs e)
{
EnsureChildControls();
// Populate the repeater control with the Items DataSet
PagedDataSource objPds = new PagedDataSource();
objPds.PageSize = 10;
objPds.AllowPaging = true;
objPds.CurrentPageIndex = CurrentPage - 1;
if (Confirm && PledgeID != -1)
{
objPds.DataSource = (IEnumerable) ResolveDataSource(array list );
}
else
{
//objPds.DataSource = PledgeUtility.GetAllPledges(ModerationStatus.Pending);
objPds.DataSource = (IEnumerable) ResolveDataSource(array list));
}
// Set the PagedDataSource's current page
lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of "
+ objPds.PageCount.ToString();
// Disable Prev or Next buttons if necessary
cmdPrev.Enabled = !objPds.IsFirstPage;
cmdNext.Enabled = !objPds.IsLastPage;
rptPledgeList.DataSource = objPds.DataSource;
rptPledgeList.DataBind();
pnlNoPledges.Visible = (rptPledgeList.Items.Count == 0);
}
// *****************************************************************
// *****************************************************************
// Resolve the data source and normalize it to IEnumerable
private IEnumerable ResolveDataSource(object dataSource)
{
IListSource listSource;
IList list;
if (dataSource == null)
return null;
listSource = (dataSource
as IListSource);
if (listSource != null)
{
list = listSource.GetList();
return list;
}
if ((dataSource as IEnumerable) != null)
return (IEnumerable) dataSource;
return null;
}
// *****************************************************************
|
|
|
|
|
i want to start programming neural nets using c#???
adsf e ed w we we w
|
|
|
|
|
Are you sure?
If so, search this site and you will find some articles about neural networks in C#. Some recently added articles were very good.
Josh
|
|
|
|
|
I suppose this might be appropriate in the web development forum too, but this seemed better.
In trying out this[^], I notice it works fine in .NET 1.1, but the text never gets set when I click on Change Text when the dll is compiled in .NET 2.0.
Someone else[^] had a similar problem with an article here on CP.
Any ideas?
Marc
Pensieve
Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
|
|
|
|
|
Never mind, found the answer. You have to make the assembly COM visible.
Marc
Pensieve
Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
|
|
|
|
|
Hi guys,
Please help! I have a form with combo box and a bunch of text boxes, when the form is opened I am populating the combo box and the text boxes with data from a table. My question is that when I delete one of the field data on the combo box, I still see it in the drop down menu. How can I refresh it or reload it so I don't see the deleted data. Please help!!!
sasa
|
|
|
|
|
If you're binding the comboboxes to a datatable, then it should automatically refresh. You may want to try .EndEdit() on the row after you have deleted it.
|
|
|
|
|
EndEdit() function doesn't exist, I tried EndUpdate() and no luck. I am not binding the data. How do I bind data?
sasa
|
|
|
|
|