|
AliNajjar wrote: please I need URGENT help
That is rather rude.
AliNajjar wrote: just like "etap" program does
What program is "etap"?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Thanks anyway for your reply
etap is a program used for solving electrisity issues and problems
like load flow problem, using some mathematical equations and methodes like Newton-Raphoson for example..
I hope this reply would be useful and I hope to hear from you soon..
Thank you again>>
|
|
|
|
|
Use the BitBlt[^] windows API functions to copy the content of the screen into an image, then save and load the image as appropriate.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Sorry Man,
I dont think this may work because
I need or want to change the location, as well as the parameters
of any image on the screen, so can you say this might help>>
thanks ..
|
|
|
|
|
Oh, I see. You need to keep a list of points and images, then serialize this list to the file when your user exits. On startup, load this file, deserialize the contents, then iterate through the list loading the images on the screen where appropriate. If the images can be layered, then the order of the list is important on serialization. Hope this helps,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Actually it does help.,, But
What I was trying to do is to retrive the name and position of every image
and save those info to a file,, let's say like this.
imgName imgPos
img1 20,20
img2 45,75
...
imgk xx,yy
So what we may want to do is
When exiting the program or saving it, save this file to the project folder the user creates
and then, when the user opens it again.. the program will create those images in the order they are saved in...
But the problem remains although I have got the Idea
I still don't know how to do so...
Thank you for your help.
|
|
|
|
|
1. Create a class that is serializable to hold your data
[Serializable]
public class ImageInfo {
public ImageInfo();
public ImageInfo(string fullPath, int x, int y);
public string Path { get; set; }
public Point Location { get; set; }
} 2. Create a stack of those objects, and push/pop items to the stack
private Stack<ImageInfo> m_Stack = new Stack<ImageInfo>();
...
m_Stack.Push(new ImageInfo(imagePath, 50, 50));
...
ImageInfo old = m_Stack.Pop(); 3. Serialize the stack of objects to a file
using (FileStream fs = new FileStream("yourFilePath", FileMode.Create, FileAccess.Write
, FileShare.None, 0x1000, FileOptions.Encrypted | FileOptions.SequentialScan) {
new BinaryFormatter().Serialize(fs, m_Stack.ToArray());
} 4. Deserialize the stack from a file
using (FileStream fs = new FileStream("yourFilePath", FileMode.Open, FileAccess.Read
, FileShare.Read, 0x1000, FileOptions.Encrypted | FileOptions.SequentialScan) {
m_Stack = new Stack<ImageInfo>((ImageInfo[])new BinaryFormatter().Deserialize(fs));
} I'm not sure if there is a 'ToArray' Method on stack or not, nor do I know if there is a constructor for stack which takes an array, but you get the idea. Good luck.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Thanks so much,.
I am gonna try it and see what it would result into.
But.. Do you think there may be a better idea than the one I came up with.
Please enlighten my brain man.
Thank you....
|
|
|
|
|
Hello,
I'm needing write some Java/C# interop code and I'm wondering if anyone here has experience in this area and could provide a few tips.
I understand there are tools that allow you to register Java components as COM objects. This allows you to solve the problem with COM interop. Is this the best way to go? Are there any other great ideas?
Thanks!
|
|
|
|
|
This whole multi-threading structure keeps shifting in and out of focus like a Dali painting after 5 pints of Guinness...
Okay, I have the following going in my OldMcDonald process:
PanickyChicken chickenLittle = new PanickyChicken();<br />
<br />
Thread t = new Thread(new ThreadStart(chickenLittle.WanderAbout));<br />
t.Start();<br />
while ( !t.IsAlive );<br />
<br />
this.WaitForAcornToDrop();<br />
...
Now, once the WaitForAcornToDrop method has executed, I want to get my chickenLittle thread (t) to execute its WarnAll method [e.g. chickenLittle.WarnAll("The sky is falling");]
How do I tell an executing thread to perform a task?
Clive Pottinger
Victoria, BC
|
|
|
|
|
Hi,
a thread executes whatever code is passed to it at creation time, in your example it will run
the WanderAbout() method until that method is done. So whatever you wnat the thread to do must be
inside that method, you can't make it suddenly do something completely different.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
In addition to what Luc said, you can influence what's happening inside your thread's procedure for example by setting properties of your object which in turn are used inside the thread procedure.
For example, your PanickyChicken class could have a property
public bool ThinksSkyIsFalling = false {get; set;} (don't know if that's the correct C# 3.5 syntax, but I think you get the idea).
Now your chicken is wandering about until your program tells it that the sky is falling:
chickenLittle.ThinksSkyIsFalling = true; Now inside your WanderAbout method you can execute the WarnAll method as soon as ThinksSkyIsFalling==true and then exit WanderAbout - chickenLittle's job is done.
But then you'll have to think about synchronization issues. In the example above I think there's not much that can go wrong without explicit synchronization, but when you're performing operations that can be interrupted by a thread switch, you'll definitely have to take care of these cases. The lock() instruction can come handy in these cases.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks Mav.
I think you hit the root of my question - is a reference, in my main thread, to chickenLittle.ThinkSkyIsFalling valid even though chickenLittle is operating in thread t ? It appears it is - great.
That gives me the groundwork I needed to get information to my executing thread.
Thanks again.
Clive Pottinger
Victoria, BC
|
|
|
|
|
Hi.
I have a problem in XNA; it's that I want to have several sprites of the same thing, except place them in different places while keeping the 'physics' they all have. Can anyone give me a general idea of how I might do this. (Please try not to be too technical, unless it's needed!) If it helps anyone understand better, I'm making a border around the edge of the form with the boxes, but then I also want to draw 5 more inside various places. Please help, thanks!
+I tried making the Texture2D into an Array and in the Load method, making a for loop to load a certain amount, but that doesn't work. That was my idea... Partly... Help is still appreciated.
+Actually, I'vr got the hang of it. Stupid mistake... But any more info would still be liked. Thanks, kind of.
- I love D-flat!
modified on Tuesday, January 22, 2008 6:01:45 PM
|
|
|
|
|
Glad to hear you figured it out.
In future it would be better if you posted your XNA related questions here.
You will get much quicker and better answers - mainly because the guys/girls who wrote the XNA framework maintain, and actively contribute to the forum.
Cheers,
Mark.
|
|
|
|
|
How do I go about playing 24-bit wav files? I have 8 and 16 bit wavs playing fine with directsound, but when I run a 24-bit file through the same code I get a not-so-helpful crash ("Value does not fall within the expected range.") when trying to create a new SecondBuffer instance (sound = new SecondaryBuffer(dataGridResults.CurrentRow.Cells[3].Value.ToString(), d, dSound);).
I have searched high and low for answers, but the most I can come up with is something to do with WAVEFORMATEX or WAVEFORMATEXTENSIBLE. Although I don't know how to go about using them.
|
|
|
|
|
I have a C# solution with 2 projects, a test form in one project and a DLL in another. The DLL connects to a socket and sends and receives messages to and from the test application using properties in the DLL.
How does one send an event, such as poll events of the socket, to the test application? I want to know if the connection was dropped, when it was dropped, and set a button to red when connection is lost.
Very new to C# and I hope I framed the question well enough to get an answer.
Thanks in advance,
Joe
|
|
|
|
|
Hi All,
I can create appointments in MS Outlook via my c# application, bud how can i now remove or update this appointments?
thanx
|
|
|
|
|
Hello,
I am developing in C#.net 3.0 and here, i am using the multi-threading. Here i have 5 threads in the following way:
One thread sleeps for x mins after completing its one iteration.
Second thread sleeps for y secs after completing its one iteration.
Third thread sleeps for x hours after completing its one iteration.
Fouth thread sleeps for 1 day after completing its one iteration.
And the fifth thread sleeps for r mins after completing its one iteration.
All these threads have access to same database tables, sometimes they do reading and sometimes they do writing into the database table.
1) Here, I have an idea that, i have to lock the database.
2) And also, while debugging i have seen that, due to multi-threading there is an issue with the order of execution.
Can anyone help me on this ..please.... everything is over and at the last minute.. this problem arised.
Thanks
Anee
Anee
|
|
|
|
|
I don't know what your question is. You described a system, but the only problem that I can discern from your post is that
anumadhu wrote: there is an issue with the order of execution.
This is much too vague for me to offer any advice. Please post a specific question and we will try to help.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
How to Compare two Stringsand to copy string into other string using C# Code.
What is the syntax?
Is there any system defined function such as strcmp,strcpy as used in C
I am taken two values in strings ,
now I want to compare which one is greater.
I can do it treating values as int or to convert.ToInt32,
but requirement is to treat and compare them as strings.
|
|
|
|
|
simworld wrote: Is there any system defined function such as strcmp,strcpy as used in C
To compare 2 strings, you could use the String.Compare method.
To copy one string value into another, all you do is
<br />
string oldValue = "OldValue";<br />
string newValue = oldValue;<br />
|
|
|
|
|
|
There are several ways you can compare strings in C#. The simplest way is to just test using equality:
string a = "This is a test";
string b = "This is another test";
if (a == b) {
} However, this will do a case-sensistive, culture-sensitive compare which may not be what you want and isn't necessarily the most performant test.
The closest methods to strcmp in C# are going to be the String.Compare , String.CompareOrdinal or the String.CompareTo methods.
In order to copy a string, you can simply copy it. Strings in C# are immutable, so you will always get a new instance of the string:
string a = "This is a test";
string b = a; You can find all of the string methods here[^].
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
|