|
I don't know if you can do that just by using the SoundPlayer control. I think you need to use some API functions to do that. I don't have the time right now, so try searching Google and Codeproject for help.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
OK; thanks again!
- I love D-flat!
|
|
|
|
|
Hello everyone,
I am working on hooking to a Web Browser Control in my Windows Application. For example the following code is used to display the typed password or get the web address of the site.
public void OnBeforeNavigate2(object pDisp, ref object URL, ref object Flags, ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel)
{
document = (HTMLDocument)webBrowser.Document;
foreach (IHTMLInputElement tempElement in document.getElementsByTagName("INPUT"))
{
if (tempElement.type.ToLower() == "password" && tempElement.value.ToString() != "")
{
MessageBox.Show("You typed '" + tempElement.value + "' for your Password");
}
}
}
.
.
.
public void OnDocumentComplete(object pDisp, ref object URL)
{
MessageBox.Show(URL.ToString());
}
The problem is that not all website Navagate from one page to another page and eventhough requests are still made to the server but there no navagation to a new URL address. For example when I get to site build in Flash.
Can someone tell me how I can monitor the request made to the server?
Thank you for your help.
Khoramdin
-- modified at 13:11 Sunday 25th November, 2007
|
|
|
|
|
I have been working on a bot for IRC, which sits on a channel and looks for certain commands.
My problem is, the bot has a command that the users only should be able to use once every 3 minutes.
Therefore, the bot should check if at least 3 minutes has passed every time the command is executed, and if not, the bot should just return, saying something like: "This command can only be used every 3 minutes".
I really can't figure out how to solve this. I have tried alot, but none of it worked. Here is some of my code from the command:
if (input.EndsWith("!news"))
{
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(CurrentTime() + "Recieved !news command.");
Console.ForegroundColor = ConsoleColor.Green;
try
{
WebRequest newsReq = WebRequest.Create([URL here]);
WebResponse newsRes = newsReq.GetResponse();
... I've been thinking of using TimeSpan , but i've never worked with that before, and I don't even know if that is the right way to do it.
I hope you can help me
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
DateTime lastTimeCommandWasUsed = DateTime.MaxValue;
...
bool AtLeastXMinutesHavePassed
(int xMinutes)
{
<code>
DateTime currentTime = DateTime.Now;
bool allowUse = false;
if (lastTimeCommandWasUsed == DateTime.MaxValue) {
allowUse = true;
}
else {
TimeSpan elapsedTime = currentTime - lastTimeCommandWasUsed;
allowUse = elapsedTime.TotalMinutes > xMinutes;
}
<code>
if (allowUse) {
lastTimeCommandWasUsed = tmNow; currentTime;
return true;
}
return false;
} /ravi
-- modified at 12:54 Sunday 25th November, 2007
|
|
|
|
|
Could you please - in the code I provided - show me how to use this?
By the way, Visual Studio complains about that tmNow doesn't exist in the current context.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
Kristian Sixhoej wrote: tmNow doesn't exist in the current context.
Try this instead...
if (allowUse) {
lastTimeCommandWasUsed = DateTime.Now;
return true;
}
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Replace tmNow with DateTime.Now...
And people are here to help, not to do the work for you. I shall explain how the above method works, so that you can use it / write up your own.
It gets the current time using DateTime.Now and stores it, and the next time the method is called it compares this with the new current time through use of a TimeSpan, wich is quite self explanatory. So the time since the method was last called is DateTime.Now - thatOtherTimeFromBefore
It then compares the minutes property of the TimeSpan, to the int you provided to the method (which is the number of minutes you want to check have passed). Thats pretty much just an if statement.
It then returns true if the minutes property is greater than, or equal to, your int; and false if it is not.
----
And if i am mistaken, i apologise. I'm leaving now...
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
Kristian Sixhoej wrote: show me how to use this?
I've provided you with a ready-to-use method to check if "x" minutes have expired since the last check. If you're not sure how or where to call this method, then I suggest you spend some time familiarizing yourself with the basic concepts of control flow and method calls in C# before attempting to build your solution.
Kristian Sixhoej wrote: By the way, Visual Studio complains about that tmNow doesn't exist in the current context.
That's because I made a typo (now corrected in my original reply). Again, your inability to spot and correct my error leads me to believe you're probably better off spending some time going over the basics of C# before crafting a solution to your problem.
I hope you don't misinterpret my comments - I just feel you may have bitten off more than you can chew at this point in time.
/ravi
|
|
|
|
|
I *am* actually familar with C# and method calling, etc etc.
Ravi Bhavnani wrote: Again, your inability to spot and correct my error..
In fact, I *did* spot the error and corrected it.
Anyways, what I've done is, I've pasted the method you provided outside my Main-method, but it doesn't work. It gives me this error when I try to build:
The name 'lastTimeCommandWasUsed' does not exist in the current context.
If I'm not mistaken, this must be assigned a value whenever the command is executed, right? But then your method won't be able to find it, since it's within a scope. Please correct me if I am wrong.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
Kristian Sixhoej wrote: In fact, I *did* spot the error and corrected it.
OK. That wasn't evident from your post.
Kristian Sixhoej wrote: The name 'lastTimeCommandWasUsed' does not exist in the current context.
You may want to encapsulate the check for elapsed time in a class (eg: ElapsedTimeChecker ) that has (a) a static member lastTimeCommandWasUsed (static preserves its value across calls) and (b) a public static method CheckIfXMinutesElapsed() as shown earlier. Then just call that method when you're about to perform the code you want to execute every 3 minutes, by doing this:
if (ElapsedTimeChecker.CheckIfXMinutesHaveElapsed (3))
doSomething();
else
sorryYouMustWaitAtLeastThreeMinutes();
/ravi
|
|
|
|
|
Ravi Bhavnani wrote: OK. That wasn't evident from your post.
Nah, I know. I just needed to think twice.
Let's leave that for now.
I will try your suggestion in a little while.
Anyways, thanks.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
Ravi Bhavnani wrote: You may want to encapsulate the check for elapsed time in a class (eg: ElapsedTimeChecker) ...
I've done that, and it works perfectly now. Thanks a lot.
I didn't expect this to be so "advanced"
Anyways, thanks again.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
Excellent - glad you're up and running!
/ravi
|
|
|
|
|
Could anyone please post some code for a simple sound to play that everyone has using DirectSound? (When adding reference, please tell me which version if you decide to do this.) Thanks.
- I love D-flat!
|
|
|
|
|
Have you installed the latest DirectX SDK? If so you'll find an application called DirectX Sample Browser which has a PlaySound sample application you can install and play with.
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't.
"I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it."
-Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.
|
|
|
|
|
I went through it, and it was a sound application, but in the source, all I found was Direct3D things, honestly. Should I feel like an idiot? (No smart comments) PLEASE HELP!
-- modified at 13:17 Sunday 25th November, 2007
- I love D-flat!
|
|
|
|
|
hi
I will protected all file in a directory but I don't know about it
plzzzzzz help me if you have a solution
thanks alot
regard
|
|
|
|
|
You have to be a bit more specific. Whom and what is it that you want to protect the files from?
By the way, your zzzzzzzzzz key zzzzzzzzzemzzzzzzzzzzzz to be zzzzzzzzzzzzzztuck...
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Guffa wrote: your zzzzzzzzzz key zzzzzzzzzemzzzzzzzzzzzz to be zzzzzzzzzzzzzztuck...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Guffa wrote: By the way, your zzzzzzzzzz key zzzzzzzzzemzzzzzzzzzzzz to be zzzzzzzzzzzzzztuck...
It seems your keyboard driver is written in Lisp
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Eg. I want to add user to System.Window.Forms.LinkView.
It will show all user being added in.
& i want to add certain user to System.Window.Forms.Listbox.
Is this possible work?
|
|
|
|
|
What's a System.Window.Forms.LinkView ?
/ravi
|
|
|
|
|
i want to get data in LinkView via arrow button and show it in the listbox
|
|
|
|
|
Hey.
By spying on windows in IE and IE7 i've managed to retrieve the URL
to my application using FindWindowEx and SendMessage API.
The thing is, now i would like to retrive them from Firefox and Opera browser aswell. When looking at Internet Explorer on a spy tool i can see all the controls, For instance, a TabControl, in that TabControl
there is something called ReBarWindow and in that i can see that there is some ComboBoxes and in those there's an Edit field (Textbox).
And thereby i can grab the handle of that control and do what i please.
In Firefox or Opera for that matter there are only 3 "windows" and all sub-windows have exactly the same name, and there is no way to tell WHAT is What?
So, what i basically need is a handle to the combobox in firefox, which for me atleast seems to be invinsible..?
I need help on this, i hope i explained well.
|
|
|
|