|
I performed a little experiment and indeed SendKeys seems to fail when called by anything but the main thread; I don't recall having read about such requirement though.
|
|
|
|
|
Do you happen to know of a function / method I could use that will run off of a secondary thread?
Thank you for the help.
|
|
|
|
|
I have no idea what you mean here.
This was my test code:
public class CPTest_SendKeys : CPTest {
public override void Test(int arg) {
if (arg==1) {
runner();
} else {
BackgroundWorker bgw=new BackgroundWorker();
bgw.DoWork+=new DoWorkEventHandler(bgw_DoWork);
bgw.RunWorkerAsync();
}
}
void bgw_DoWork(object sender, DoWorkEventArgs e) {
runner();
}
private void runner() {
Process p=Process.Start("notepad.exe");
p.WaitForInputIdle();
SendKeys.Send("abcd");
log("sent");
}
}
|
|
|
|
|
Oh. All I'm asking is, absent of SendKeys, is there any other class or WinAPI that offers sending keystrokes to another application? Whether it be that the application has to be the foreground application or not?
|
|
|
|
|
I see.
I know of: SendKeys, SendInput (in user32.dll), and SendMessage (also in user32.dll).
The latter takes a hWnd (and needs a message such as WM_KEYDOWN), the other two implicitly address the active window. I tend to use SendKeys for simulated keyboard input, SendInput only for mouse operations.
|
|
|
|
|
class foo<T>{
T myT;
foo(T t){myT=new T(t);}
}
of course the above fails because i havn't restricted T to have new.
I don't want to copy by reference the T passed in.
Is it possible to have 1 class which constructs correctly where possible, but also accepts basic types, which don't contain a copy constructor?
class foo<T> where T:new(){
T myT;
foo(T t){myT=new T(t);}
}
class foo<T> where T: NOT new(){
T myT;
foo(T t){myT=t;}
}
so that foo<int>, foo<otherClass> both work.
|
|
|
|
|
Test to see if type isClass[^]
"You get that on the big jobs."
|
|
|
|
|
Hi
I'm working on new winform project using EF and i'm looking for best approach to pass an entity between forms as parameter.
In main form i have a grid populated with i.e. customers from dbcontext like:
var db = new context();
grid.datasource = db.Customers.toList();
db.dispose();
Then i want to edit grid selected row(presents a customer record) in a new form(Detail form).
I get selected customer by this:
Customer editCustomer = (Customer)grid.selectedRows[0].dataBoundItem;
and then pass the 'editCustomer' to a new instance of Detail form constructor.
Now my problem is how to save editCustomer changes made in Detail form? (with consideration of in Detail form the editCustomer have Detached state). this really confusing me
Please help me.
Thanks.
|
|
|
|
|
The easy way is to just pass the customer ID, create a new context and retrieve the customer record using the id and manage from there.
I nicer solution would be to implement MVVM and data binding. There'd be a learning curve if you're not already familiar with the concepts.
"You get that on the big jobs."
|
|
|
|
|
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I tried to generate a db from EDM, I created my SDM and I generated the database but it is empty, there's no table
|
|
|
|
|
Perhaps if you gave more detail and explained what EDM and SDM are, you might get some responses.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi All !
the size of my exe file is about 1.5 mb .I just used Microsoft.Office.Interop.Excel.dll and Word in preferences.
thanks for any help me to introduce a way to decrease the size of Exe file.
Regards !
|
|
|
|
|
Normally in a small application, the app's Icon (and any other included images/resources) are the biggest bloat.
|
|
|
|
|
Obfuscation will not only make the exe smaller but also protect your IP.
"You get that on the big jobs."
|
|
|
|
|
|
void GetDataFromDatabaseSortedByCustomerName()
{
int customerId;
}
Obfuscated
void a()
{
int a;
}
The obfuscated IL code is going to be smaller
"You get that on the big jobs."
modified 1-Apr-12 23:42pm.
|
|
|
|
|
Trouble is, it does absolutely sod all to protect your IP.
|
|
|
|
|
I definitely see obfuscation as a deterrent. At least it's going to cost them more to reverse engineer.
But sure if there just hunting down algorithms, it's pretty well useless.
"You get that on the big jobs."
|
|
|
|
|
RobCroll wrote: Obfuscation will not only make the exe smaller but also protect your IP.
Really!
I didn't know this before !
|
|
|
|
|
And you don't now. Obfuscation does not protect your IP. As a deterrent, it is next to useless if someone has a reasonable toolset available.
|
|
|
|
|
|
What's her email again?
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
1.5 Mb isn't that much; why is it a problem and what are you trying to achieve?
Bastard Programmer from Hell
|
|
|
|
|
Good day everyone. I have panels with text and images. During scrolling, painting the entire panel becomes slow. I'm therefore trying to paint only the invalid rectangle from Graphics.ClipRectangle. Processing was still slow so I had to step through the code and realised something.
I realised the paint event handler is called twice. In the first call, not all parts of the panel become invalid. I am able to get the invalid rectangle for painting.
However, after drawing in the invalid rectangle and the paint event handler exiting, the paint event handler is immediately called again but this time the invalid rectangle comprises the whole rectangle for the panel control on which i want to draw.
Thus drawing takes place twice, first for the smaller uncovered portion during scrolling, and second for the whole panel which causes the whole panel to be drawn again.
Is there any way to stop the whole panel from being invalidated after drawing only in the uncovered part of the panel during scrolling? It will really help to speed up processing. Thanks.
|
|
|
|