|
As the subject is saying, is it possible with C# to push a button like ENTER-key virtual?
Just like with InvokeMember("click"), then I just need it to do a virtual push at ENTER-key.
|
|
|
|
|
Hi,
The Button class has a PerformClick method.
Alan.
|
|
|
|
|
|
Hmm, and how can I then use it to make a push on Enter at my keyboard ?
As I see that class, it only can perform clicks on buttons on the application.
What I want is to make a program that for examples makes a virtual push on A,B,C,D,E,F,G on my keyboard
|
|
|
|
|
If you have code that does something other than handle speific UI elements in the Button Click handler, you really need to move that code to it's own method. Then you can call it from both the Button Click handler and from anywhere else in your code without having to resort to funky workarounds like this.
|
|
|
|
|
Are you looking for SendKeys[^]?
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)
|
|
|
|
|
Yes, I believe it is that I am looking for 
|
|
|
|
|
That works fine with SendKey, but it just requires that focus is on the application.. Which it isnt all the time.. Else it just does a Enter push while i am in another program.. Can I do so it does the ENTER in my application, and not in my current open program?
|
|
|
|
|
Is there a way to write the xsd of a class object without rolling my own code to do so?
|
|
|
|
|
Yes[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
Hello,
i've searched a lot around the web to find a Reflection-Sample which is really easy to understand, but i don't find anything.
I want to make an application, which is plugin-based, so i have each plugin in a *.exe or *.dll file. I want to have a list, lets say "List<plugins>" where the specific Plugin-Class from each *.dll file is in.
Has somebody a very simple sample how to do that? I've found only samples where i don't access external DLL-Librarys.
Kind regards
|
|
|
|
|
There are plenty of samples lying around this site showing how to create plugin based applications, but I'll give you a quick overview.
Generally, your application will have a plugin directory which will contain the relevant DLLs. What you want to do in your application is find all the DLLs in this directory (you can use DirectoryInfo for this). Then, you'd want to load these into separate app-domains in your application. You might find this[^] post useful.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
Hi
I have created the socket using
Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
newsock.Start();
It receives the string from the client but that window closes immediately it gets the string so im not able to see the displayed string in the server...
Please tell me how i can do it...
i have given the code in the previous post
|
|
|
|
|
1. Re-posting the same question half a dozen times over a 2 day period is not good CP etiquette.
2. RTFM[^]. The code you posted below indicates that you have not.
|
|
|
|
|
I'm working on one interesting open-source project here - BHO for IE that also should accept calls from Javascript. I've tried several solutions and still haven't got it to work.
First I tried to implement IDocHostUIHandler interface in my main class and cast IWebBrowser2 to ICustomDoc. Then pass an object, which implemented IDispatch interface, to SetUIHandler. The result - absolute silence (even alert(typeof window.external.myFunction) did not return anything), although method GetExternal got called.
Second I tried to create separate ActiveX class and through pUnkSite, which was cast to IWebBrowser2 in SetSite method, i tried execScript method to create wrapper object for this ActiveX. This is called on IWebBrowser.NavigateComplete2 event. The result was even weirder. At first I got it to work and calling myFunction (which had a call to show System.Windows.Forms.MessageBox) showed a message with text from Javascript. Now I wanted to make some comunication from ActiveX to BHO, so I implemented IObjectWithSite in this ActiveX class to communicate with browser and use PutProperty and GetProperty methods on IWebBrowser2. That's where I got stuck - once I casted pUnkSite to IWebBrowser2, my BHO which called execScript with "var axObject = new ActiveX("myNamespace.myClassAx");" started to throw exceptions saying "Exception from HRESULT: 0x80020101".
So here are few questions:
What does this exception mean?
Why GetExternal (window.external) does not work ?
Am I on the right track for ActiveX to BHO communication (and vice-versa)?
I'm a newbie on C#. Please help!
My system configuration is:
Windows XP SP3, IE7, .NET 3.5 and I'm using Microsoft Visual C# 2008 Express Edition
|
|
|
|
|
Hi,
I created an dll and create an instance of that dll in my application. After the use of this instance i need to dispose it. How can i do so?
Thankyou
YP
|
|
|
|
|
If the object in question has a close or dispose method then call that. If not, once it's no longer referenced by any active objects, it will automatically be cleaned up when the garbage collector next runs. You can sometimes help matters by making the instance = null.
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)
|
|
|
|
|
yes but some classes needs to be dispose...like Graphics
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Which is why it has a Dispose method
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)
|
|
|
|
|
Did you mean you loaded the dll into the appdomain manually?
If so, you can't unload it. You must make a new domain and load it into that one, and destroy the new domain when needed.
|
|
|
|
|
Hi,
I have a dll called dllexample.dll, a public function called 'demofunction' in it
i reffer the dllexample.dll to my form and allocate 'demofunction'
demofunction df = new demofunction();
after some time i need to kill the 'df', also need to allocate again if requried
This is the real requirement..
Thankyou
|
|
|
|
|
That sounds very normal - no AppDomains required. Just do what the others suggested (let the GC take care of it or implement IDisposable)
|
|
|
|
|
it still not working....
code in my dll
private bool disposed = false;
public void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{}
disposed = true;
}
}
public void Dispose()
{ Dispose(true);
GC.SuppressFinalize(this);
}
~ListenDesktop()
{
Dispose(false);
}
in my form :
------------
ListenDesktop lt = new ListenDesktop()
lt.Dispose();
but still the 'lt' is active.
I dont need 'lt' no longer in my form.. how can i solve it?
|
|
|
|
|
I'm not sure..
You could use FxCop to check it - it will make a warning if it isn't correct.
|
|
|
|
|
I have tried with the following parameterised query for select statement and is working fine.
SqlCeConnection conn;
SqlCeCommand comm;
comm = new SqlCeCommand();
comm.Connection = conn;
comm.CommandText = "select * from signuptbl where username =@uname";
SqlCeParameter para = new SqlCeParameter();
para.ParameterName = "@uname";
para.Value = textBox1 .Text ;
comm.Parameters.Add(para);
Now i want to write an update query which takes multiple parameters. I have thought of the following code.
SqlCeConnection conn;
SqlCeCommand comm;
comm = new SqlCeCommand();
comm.Connection = conn;
comm.CommandText = "update signuptbl set firstname=@fname,lastname=@lname,,psw=@psw1 where username =@uname";
SqlCeParameter para = new SqlCeParameter();
para.ParameterName = "@uname";
para.Value = textBox1 .Text ;
comm.Parameters.Add(para);
para.ParameterName = "@psw";
para.Value = textBox2 .Text ;
comm.Parameters.Add(para);
para.ParameterName = "@fname";
para.Value = textBox3 .Text ;
comm.Parameters.Add(para);
para.ParameterName = "@lname";
para.Value = textBox3 .Text ;
comm.Parameters.Add(para);
I have tried this code but the row was not updated.
Is this a proper way? How to pass multiple parameters in a query? Can i get a sample code for the same.
Thanks in advance.. 
|
|
|
|