|
i want to develop a simulation program that can be used to simulate the actual windows
i.e :: in the MCSE exams there is a part is called simulation questions, in these questions a window like the actual windows interface appears and you can interact with it, as if you are dealing with actual windows environment
if any one have any idea how can i design this,, i need help about this topic
many thanks
Omar Elhadad
Software Developer
omer
|
|
|
|
|
Please don't repeat your posts. This is a free site - people will respond to your original question in their own time.
Paul Marfleet
|
|
|
|
|
There may be some instances that I would load the dll library. One time that I might be using this abc.dll then later in time that I would have the application to change to different dll which would be xyz.dll. Basically that they have the methods but have very different algorithms inside there.
What's the best way for me to do that? Right now that I'm using this:
<br />
Assembly a = Assembly.LoadFrom("abc.dll");<br />
Type mm = a.GetType("abc");<br />
object o = Activator.CreateInstance(mm);<br />
object[] par = new object[] { };<br />
ds_LUT = (DataSet)(mm.InvokeMember("GetLutTable", BindingFlags.Default |<br />
BindingFlags.InvokeMethod, null, o, par));<br />
<br />
<br />
<br />
Is there a way to keep the dll open until I am "finished" with it so I can close it and open the other dll? That will be done during runtime.<br />
<br />
Additional note: The dll are in c# language and was created in Visual Studio.Net 2005 software.
|
|
|
|
|
Without getting into additional app domains, once the DLL is loaded you will not be able to unload it. You can load more than one DLL at a time, so the idea of needing to "close it and open the other dll" doesn't really apply.
|
|
|
|
|
The only way to do this would be to have the DLL loaded into a separate AppDomain, which you could then unload. Mind you, I don't see what benefit this would bring you, as the Type would be completely different when you load up the new DLL - even if they have the same name, they really are different types so you won't have to worry about implementation collisions.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
How about letting the types within the assemblies inherit a given interface?
Then cast the instances to the interface on creation and the methods will be the same, but the implementation in the various types will differ.
-Larantz-
|
|
|
|
|
Hi........
The error is ...System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index
My code is like this.........
phInfo is a PlaceHolder
ptoInfoData.InfoRow[] infoRow = GetInfoRow();
for (int i=0; i < infoRow.Length; i++)
{
if (! smInfoId.Contains(infoRow[i].info_id))
{
//did some coding here
Control ptoInstance = LoadControl@"~\Controls\bnInstance.ascx");
HERE NEAR THIS LINE THAT ERROR IS COMMING
this.phInfo.Controls.AddAt( i , (ptoInstance));
}
}
Thanks in advance....
|
|
|
|
|
In the line that throws the exception, i must be a valid index. This means if there are two items in the this.phInfo.Controls, then the valid values for i are 0 and 1.
This is all an assumption, since I have no insight into the phInfo.Controls type.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
First, please use the <pre> tags for code blocks like this so the formatting is preserved.
ptoInfoData.InfoRow[] infoRow = GetInfoRow();
for (int i=0; i < infoRow.Length; i++)
{
if (! smInfoId.Contains(infoRow[i].info_id))
{
Control ptoInstance = LoadControl@"~\Controls\bnInstance.ascx");
this.phInfo.Controls.AddAt( i , (ptoInstance));
}
} Have you stepped through the code in the debugger and verified that the phInfo.Controls array (or collection) is valid?
Also, what is a "PlaceHolder"? And, more specifically, what is the Controls property on that class?
|
|
|
|
|
PlaceHolder is an asp.net control.
Into this PlaceHolder I am loading another aspx page which
is having some control....
Here I am incrementing 'i' everytime but I don't want to
add everytime to the collection so inside the 'if' condition
I am trying to add to the collection. but in the 3rd iteration
it is giving this error
Can u pls tell me logically what to do .....
|
|
|
|
|
Any reason you are using the AddAt function instead of Add ? Even though you are skipping certain loop iterations, the counter is still being incremented, so when you call AddAt in the 3rd iteration there is a chance that the counter is at least 1 position higher than the Controls collection. If AddAt is passed an index that is outside of the Control bounds, it will not add it and throw the exception you are seeing. The Add function will always add to the end of the collection, so you wouldn't see this error.
|
|
|
|
|
Add will take only one argument... I need to pass 2 arguments
|
|
|
|
|
Right, Add would only take ptoInstance as the argument and add that object to the this.phInfo.Controls collection. The other argument for AddAt is the index into the this.phInfo.Controls collection at which the control should be added. You don't need this argument when using Add as it will always be added to the end of the collection.
From what I see in your code, using
Add<code> should work. <br />
<br />
<div class="ForumSig"><br />
Scott.<br />
<hr style="height: 1px; width: 100%">—In just two days, tomorrow will be yesterday.<br />
<br />
[<a href="http://www.codeproject.com/scrapbook/ForumGuidelines.asp" target="_new">Forum Guidelines</a>] [<a href="http://www.codeproject.com/script/articles/list_articles.asp?userid=157870" target="_new">Articles</a>] [<a href="http://geekswithblogs.net/sdorman" target="_new">Blog</a>]</div>
|
|
|
|
|
Thank you very much Scott. It is working...
Thanks a lot...
|
|
|
|
|
|
I'll 5 vote you seeing that he couldn't be bothered to.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
i have table with multy column ,, one of this column is image
i store photo on it ,,,
my question ,if i want to update recode on this table to delete this image ...
what the SQL statment must be ...
Palestine
|
|
|
|
|
Update the record and set the field to null. Example:
update SomeTable set TheImageField = null where SomeOtherField = something
---
single minded; short sighted; long gone;
|
|
|
|
|
It wasn't much of a problem... infact, i didn't even know DataAvailable was there. But in my app you can download files from one PC to another accross a NetworkStream. Ive just added in the part where you cancel the download, and both client and server stop and go back to whatever they where doing, all good.
But, next time i try to read from the stream for whatever reason, i get whatever crap was left over from the file transfer that wasn't read earlier. This is when i found out about DataAvailable and i thought, great, so i can just read off the rest of the data from the stream when i cancel the download, and THEN carry on doing other stuff. Only problem is, it always returns with false.
Now, i know the code i use for downloading works perfectly, so i added in a line to check if there was any data on the stream just before i actually read it anyway. It said there wasn't, then it read the data and added it to the rest of the file.
Have i gotten confused somewhere? It should return true if there is data in the stream, right?
The stream gets created like this:
TcpClient tcpClient = new TcpClient();<br />
tcpClient.Connect(Address, Port);<br />
NetworkStream TransferStream = tcpClient.GetStream();
-- modified at 12:40 Wednesday 26th September, 2007
Dude... what?
Okay, so i think to myself, fine, i'll just make and connect the socket myself, then make a new stream from the socket. More line of code but y'know.
Anyways, now DataAvailable returns true.
So, the question becomes:
Why can't you use DataAvailable (and who knows what else) on a stream you got from a TcpClient?
|
|
|
|
|
Dammit, okay so it returned true... once. After that it just kept telling me there was no data... lies. There so clearly was.
|
|
|
|
|
I am currently, developing an application for family use, however, I am having trouble as to how I should code a photo gallery that allows the user to click on a thumbnail to view a larger version of the image?
Thanks,
|
|
|
|
|
Might this[^] help?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I'm using the following code. Don't spend too much time pondering variables that are apparently not defined anywhere - just assume they are initialized correctly because I cut this right out of my code and I don't feel like qualifying unnecessary minutia:
try
{
Process proc = new Process();
string keyFile = '\"' + this.PublicSslKeyFile + '\"';
string sigFile = '\"' + tempSigFile, true) + '\"';
proc.StartInfo.Arguments = string.Format(" dgst -sha1 -verify {0} -signature {1}",
keyFile, sigFile);
proc.StartInfo.FileName = @"C:\openssl\bin\openssl.exe";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
StreamReader stdOut = proc.StandardOutput;
proc.WaitForExit(10000);
if (proc.HasExited)
{
string results = stdOut.ReadToEnd().ToLower();
success = results.Contains("verify ok");
}
}
catch (InvalidOperationException e)
{
DoSomethingWith(e.ToString());
}
The code above is somehow producing a an InvalidOperationException, but I have no idea why.
-- modified at 12:53 Wednesday 26th September, 2007
For the ultra curious, here's the php version of the process code:
$verify = shell_exec("echo -n \"".$data."\"|openssl dgst -sha1 -verify \"".$public_ssl_key."\" -signature \"".$tmp_signature_file."\"");
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What are the details of the exception? They should indicate what line caused the exception, and if there is an inner exception, it may contain greater detail.
|
|
|
|