|
Hi, I want to be able to send keystroke to anther app that is based directx. I am using SendInput for the major part of the keys, but there are serveral keys that dont work with this fuction. (most of the ones that dont, calls a action of some sort). I just woundering if my next step is to start looking into directx api hooking or is there another way that i can send the keystroke over the sendinput that might work. Also i have tried the Sendkeys function but all it gets is the same key action on all the keys (whish is the ESC key).
thank you very much
Danzar
|
|
|
|
|
How to work TTS in arabic
write sentence arabic and speak whin i need that
|
|
|
|
|
Your inquiry goes way beyond the scope of a forum post. Try google searches
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi there,
I am making a stock take application for MC50 Pocket PC which runs on Windows 2003 Mobile OS. I have written some code to update stock after every qty entered for a stock item. This function updates the database (.sdf file on PDA) with the entered qty. I have found out that if battery runs out or if the PDA is hard rebooted WHILE doing stock take, my stock take is not saved at all. Seems like the data is rolled back or is not committed when PDA is rebooted while doing stock take. Please help me to save data every time i enter qty for a stock item even if the PDA is hard rebooted. Thanks very much. - KARAN
My code is:
"
#region Update Stock Take by Ref number
///
/// updates stock take table with new qty by ref number
///
/// <param name="ref_number" />
/// <param name="qty" />
/// <returns>
internal string UpdateStockTakeByRefNumber(string ref_number,decimal qty, string column)
{
string sql = "UPDATE Stock_Take SET " + column +" = ? , Updated_By_PDA = 1 WHERE Ref_Number = ?";
try
{
SqlCeHelper.ExecuteScalar(cnStockLink,sql, new SqlCeParameter(column,qty), new SqlCeParameter("Ref_Number",ref_number));
}
catch (SqlCeException e)
{
MessageBox.Show(e.Message.ToString());
}
return "Y";
}
#endregion
"
|
|
|
|
|
I just had an idea and I'd like your opinion.
When you use "for" cycles you have to use lock if more than one thread is executing that part because they may interfere with each other when incrementing the cycle-variable. You have to use lock():
lock(lockObject) {
for(int i = 0; i<x; i++)
{="" do="" work="" }="" }
my="" solution
first="" i="" use="" thread.name="" to="" name="" my="" threads="" with="" an="" int="" in="" a="" cycle,="" like="" this:
for(int="">threadArray.Length; i++)
{ threadArray[i].Name = i.toString(); }
I have to create an array of integers, with the same number of elements as the threads.
int[] intArray = new int[numOfThreads];
Finally my for looks like this:
for(; intArray[Convert.ToInt32(Thread.CurrentThread.Name)]) < x; Interlocked.Increment(ref intArray[Convert.ToInt32(Thread.CurrentThread.Name)]))
{ //Do work }
This way multiple threads can access a cycle instead of waiting until the running thread exits the lock. What do you think?
|
|
|
|
|
szolDat wrote: When you use "for" cycles you have to use lock if more than one thread is executing that part because they may interfere with each other when incrementing the cycle-variable.
Not at all. The variable is allocated on the stack, so it's local to each thread.
I don't know where you got that idea, but either you misread something, or you have read something written by a very confused person.
szolDat wrote: This way multiple threads can access a cycle instead of waiting until the running thread exits the lock. What do you think?
I think that you have totally misunderstood the problems with thread safety.
You have "solved" a problem that doesn't exist, and created a problem as the access to the array no longer is syncronised.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
"You have "solved" a problem that doesn't exist"
Please explain why the following situation isn't possible (I'm somewhat clear about the heap and the stack):
Thread1 enters the cycle, increments i by 1.
The control is passed to Thread2 and it enters the cycle too, incrementing i by 1. i now equals 2.
Thread1 gets control again and tries to access an array's element (or perform any action) using the cycle variable. There you have it, a race condition where the value of i depends on the order of the threads' access to the cycle.
Another thing is, every calculation will give bad results which depends on the number of executions and there are variables involved which are mutually modifiable by the threads. In this situation you have to use a lock, or you can use the method I proposed.
Thank you for your attention.
|
|
|
|
|
Have you tried it the other way? Or just believed some rubbish that was floating around the Internet?
Because your i is defined within the method, each invocation will have its own i , not one shared one. Thread safety comes into effect with fields -- items that are defined in a class or struct.
Here, I whipped up a little (!) demo:
namespace Template
{
public partial class Template
{
private int[] values ;
private int classi ;
public Template
(
int HowMany
)
{
this.values = new int [ HowMany ] ;
for ( int i = 0 ; i < HowMany ; i++ )
{
this.values [ i ] = i ;
}
return ;
}
public void
PrintLocal
(
object Format
)
{
for ( int locali = 0 ; locali < this.values.Length ; locali++ )
{
System.Console.Write
(
(string) Format
,
this.values [ locali ]
) ;
}
return ;
}
public void
PrintClass
(
object Format
)
{
for ( this.classi = 0 ; this.classi < this.values.Length ; this.classi++ )
{
System.Console.Write
(
(string) Format
,
this.values [ this.classi ]
) ;
}
return ;
}
public void
PrintClassWithLock
(
object Format
)
{
lock ( this.values )
{
for ( this.classi = 0 ; this.classi < this.values.Length ; this.classi++ )
{
System.Console.Write
(
(string) Format
,
this.values [ this.classi ]
) ;
}
}
return ;
}
[System.STAThreadAttribute]
public static int
Main
(
string[] args
)
{
int result = 0 ;
Template t = new Template ( 100 ) ;
try
{
System.Threading.Thread a = new System.Threading.Thread ( t.PrintLocal ) ;
System.Threading.Thread b = new System.Threading.Thread ( t.PrintLocal ) ;
a.Start ( " A({0:00})" ) ;
b.Start ( " B({0:00})" ) ;
while ( a.IsAlive && b.IsAlive )
{
System.Threading.Thread.Sleep ( 100 ) ;
}
System.Threading.Thread c = new System.Threading.Thread ( t.PrintClass ) ;
System.Threading.Thread d = new System.Threading.Thread ( t.PrintClass ) ;
System.Console.WriteLine() ;
System.Console.WriteLine() ;
c.Start ( " C({0:00})" ) ;
d.Start ( " D({0:00})" ) ;
while ( c.IsAlive && d.IsAlive )
{
System.Threading.Thread.Sleep ( 100 ) ;
}
System.Threading.Thread e = new System.Threading.Thread ( t.PrintClassWithLock ) ;
System.Threading.Thread f = new System.Threading.Thread ( t.PrintClassWithLock ) ;
System.Console.WriteLine() ;
System.Console.WriteLine() ;
e.Start ( " E({0:00})" ) ;
f.Start ( " F({0:00})" ) ;
while ( e.IsAlive && f.IsAlive )
{
System.Threading.Thread.Sleep ( 100 ) ;
}
}
catch ( System.Exception err )
{
System.Console.Write ( err.Message ) ;
}
return ( result ) ;
}
}
}
|
|
|
|
|
szolDat wrote: Please explain why the following situation isn't possible (I'm somewhat clear about the heap and the stack):
Thread1 enters the cycle, increments i by 1.
The control is passed to Thread2 and it enters the cycle too, incrementing i by 1. i now equals 2.
Thread1 gets control again and tries to access an array's element (or perform any action) using the cycle variable.
Every time that you enter a method, a stack frame is created for the local variables in the method. That stack frame is unique for that single method call, so that method call has it's own set of local varables that isn't shared by anything else anywhere.
Even if the method call's itself (recursion) so that the method call is in the same thread and has the same stack, another stack frame is created, and the local variables in that call are separate from the local variables in the previous call.
If the method calls occur in separate threads, each call will have it's own stack frame, but now they are even in separate stacks.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Well, I think I'll read this article http://tinyurl.com/mbmaz as soon as I'll have time, and if something isn't clear than I'll ask.
Thank you.
|
|
|
|
|
You should take that article with a grain of salt. Although it looks like a good overview, some things in it are simply not correct.
For example:
"Reference to a Type"
- There is no such thing. A reference always goes to an instance of a class, not to the class itself.
"As the method executes, we need some memory for the "result" variable and it is allocated on the stack."
- Not at all. A stack frame is allocated when the method starts, which is large enough to hold all local variables in the method. The size of the stack frame does never change while the method is executing.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hi guys, I am standing on a point where visual studio is not functioning properly. I am trying to compile my project and i am getting the following error message "The directory name is invalid." I did google but problems couldn't be solved. All of my project that were used to compile not even compiling now.
Another thing is, when iam trying to create a brand new Csharp project i am getting this error
"The given path's format is not supported".
What should i do. Any suggestion shall be highly appreciated. Thanks
|
|
|
|
|
What's the directory name? What is the project path?
Perhaps there is a problem with them that sight of them will solve.
Also, I've run into problems running VS with projects on an external FAT32 drive. It only has support for 260 characters in a full file path so I found I couldn't create some directories because they were too far down the path.
|
|
|
|
|
Thanks for replying. I have fixed my problems so letting you know if you or anyone ever get a chance to face these kind of problems.
Although, my project name was ABC and it was locted inside a folder that reside on desktop. As i said before I could run couple of my proejcts in the past without any errors and could also create and delete files/project.
Problems Solutions:
I was working on my other programming projects so i set some Environemt paths varialbes. I deleted all those path that i set and now I can run Visual studio as I was able to run before successfully.
|
|
|
|
|
THANKS
Have Fun
Never forget it
|
|
|
|
|
Any one know what the best HASH Encryption is to use on .NET?
I'm talking about built-in ageratum (MD5, SHA).
Please help me out, Thanks.
|
|
|
|
|
never.reply wrote: what the best HASH Encryption
"Hashes aren't encryption"
link[^]
|
|
|
|
|
Perhaps they want to make a hash, and then encrypt it
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
.NET offers MD5, RIPEMD160, SHA1, SHA256, SHA384, and SHA512.
I can't tell which is right for you without know why you need a hash function.
SHA512 is the most "secure" of the choices but it maybe overkill in certain applications.
|
|
|
|
|
Hi everyone...
I'm working with some Touch-Kit Touch-Screens and Win-Driver under C#.
The main idea is to work with the Touch-Screen as the expanded Monitor (Secondary).
So a user can work with the PC on the primary screen and another on the secondary.
I built an On-Screen Keyboard and works great.
My problem now is to work with the mouse and the touch separately.
I want the user who is in the main screen to work with the mouse, but the user who is with the touchscreen just touching the screen.
Everything works fine until I tried to touch a menu of an application (eg. File menu on Ultra-Edit).
Which is the way to Send/Post a message to the Target App on (X,Y) Screen position.
I'm doing the following.
My app captures the USB port and reads the Touch-Screen's IN pipe. Calculates the Screen Point with the calibration data and starts the messaging.
- Basically the steps are sum-up to:
1- Capture the hWnd from point (x, y). hWnd = WindowFromPoint( p );
2- ScreenToClient( hWnd, ref p );
3- PostMessge( hWnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELONG( p ) );
4- PostMessge( hWnd, WM_LBUTTONUP, 0, MAKELONG( p ) );
The reason I'm using PostMessage instead of SendMessage is because, when an application, after touching the screen shows a message box, my app is halted until the message box disapears.
Hope to be clear about what I'm looking to do!
Thanks a lot everyone!
Guillermo L. Odone
|
|
|
|
|
I have Access 2003. I need to write a C# app to import the contents of a (very simple) Access 2000 database. In this database are three tables, linked by primary keys. The keys have the datatype of 'number', but when I look at them in Access 2003, they are GUIDs. I can't work out how to write the SQL to get the records associated with a GUID. Based on some reading, I tried this:
OleDbCommand cmd = Myconnection.CreateCommand();
cmd.CommandText = "SELECT * FROM Records where Key = {GUID {" + clientKey + "}}";
dbReader = cmd.ExecuteReader();
but the reader is always empty. What's the syntax for filtering on a number data type that turns out to be a guid ?
Thanks
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Having knocked up a quick sample app, that syntax should work.
In Access, a GUID is the data type for fields of type AutoNumber with the Field Size property set to 'Replication ID'. Is your GUID formatted correctly?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I don't know. I am reading it in as a string from the database, and then formatting that string to do the query. The data type in the database is 'number', not GUID. The GUID in the database looks exactly like the string I am getting back and storing for my query.
Yes, the field type is 'replication Id'
-- modified at 16:08 Monday 5th November, 2007
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I changed the data type of the field in my sample app to 'Number' and it still worked OK.
This is the query I used:
SELECT * FROM Table1 WHERE xxx = {GUID {5CC9B07E-5DBE-4C65-9B84-7CBE5B6C523B}};
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
OK - I guess I need to play with it some more then. Thanks.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|