|
Well no offense, but I'm not really convinced that this is the best solution - it is rather confusing especially to people who never "manually" used an enumerator..
|
|
|
|
|
Console.WriteLine("The products that were found:");
foreach (var aProduct in myProductSelection)
{
Console.WriteLine("Found product: " + aProduct.Code);
}
else
{
Console.WriteLine("No products were found!");
}
Try this:
Console.WriteLine("The products that were found:");
int productsFound = 0;
foreach (var aProduct in myProductSelection)
{
Console.WriteLine("Found product: " + aProduct.Code);
productsFound++;
}
if (productsFound == 0)
Console.WriteLine("No products were found!");
|
|
|
|
|
Welcome
This is my first program. Sorry for my English.
My program runs some other program. Waits 10 seconds. I searched in hex 00 00 00 31 32 31 If you find it in the textbox will show the last 3 values and a search for 7 consecutive bytes. Please help
Process process = new Process();
process.StartInfo.FileName = "process.exe"
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.Start();
System.Threading.Thread.Sleep(10000);
And now do not know how to deal with and find MemoryRead
|
|
|
|
|
Did you look at ReadProcessMemory [^]?
I don't really understand what you're asking, though.
|
|
|
|
|
I want to write a program that runs another program (process.exe), waiting 10 seconds, and looks in memory (process.exe) value hex 00 00 00 31 32 31 if he finds that the value is shown 31 32 31 and another 7 value
I look to readprocessmemory but i dont understand this. Can U make for me this program?
Its something like this <a href="">http://www.codeproject.com/KB/trace/minememoryreader.aspx</a> but my program is looking for value in hex
|
|
|
|
|
So then you would be reading as much memory as you can and search for those bytes, right?
|
|
|
|
|
Yes thats right
When the program find in the memory process.exe value 00 00 00 31 32 31 xx xx xx xx xx xx xx
it displays 31 32 31 xx xx xx xx xx xx xx
|
|
|
|
|
Hi,
I know I'm really close but not just quite there yet.
I'm reading data from a text file with the following code and as a newbie I am advancing bit by bit and I've come unstuck...again.
What I want to do now is in place of int num = 4991 I want to use Close[0] (which is a double) to compare against tmp (an int) but have absolutely no idea how to go about it.
Here is my code.
private string path = Cbi.Core.UserDataDir.ToString() + "PIn.txt";
private int[] levels;
private int count = 0;
private string readText = "";
<big>int num = 4991;</big>
<big>private int tmp, res = 0;</big>
private int? diff = null;
#endregion
protected override void Initialize()
{
CalculateOnBarClose = true;
Overlay = true;
PriceTypeSupported = false;
levels = new int[1000];
}
protected override void OnBarUpdate()
{
readText = File.ReadAllText("C:\\PIn.txt");
string [] split = readText.Split(new Char [] {';'});
foreach (string s in split)
{
count++;
tmp = int.Parse(s);
levels[count] = tmp;
if (tmp > <big>num</big>)
{
if(diff == null)
diff = <big>num</big>;
if ((tmp - <big>num</big>) < diff)
{
res = tmp;
diff = tmp - <big>num</big>;
}
}
}
Print(res);
}
Really appreciate the help,
suprsnipes
|
|
|
|
|
Hi,
1.
you could round your double to an int once and store it in a variable; a simple cast would suffice.
Alternative (not recommended): you could do everything using doubles.
2.
your code is wrong; test it with 0001 as the first number in the file!
3.
no need for private int? diff = null; as a simple private int diff = int.MaxValue; would work equally well, need less code, and fix the bug (2)
4.
your code has an artificial limitation of 1000 numbers in the file; it will crash for longer files.
Solution 1: use a List<int> instead of an array; a List behaves like an array that grows as needed.
Solution 2: don't store the numbers at all (your code isn't using them at all)
|
|
|
|
|
How would I do the following?
1. you could round your double to an int once and store it in a variable; a simple cast would suffice.
|
|
|
|
|
int roundedValue = (int)myOriginalDoubleValue;
BTW: do yourself a favor, go buy a book on C# and study it. It is the fastest and the best way of learning a new language thoroughly.
|
|
|
|
|
Thanks for your help Luc Pattyn.
I have revised the code from your suggestions which are much appreciated and I will be purchasing a book on C#.
Regards,
suprsnipes
|
|
|
|
|
I want to write a winform program to implement following behaviour
when the program exits,I will write some log infomation in a log file
so I write some code in Form_Closing Function,It works fine when I click X on the window.But when I shutdown the computer before I close the program,It seems Form_Closing Event is not fired,so the log information is not saved into file.I checked many articles on MSDN And Google,It all says,this event will be triggered when shutting down the computer,I also tried to handle the WM_QUERYENDSESSION message,it did not work either.
Can Anyone give some suggestions and help? thanks
|
|
|
|
|
Hi,
AFAIK you should:
- have a "LogClosing" method that logs what needs to be logged;
- have that called by the SystemEvents.SessionEnding handler;
- have it also called by the Form.FormClosing handler;
- implement some protection so it only executes once (as FormClosing may or may not fire on session end)
|
|
|
|
|
hey experts,
i m sending multiple emails from my code in bulk, i just want to check which mail succeeded and which mail fails, i searched a lot but i m not getting any idea, can anybody help me with that. Or may be help in creating a email sending monitor
waiting for positive replyRegards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
Hi !
In the section, where you set your mail values
(for example:
mail.From = new MailAddress(Mail_From);
mail.Subject = Mail_Subject;
mail.Body = Mail_Body;
you have to add two lines:
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess;
mail.Headers.Add("Disposition-Notification-To", "<my.name@myfirm.de>");
Then normally (and if the recipient click 'yes'), you will receive a mail-answer.
Best regards,
Gerrit
|
|
|
|
|
hey gerrit,
thanks for reply
i want to ask u is it necessary to use headers.add part for notification, or it will work without header part too.
("Disposition-Notification-To", and i have to pass what there)
because with "" it is giving error
waiting for your replyRegards
Narendra Singh
(Jindal Tech Ventures)
modified on Wednesday, March 10, 2010 3:09 AM
|
|
|
|
|
Hi !
In any way, I have trouble with the editor.
I am shure to have written
> mail.Headers.Add("Disposition-Notification-To", "<mail.address@firm.us>");
If it comes out wrong again, the empty quotationmarks must contain
a valid email address in brackets.
Best regards,
Gerrit
|
|
|
|
|
Hi !
I did not work once again !
Another Trial :
mail.Headers.Add("Disposition-Notification-To", "<gerit.rait@neus-ag.de>");
Best Regards,
Gerritmodified on Wednesday, March 10, 2010 7:32 AM
|
|
|
|
|
now its not giving error and key is also added to the header part, but it is not getting any notification Regards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
my code is
<system.net.mail.smtpclient smtp="new" system.net.mail.smtpclient(smtpserver,="" convert.toint32(portid));
mssg.from="new" mailaddress(emailid);
mssg.subject="txtSubject.Text;
mssg.Body" =="" htmleditorcontrol.bodyhtml;="" ;
mssg.isbodyhtml="true;
mssg.DeliveryNotificationOptions" deliverynotificationoptions.onsuccess;
="" mssg.headers.add("disposition-notification-to",="" "<mymailid.co.uk="">");>
like this
is it rightRegards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
Hi !
I do not think so.
> mssg.Headers.Add("Disposition-Notification-To", "xxxxxx");
There is the email address missing between the empty quotation mark. (here xxxxxx)
You do NOT get back a notification from the programm. The recipient
of the email is asked, to push a commit button and then a email
is send to the address, you set in your mssg.Headers.Add.
The email-address at the place xxxxxx must set between brackets.
Best regards,
Gerrit
|
|
|
|
|
yes i have added mail address there but it is not showing anything
can we add Disposition-Notification-Options???Regards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
Hi !
You have already set the options in
> mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess;
with the enum .OnSuccess
Once again:
You will not receive a notification or a message in Your programm.
With the two additional programm lines, a messagebox will show up at the
computer of the mail-receiver. If he commits this box, a notification-mail will
be send back to the mail-address you set.
Best regards,
Gerrit
|
|
|
|
|
yes gerrit i know i will not receive a notification or a message in my programm. but it is not showing messagebox at mail receiver, thats what i m trying to say
plz help me with thatRegards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|