|
|
You talking about capturing keystroke and logging what is typed and in which application they are typed?
Since your requirements include loggin WHICH application recieves the keyboard message, you've added a new layer of complexity to your app. You can't simply use just the keyboard hooks function anymore since you will never receive any notification of where the message is going. To get that, you also have to use the CBTProc callback function (or hook) to keep track of the window that's currently activated. You have to get the name of the window using the window handle that's passed in during certain events that get sent through your CBTProc procedure.
RageInTheMachine9532
|
|
|
|
|
I m so and feeling bkz i m
CommandBarComboBox
i m making Add ins for outlook .I have added a ControlEdit button in
CommandBar collection using the following code...
oEdit = (JOffice.CommandBarComboBox)
oCommandBar.Controls.Add(JOffice.MsoControlType.msoControlEdit,oMissing,oM
issing,oMissing,oMissing);
oEdit.BeginGroup = true;
oEdit.Text = "Search";
oEdit.Tag="URL";
oEdit.Caption="Search Word";
now the problem is when i m fatching the value from edit box ,it is not
returning me the value.I m not able to get the value which i have
written inside the edit box .the code i have written for this is following
private void oButton1_Click(JOffice.CommandBarButton Ctrl, ref bool
Cancel)
{
try
{
CommandBarComboBox tempCom;
tempCom =
(CommandBarComboBox)oCommandBar.FindControl(JOffice.MsoControlType.msoCont
rolEdit, "oEdit", "URL", false, false);
Sval=tempCom.Text;
System.Windows.Forms.MessageBox.Show(Sval); // here no value
Test1.JOutLookLib.SearchURL("http://www.google.co.in/search?q="
+Sval+"+&ie=UTF-8&oe=UTF-8&hl=en&btnG=Google+Search&meta=");
}
->NOTE : JOffice is an Alias for Namespace which I have included in My Code
when i write any value inside the edit box and click the button the new
value is auto clears and again the old value appears .I don't know how i
can solve it .I need the new values and it is returning old values .,...
mean it is not refreshing .
Please solve it it is very .....
Thanks for Help and ur time
|
|
|
|
|
I've just finish my project so I want to create a setup project but i do not known how to include the .NET Framework, Crystal Report into setup project.
Please help me.
Thanks
Mr Duc Linh Nguyen
|
|
|
|
|
You can't include the .NET Framework - it must be bootstrapped. Read Redistributing the .NET Framework[^] in the .NET Framework SDK for more information, including how to get example source and use that to bootstrap (i.e., run installations required for your installation PRIOR to running your installation).
To install the Crystal Reports managed runtime (includes unmanaged code as well), read Deploying Crystal Reports in .NET Applications[^]. There are four merge modules (.msm) that you include with your Windows Installer setup project. These are merged (hence the name) with the installer package when built. The regwiz MSM requires a license key that you can get for free by registering the Crystal Reports designer when you use it for the first time. This would've been emailed to you. For Windows Forms client applications, you have royalty-free redistribution rights. Read Incorporating Reports into Applications[^] for more information about licensing and different scenarios.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
i do not know how to catch error in data grid cell. this is the code i writed:
private void ColumnChangingHandler(object sender,DataColumnChangeEventArgs args)<br />
{<br />
switch(args.Column.ColumnName)<br />
{<br />
case "accID":<br />
{<br />
DataGridCell oldCell= new DataGridCell();<br />
string values=args.ProposedValue.ToString();<br />
if(!this.IsNumber(values))<br />
{<br />
MessageBox.Show("value must be number");<br />
}<br />
else<br />
if(!IsLengh(values))<br />
{<br />
MessageBox.Show("It must be 4 characters");<br />
}<br />
break;<br />
}<br />
..............................<br />
after catch error i want to return the focus on error cell.
Please help me as possible as you can.
Thanks.
Mr Duc Linh Nguyen
|
|
|
|
|
I am not sure what you need to do, but I think this can help you..
In the constructor of the form (for example), you add something like this :
DataGridTextBoxColumn _datagridtextBox = (DataGridTextBoxColumn)YourDataGrid.TableStyles[0].GridColumnStyles[X];<br />
_datagridtextBox.TextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Execute_This);
where X is the index of the column that is supposed to have only numbers of 4 characters..
You will also need to write something like this :
private void Execute_This(object sender, System.Windows.Forms.KeyPressEventArgs e)<br />
{<br />
<br />
TextBox tBox = (textBox) sender;<br />
<br />
}
|
|
|
|
|
Hi, Guys
I need to get data type for the streams that I read into the memroy.
Assumption is that we don't know anything about file.(we do know deliminator, which in this case is '#')
for example input files is as follows
name#money#loanNumber
Joe#10000#L01
Amy#2000#L05
Tom#12000#L11
As you see, column name and loadNumber is type of string, and money is integer.
However, how do I decide in my c# program? should I make compare set of {'0', ..., '9'} and compare one by one for all the characters? Or is there any other way to decide these data type.
Thanks guys!
|
|
|
|
|
- Read one line
- Parse that line for '#'
- Split the line into its substrings
- Analyze any substring, using String.IndexOfAny( "ABCDEFG..." )
- If index found, it is a string; else, it is an integer
|
|
|
|
|
Thank you!!
you saved me!
|
|
|
|
|
i have an image of size 3300 * 2100. I am looping through the pixels and counting the number of colors in image and total number of pixels for each color. This code takes about 9 Minutes to Run on PIV 1.6GHz with 512 MB RAM. I want to significantly reduce this time. I am using Hashtable whose key is color and value is number of pixels of that color. Any suggestion will be highly appreciated. Here is the code.
In this code image is the object of Bmp class which i have made to read and write Bitmap faster using unsafe code.
<br />
ArrayList GetAllObjects(); <br />
{ bool test;<br />
int count=0;<br />
ArrayList list=new ArrayList();<br />
ArrayList final=new ArrayList();<br />
Hashtable ObjHash=new Hashtable();<br />
<br />
for(int y=0;y<image.Height;y++)<br />
{ <br />
for(int x=0;x<image.Width;x++)<br />
{<br />
test = true;<br />
<br />
if( ObjHash.ContainsKey(image.pixel[x,y].GetColor()) )<br />
{<br />
int val= (int)ObjHash[image.pixel[x,y].GetColor()];<br />
ObjHash[image.pixel[x,y].GetColor()]=++val;<br />
test=false;<br />
}<br />
<br />
if(test)<br />
{<br />
ObjHash.Add(image.pixel[x,y].GetColor(),1);<br />
list.Add(image.pixel[x,y].GetColor());<br />
count++;<br />
}
<br />
}
}
<br />
for(int i=0;i<list.Count;i++)<br />
{<br />
if( (int)ObjHash[(Pixel)list[i]] > 1000)<br />
final.Add((Pixel)list[i]);<br />
}<br />
<br />
return final;<br />
}<br />
Any suggestions??
Thanks!
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
Why not use a local color variable, rather than looking the color up for each iteration?
<br />
Color currColor = image.pixel[x,y].GetColor();<br />
<br />
if( ObjHash.ContainsKey(currColor) )<br />
{<br />
int val= (int)ObjHash[currColor];<br />
ObjHash[currColor]=++val;<br />
test=false;<br />
}<br />
else
{<br />
ObjHash.Add(currColor),1);<br />
list.Add(currColor);<br />
count++;<br />
}
<br />
On top of that, you could try managing your arraylist and hashtable size. As enlarging a hashtable or Arraylist is a large overhead, and you are doing 6,930,000 loops, it might be worth setting the size of your arraylist and hash table to AL.Size + 1000; when it's full. Then trim it after the loops.
Why are you swapping the arraylists at the end? This could take a while if you have a few thousand entries. Why not trim the origional one, and return that?
Cata
|
|
|
|
|
Read Christian Gauss's articles about image manipulation and start using pointers to RGB memory positions instead of pixel[x,y].
This will make your code at least 20x faster.
Perl combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski
|
|
|
|
|
Since you don't have problem with memory (you allready load a 3300x2100 image!), try allocating table that holds the colors.
int colors[]=new int[16777216];
for(int i=0;i<16777216;i++) colors[i]=0; <br />
for(int y=0;y<img.Height;y++)<br />
{ <br />
for(int x=0;x<img.Width;x++)<br />
{<br />
test = true;<br />
colors[image.pixel[x,y]]++;<br />
}
- - - - - - - - - - - - - - - - - -
Memory leaks is the price we pay \0
01234567890123456789012345678901234
|
|
|
|
|
Since we now have a tight loop, a major amount
of execution goes into checking the loop command itself.
(checking x<img.width and="" brancing="" commands)
thus,="" we="" unroll="" the="" inner="" loop!
<code="">
for(int y=0;y<img.Height;y++)
{
// do chucks of 128 pixels at once
for(int x=0;x<img.Width-128;x++)
{
// 128 times
colors[image.pixel[x,y]]++;x++;
colors[image.pixel[x,y]]++;x++;
colors[image.pixel[x,y]]++;x++;
...
colors[image.pixel[x,y]]++;x++;
colors[image.pixel[x,y]]++;x++;
colors[image.pixel[x,y]]++;x++;
colors[image.pixel[x,y]]++;
}
// do the remaining pixels
for(;x<img.Width;x++)
{
colors[image.pixel[x,y]]++;
}
}
- - - - - - - - - - - - - - - - - -
Memory leaks is the price we pay \0
01234567890123456789012345678901234
|
|
|
|
|
Hello every one:
I have a question about a Game-Source-code.I have down some soure-code from codeproject,but I can not find the "Microsoft.directx.directdraw" dll,
I can use DxVbLib onely in my code.What shoud I do?
game
|
|
|
|
|
download and install DirectX
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
That will not suffice.
You will need the DirectX SDK (download the 2003 summer update), and installed Managed DIrectX (run the dxsetup.exe with /InstallManagedDX)
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Thank you:
Where can I get the "Managed DIrectX ".
game
|
|
|
|
|
I'm rather new to oleDatabases, but I got my table setup, and connected to it in my application using the oleDbDataAdapter. I have a DataSet which gets my rows from my .mdb table, and a combobox which fills from a column in this dataset. Here are my questions:
When I fill my dataset, my combobox automatically puts the top entry of the column into the textview. I want the text to remain blank, but the container to be filled. For some reason, comboBox1.Text = ""; doesn't do the trick, even if I call it directly after filling my dataset. How do I keep the text in my comboBox from selecting the first element in the container?
After I choose an item in the container, I would like to fill other text boxes with information from the same row in my table as the item in the combo box. How do I find and retrieve the row from my dataset?
Thanks a lot for the help. I hope I wasn't too vague on anything!
|
|
|
|
|
Try selecting the index -1 to not select the first item in the list.
comboBox1.SelectedIndex = -1;
You can also use the selected index to get an offset into the dataset to get the text, but I'm sure there is a better way.
|
|
|
|
|
http://blogs.msdn.com/ericgu/archive/2004/04/01/105644.aspx
|
|
|
|
|
Good one
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
hello, all.
I am trying to convert a struct from VB to c# in order to use an old DLL. Here is the definition in VB
Public Type CHost
Host As String * 60
Port As String * 5
Info As String * 120 'Inof returned from host
Timeout As String * 10
End Type
In the sample VB code:
Public Declare Function CConnect Lib "OLDDLL.DLL" (Host As CHost) As Integer
iError = CConnect(TheHost)
and then the CHost.Info was set by the remote host.
I converted it to(C#)
public struct CHost
{
[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr,SizeConst=60)]
public string Host; //host name
[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr,SizeConst=5)]
public string Port; //host port
[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr,SizeConst=120)]
public string Info; //Info returned from remote host
[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr,SizeConst=5)]
public string Timeout; //timeout
};
in my c# code.
[DllImport("OLDDLL",EntryPoint="CConnect")]
public static extern short CConnect(ref CHost Host);
short ierror = CConnect(ref theHost);
I can connect to the remote host but the theHost.Info was not set.
Could anybody let me know what I was doing wrong and what is the right way to do it?
|
|
|
|