|
Some automation jobs may require SetForegroundWindow in order to use keyboard/mouse actions on another app. Of course this would require:
1. A user requesting it
2. A warning window telling the user he shouldn't touch anything until told otherwise.
3. The automation stuff
4. A notification to the user all is over.
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.
|
|
|
|
|
Hello All,
I have created a new appdomain . Now i want to load assembly in this newly created appdomain .
I tried to do using appdomain.load().. But i got error.
can u please suggest me some code to implement the same.
Regards,
Phani
|
|
|
|
|
Hi,
what kind of error did you get? Could you post the error message and the code?
Regards
Sebastian
|
|
|
|
|
Hey Sorry ,
I got the path wrong and now fixed it out . but i have some requirement hope you can help it out.
I have dll which has 2 classes One is Employee class and other is Controller class. this class has has table which will add employee object to the hastable.
Now i have created another application , where i am going to use this DLL and i have to do this in new Appdomain .
So i want to load that dll in newly appdomain and want to creat on e mployee object and add that to list .
Can u help me out in this . I am at learning statge
|
|
|
|
|
I'm (re-) using a snippet from PIEBALDConsult, works like a charm;
name = System.IO.Path.GetFileNameWithoutExtension ( Filename ) ;
assm = System.AppDomain.CreateDomain ( name ).
Load ( System.IO.File.ReadAllBytes ( Filename ) ) ;
I are Troll
|
|
|
|
|
file namse should include path too ???
|
|
|
|
|
I triend with complete path but it is saying couldn not find the file
|
|
|
|
|
How does "Filename" look just before executing the ReadAllBytes when you put a watch on it?
BTW, this isn't a "beginners" topic, but rather somewhat "advanced"
I are Troll
|
|
|
|
|
Basically, the Assembly has to be in the same directory as the executing application.
Apparently you can load an Assembly from a different directory, but you have to set the AppDomains (both the current one and the new one) up properly to do that and I haven't bothered to do that.
See here[^] and here[^].
|
|
|
|
|
Hi.
I have two binary numbers : 01100011 and 01101000
I wanna exert a logical and on them in C#.
01100011
& 01101000
------------
01100000
Could you please guide me , how I can do it ?
Thanks.
|
|
|
|
|
string bin1 = "01100011";
string bin2 = "01101000";
int int1 = Convert.ToInt32(bin1, 2);
int int2 = Convert.ToInt32(bin2, 2);
byte result = (byte)(int1 & int2);
string binaryResult = Convert.ToString(result, 2).PadLeft(8, '0');
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
|
inserts the leading zeros if required.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Just beat me to it!
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
It pads the input string with [second parameter] until the length is [first parameter].
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Mohammad Dayyan wrote: What does PadLeft do ?
what the word says: padding at the left
and what the documentation says: see Google, MSDN.
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.
|
|
|
|
|
I don't think there are any binary literals in c# ( though there are Hex literals e.g. 0x2A). If you must use a binary input the following snippet migh be helpful
const int Base = 2;
/To Integer From Binary
int integer = Convert.ToInt32("111", Base);
string binary = Convert.ToString(startVal, Base);
You can can peform the bitwise and against the ints:
int i = 42;
int j = 42;
int k = i & j;
|
|
|
|
|
I have created a desktop application using c#.Online version has been made using PHP.My requirement is to synchronize the data with the online version when "Synchronize" button will click from Offline application.Below is the database details:
Offline version database :SQL server 2005
Online version database :MYSQL
database field name is same for both the application.
Can anyone help me how i can do it..Thanks inadvance
Anup Roy
.NET Developer
India
modified on Thursday, August 20, 2009 9:28 AM
|
|
|
|
|
I Can think of only one whay. (I don't think .NET has classes that will do automaticly)
Each table shoud hold TimeStamp of lastChange column.
Additional tabel with ID, IDofDeletedItems, When (This table can be used to sychronize of removing rows)
With this approach, there coud be conflics (Expect one-way synchronization) but avoiding download massive database
modified on Thursday, August 20, 2009 1:53 PM
|
|
|
|
|
|
How can i get the summary info of function by MethodInfo ?
If i have inside of class A function that will look like this :
public bool CheckItFunc(int num)
{
return num > 10;
}
I can get Method info by this line :
System.Reflection.MethodInfo mi = typeof(Class A).GetMethod("CheckItFunc");
I can get the name of the function by mi.Name for example and i can find a paramather list and more.
I there any way to get the summary of a function in runtime?
(in this case get the string: " This Function check if the number is bigger then 10") ??
Thanks for all of your answers.
modified on Thursday, August 20, 2009 9:11 AM
|
|
|
|
|
The structured comments aren't stored in the executable, if anywhere they are in separate XML files. so you won't get them with reflection. And they don't normally become part of the distribution either.
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.
|
|
|
|
|
Thanks for your answer.
I solved the problem in this way:
1. I create New Attribute(MyAttribute) that contain string called "MyFunctionTextHeader".
2. Every method have an MyAttribute :
[MyAttribute("My function description)")]
public bool MyFunc(int num)
{
....
}
3. when i have "MethodInfo" name mi i write this line:
string TextHeader = ((MyAttribute)mi.GetCustomAttributes(typeof(MyAttribute), false)[0]).MyFunctionTextHeader;
and that solve my problem.
|
|
|
|
|
My C# web application is trying to read the Private Key of the our own digital certificate installed on Windows 2008 Server, when it needs to decrypt the data received from the web request.
Following is the C# code:
X509Certificate2 cert = GetCert(thumbPrintOfPrivKey, StoreName.My, StoreLocation.CurrentUser);
try
{
string privateKey = cert.PrivateKey.ToXmlString(true);
log.Info("Retrieved Private Key....");
rsacsp.FromXmlString(privateKey);
}
catch
(Exception e)
{
string msg = "Unable to Read the Private Key: ";
log.Error(msg + e.Message);
throw new Exception(msg, e);
}
And following line of above-mentioned code throws an error.
string privateKey = cert.PrivateKey.ToXmlString(true);
The error which I get is: - "The system cannot find the file specified."
And following is the stack Trace:
at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)
at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()
at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
at System.Security.Cryptography.RSACryptoServiceProvider..ctor(CspParameters parameters)
at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey()
at VemoSSO.SSOUtility.ProcessData(String decodedSig, String decodedToken, String combined) in
When I checked my Application Event Logs to see what exactly is happening, the event log showed that the "CertificateServicesClient" has stopped. And I noticed that it gets started automatically when I logon to the server.
Can anybody help me in finding the reason as to why this service? stops and starts automatically, and can we restart it immediately the moment it stops?
Thanks in advance.
-----
Ajay Jadhav
http://www.divinet.co.in
|
|
|
|
|
Anybody knows how toons like Shaun the Sheep is created?? They look so real that I doubt they're real objects animated somehow, ain't they??
|
|
|
|