|
is your port 7 is working with hyperterminal ?????
am using USB-Serial Port Driver(Prolific USB-COM Bridged (COM7)) from past 3 years , I don't get this problem till now,
check the setting again.
Note: some times Driver(usb_serial) can mal-functional, if u suspected uninstall & reinstall the driver.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Hi,
I am using the following code
<br />
Process pr = new Process();<br />
pr.StartInfo.FileName = "SCHTASKS.exe";<br />
pr.StartInfo.Arguments = "/Delete " + ScheduleName;<br />
when I pass the delete argument in command prompt a confirmation will appear. After pressing "y" it the schedule is deleted successfully.
I want to pass "y" as arguments but don't know how because I am already passing delete command in arguments
If any one can help me.
Regards
|
|
|
|
|
Naveed727 wrote: a confirmation will appear
There is no reliable way to do that, unless the program you are starting is rewritten to accept another command line parameter to suppress prompts.
You could try writing to the process's input stream - check out Process.StandardInput[^]
|
|
|
|
|
Hi,
I am assuming SCHTASKS is a regular console application, that produces some output (a prompt) in the console or DOS window, and takes some input from there as well.
The easy solution, if provided, is by passing another switch; try "SCHTASKS -h" to see its help.
If no extra switches are available, you should be able to do it with standard stream redirection; have a look at the Process class, StandardInput/StandardOutput properties, and OutputDataReceived events. You probably need to redirect the output (so you can wait for the confirmation prompt to arrive), AND redirect the input stream, so you can writeline "Y" to it.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
If internet explorer is opened and a url which ends with .pdf is opened, then how can I catch the information regarding PDF file which is viewed in browser.
Are there any API's in windows regarding to get the info about PDF file which is opened in browser?
|
|
|
|
|
You can use Request.Browser[^]
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
consider http://www.google.co.in/ is opened in Internet Explorer,if we type 'a' in the text box for searching, I want another letter to be typed instead of letter 'a', how can I do that using c#?
|
|
|
|
|
how about using event "TextChanged"...
if user enter "a", then just add more character instead of "a".
|
|
|
|
|
Hi guys,
I am working on a Console application which I used to detect certain files in specific locations. The code I used is like this:
if (File.Exists(@"C:\\myfolder\\directory1\\file.txt"))
{
}
else
{
Console.WriteLine("File not found");
}
But now, I am thinking of something different. What if the file is in such a location/path that is not known to me?! Suppose, I want to search for a file in the system and do not know its exact location except the file name, then what would I do? How would I implement a thorough search all over the C:\\ drive (including all its direcotries without mentioning their name) to find a specific file and then delete it with System.IO.File.Delete method?
Please find me a way,
Cheers,
Rajdeep.NET
|
|
|
|
|
You've asked this question 3 times now! (That I know of)
Google[^]
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
Hi Fly,
Sorry, but I had to repeat my question everytime since I didnot get any appropriate or deserving response. And BTW, this ain't that easy. I know of using the foreach loop here but I need the idea, that "How to?"
Cheers,
Rajdeep.NET
|
|
|
|
|
Rajdeep.NET wrote: I had to repeat my question everytime since I didnot get any appropriate or deserving response.
Yes you did, you either could not be bothered or don't have the skill to use the answers, in which case you should buy a book or try something basic like previous people have explained.
Rajdeep.NET wrote: BTW, this ain't that easy.
Yes it is.
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
static void Main(string[] args)
{
FindFile(@"d:\", "32bit.zip");
}
static void FindFile(string directoryName, string fileNameToFind)
{
string[] directories = Directory.GetDirectories(directoryName);
string[] files = Directory.GetFiles(directoryName);
foreach(string file in files)
{
FileInfo fileInfo = new FileInfo(file);
if(fileInfo.Name == fileNameToFind)
{
Console.WriteLine(fileInfo.FullName);
}
}
foreach(string directory in directories)
{
FindFile(directory, fileNameToFind);
}
}
|
|
|
|
|
stancrm wrote:
string[] files = Directory.GetFiles(directoryName);
foreach(string file in files)
{
FileInfo fileInfo = new FileInfo(file);
if(fileInfo.Name == fileNameToFind)
{
Console.WriteLine(fileInfo.FullName);
}
}
You can replace that with if (File.Exists(directoryName + "\\" + fileNameToFind)) . This would save you having to use the files variable which would take up space on the memory stack.
Also
stancrm wrote: FileInfo fileInfo = new FileInfo(file);
if(fileInfo.Name == fileNameToFind)
Path.GetFileName(file) would to the same thing as fileInfo.Name without having to create a new new FileInfo instance.
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
Thanx Stancrm! That worked!
|
|
|
|
|
I honestly think you should buy a book or two to help you with these simple tasks. Maybe learn how to google as well??
Anyway, I would suggest you look at the DirectoryInfo and FileInfo classes. These have nice attributes like SearchOption.AllDirectories which you can use to do what you want to do. I was going to post you some sample code but I recon you can figure it out and post it back once you have it working.
So, go ahead and check it out and I would like to see your sample code to show us that you are atleast helping yourself and not just posting for people to write your code for you!!
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hi Kwagga,
Actually, I am just a begineer now and my english isn't strong. I know what exactly I've to search but I dont find words to describe that while googling. Thanks for providing the attribute SearchOption.AllDirectories but I would have been very grateful to you if you provide a sample code to me.
Please help,
Rajdeep.NET
|
|
|
|
|
Hello,
I want to use HttpWebRequest to login and change some settings on a website. In order to do that i need to change the URL addresse of the currenct HttpWebRequest (Login Page) to another web page (Setting Page). I googled this matter and i found out that the RequestUri and HttpWebRequest.Headers["host"] are both readonly.
So here is my question:
1. How can i change the url address of the HttpWebRequest object after creating the object.
For Example:
WebRequestObject = (HttpWebRequest)HttpWebRequest.Create("http://www.yahoo.com");
WebRequestObject.RequestUri = "http://www.google.com";
2. Is there an alternative class in c# for better http functionality?
Any kind of help would be appreciated.
|
|
|
|
|
Ehsan Baghaki wrote: Is there an alternative class in c# for better http functionality?
Response.Redirect or Server.Transfer
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I add any zedgraphcontrol to form and i Want with chenge cursor on the right border control and drag , chenge size zedgraphcontrol? pleas help me thanks.
|
|
|
|
|
I have never heard of the zedgrapg control - but why not try putting it on a splitcontainer, docked to fill, then resizing the split container will probably just work as if by magic
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
I have a typical problem. It is like I want to execute some API calls based on the Platform, if one API is not supported by the current platform it will throw an exception. I want to implement it like this:
<br />
[Platform(Platform.Win32NT)]<br />
[DllImport("somedll.dll")]<br />
public static extern int APIcall([In] int param1, float param2);<br />
<br />
<br />
public int CallTheAPI(int param1, float param2)<br />
{<br />
return APICall(parma1, param2);
}<br />
How should I implement Platform attribute and accomplish the operation? Please give some idea.
|
|
|
|
|
try this one.
<br />
[Platform(Platform.Win32NT)]<br />
[DllImport("somedll.dll")]<br />
public static extern int APIcall([In] int param1, float param2);<br />
<br />
<br />
public int CallTheAPI(int param1, float param2)<br />
{<br />
if (!System.Environment.OSVersion.Platform.ToString().Equals("Win32NT"))<br />
{<br />
throw new ApplicationException("Your current platform is not a Win32NT operating system.");<br />
}<br />
return APICall(parma1, param2);
}<br />
<br />
<br />
|
|
|
|
|
Basically , this is ok for one or two api calls. But I am here handling with more than 300 calls. So instead of putting the if conditions everywhere , just using attribute over each api signature would be lot easier. That is why i am posting this question to get it in a easier way.
|
|
|
|
|
I guess you're looking for a generic method dispatch mechanism that validates the platform before executing calls. How about something like this.
enum Platform
{
XP,
NT,
Vista
}
class PlatformNameAttribute : Attribute
{
public PlatformNameAttribute(Platform platForm)
{
this.Platform = platForm;
}
public Platform Platform { get; set; }
}
class Program
{
[PlatformName(Platform.NT)]
static void SomeAPICall()
{
Console.WriteLine("NT");
}
[PlatformName(Platform.XP)]
static void SomeOtherAPICall(int x)
{
Console.WriteLine("XP");
}
static Platform GetCurrentPlatform() { return Platform.NT; }
static void ExecuteAPICall(Delegate d, params object[] parameters)
{
var attributes = d.Method.GetCustomAttributes(typeof(PlatformNameAttribute), false);
if (attributes != null && attributes.Count() > 0)
{
var platformAttribute = (PlatformNameAttribute)attributes[0];
if (platformAttribute.Platform != GetCurrentPlatform())
{
throw new InvalidOperationException("Platform Type mismatch");
}
d.DynamicInvoke(parameters);
}
}
static void Main(string[] args)
{
ExecuteAPICall(new Action(SomeAPICall));
ExecuteAPICall(new Action<int>(SomeOtherAPICall), 2);
}
You could do something more typesafe than DynamicInvoke, with Expression and lambdas, but that would require .NET 3.5, and I'm not sure you are running it.
|
|
|
|