|
Hi,
I think you can download the Full Source of that article and make some changes on it. and recompile it.
In SystemHookCore.cpp at InternalKeyboardHookCallback function you should mark last line and add
return 1; instead of that line:
static LRESULT CALLBACK InternalKeyboardHookCallback(int code, WPARAM wparam, LPARAM lparam)
{
if (code < 0)
{
return CallNextHookEx(hookKeyboard, code, wparam, lparam);
}
if (UserKeyboardHookCallback != NULL && !keyboardFilter.IsFiltered((int)wparam))
{
UserKeyboardHookCallback(code, wparam, lparam);
}
return 1;
}
But I think it is a rapid solution. in addition you should add some mechanism in other class to check in application level that you want to take this action on this character or not.
Ahmadreza Atighechi
|
|
|
|
|
Thank's a lot!
It's works fine
Can you tell me, how can I modify the ManagedHook or HookCore project to tell them witch cases makes this return 1 trick, and witch not.
So how can I tell to the class from my C# app to do the return 1 action when my defined keys pressed, and otherwise do the normal action?
I think i shoud add somethink like this:
List<keys> l;
Than I add my specila keys to the list, and every time keypress occures I search the list for the actual key, when I find it, do the return 1...
Sorry for my stupid questions, but i not familiar with dll manipulation
I trí to modify SystemHookCore.cpp, and add a method, and a global witch set/store the keycodes, witch is exclude from system hooks. also modify the, managedhooks class, rebuild all, but when I start my app get error:
"Entry point(my new function name) was nt found on systemhook.dll"
Thank's for help!
-- modified at 10:29 Sunday 21st May, 2006
|
|
|
|
|
I am making a tray application with a custom ApplicationContext. Application exits OK when i close application manually. When i try to close application by doing Shutdown windows, windows aborts shutdown. I realize my problem is because application is not cleaning up.
What do i need to do so that my application will exit OK when a user chooses to Shutdown windows instead of closing manually? I am at a loss where to put clean up code.
|
|
|
|
|
Search this forum, I posted the answer to the same question only a week or 2 ago.
|
|
|
|
|
Please , can anyone here tell me where I can find significant information about Stacks and Queues in C#? I've been consulting many tutorials but nothing objective ...And I need it a lot now . Thanks
BiGjOe
Passez Ce Qu'il Passe
|
|
|
|
|
What sort of 'objective' information do you want ? Do you want to know about existing container classes, how to write your own, or just the nature of those container types ( regardless of language ) ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
If I have to decide , I could say the third , but really , I need general information about .
Thanks
BiGjOe
Passez Ce Qu'il Passe
|
|
|
|
|
OK. Google would have tons of info, what do you mean by 'objective' ?
Get the coins out of your pocket. Start putting them in a pile on your desk. This is a stack. When you take items off, the last item to go on is the first to go off.
When you go to the cinema, if it's busy, you need to stand in line to buy a ticket. This is a queue - the first person in the queue gets to leave the queue first.
That's all there is to how these two containers work. What other information were you looking for ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Well , that's what I know , and anything more . I've ever worked with stacks or queues , so , I think there's anything more . That's why the question .
I mean , arrays are too very simple , but I can read chapters about
BiGjOe
Passez Ce Qu'il Passe
|
|
|
|
|
I'm sorry, I don't understand the question at all. A stack or queue is probably implimented as a list, but you can think of it as an array which limits which items you can access at any time. There is tons of info around on container types, I have an O'Reilly book called Algorithms in C ( or something like that ) which is great for learning about this stuff.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Try this link: An Extensive Examination of Data Structures (including stacks and queues)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/datastructures_guide.asp
Osama E. Adly
|
|
|
|
|
Thanks , a very good one
BiGjOe
Passez Ce Qu'il Passe
|
|
|
|
|
Hi,
To be able to playback Wav MemoryStreams from a console I have to call this function
ApplicationDevice = new Device();
ApplicationDevice.SetCooperativeLevel(NEED_POINTER_TO_CONSOLE, CooperativeLevel.Normal);
I have tried calling
[DllImport("kernel32")]
static extern IntPtr GetConsoleWindow();
to get the a pointer to the console, but it doesn't work.
The CTOR takes either a Control like a Form or a IntPtr. Please help me.
TIA
------------------
I'm naked under my clothes...
-- modified at 19:10 Saturday 20th May, 2006
|
|
|
|
|
I have TreeList. This TreeList have TLNode(TreeListNode).
To set value i use public override void SetValue(object columnID, object val).
But it don't call. How to set this value?
public class TLNode : TreeListNode
{
String Title;
String Url;
public TLNode(int id, TreeListNodes owner, String title, String url) : base(id, owner)
{
Title = title;
Url = url;
}
public override string GetDisplayText(object columnID)
{
return Title;
}
public override void SetValue(object columnID, object val)
{
DevExpress.XtraTreeList.Columns.TreeListColumn id = (DevExpress.XtraTreeList.Columns.TreeListColumn)columnID;
switch (id.AbsoluteIndex)
{
case 0:
val = Title;
break;
}
}
public override object GetValue(object columnID)
{
DevExpress.XtraTreeList.Columns.TreeListColumn id = (DevExpress.XtraTreeList.Columns.TreeListColumn)columnID;
switch (id.AbsoluteIndex)
{
case 0:
return Title;
default:
return "";
}
}
}
SetValue have stop point and debuger don't go in this metod after end edit string in TreeList.
|
|
|
|
|
Hi,
I want to write "Hello World" using Notepad and then create the HelloWorld.exe using
the >csc HelloWorld.cs (from the command prompt). "Inside C# -- Chapter 1".
1. How should I save the file with Notepad? *.txt? *.cs? "all files"?
2. I'm almost certain that I have set the environment variables for the Framework SDK
correctly.
3. I have installed on my machine VS.NET 2003.
4. The file is located on the desktop. I can use the command prompt to open any file on the desktop. HelloWorld.txt will open. HelloWorld.cs will not open (although it will create a file as a ".cs" icon) and any "csc" command will not be recognized.
Any help would be greatly appreciated. Go easy on me -- I'm just trying to learn the basics -- thanks
|
|
|
|
|
Hi!
1. It doesn't matter. You just have to look at the filename your source file gets - when you save it with "*.txt" as filter, Notepad automatically adds ".txt" to the filename. So if you save your source file as "HelloWorld.cs", you'll end up with a file "HelloWorld.cs.txt".
But for compiling the final filename really doesn't matter.
2. If you did, "csc.exe" will be found. If you didn't, it won't be found. Simple as that.
3. Then you'll have a VS.NET 2003 command prompt in your start menu. Use this to get the console window, then the correct paths will be set.
4. Putting source files on the desktop usually isn't such a good idea. Create yourself a dedicated source directory (C:\Sources, for example). This is far easier to reach, especially if you're using a command prompt.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi! I'm pretty new to C#, but, i wanna learn...
I have a question... i have a datagridview binded to a database, but i wanted to add also a delete column to erase that row. The problem is i can't find an event to trigger when i push the delete button. this would be the first part of the problem. the second problem is how do i know which row to delete when the button of one raw is pressed?(i would be regardful if u gave me some code examples, too).
|
|
|
|
|
Hi,
First of all, are you using asp.net or windows? If it is windows you can use the code below:
private void dataGrid1_Click(object sender, System.EventArgs e)
{
DataTable dt = dataGrid1.DataSource as DataTable;
if(dt!=null)
{
string firstField = (dt.Rows[dataGrid1.CurrentRowIndex][0].ToString());
}
}
As you can see, what I'm doing is casting the datasource datagrid's property to a datatable object. Then using the CurrentRowIndex property I can obtain any field's values from the datatable.
If it is an asp.net application, then you can use the code below:
private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName=="Select")
{
string id = e.Item.Cells[1].Text;
Response.Write(id);
}
}
In this case, I'm assuming the ID of the row is presented in the second column (since the first one is the SELECT link).
I created a tutorial about GridView control (asp.net 2.0) at www.KYNOU.com. I'm always in this website's chat room. If you want to chat with me live logon to it.
I hope I helped
|
|
|
|
|
I feel really dumb asking this question, but I have spent about 5 hours searching for the answer to this, and have had little to no luck.
I am a completely newb coder to anything other than perl, so please take pity
Basically I want to have a form with 2 text boxes and a button. (Got that part down :P)
Text box 1 is for the user to enter an IP address (Got that part too)
User clicks the button, and I need to run a "system"/"cmd"/"dos" command like so "nbtstat -A " + textbox1.text
then I need to read the results, parse out the MAC address make it show as textbox2.text
Any help would be awsome! Thanks!
|
|
|
|
|
If you want to wait for the process to stop before continuing the thread or forward stdio:
System.Diagnostics.Process p = new Process();
p.StartInfo = new System.Diagnostics.ProcessStartInfo("command", "arguments");
p.Start();
p.WaitForExit();
If you want to just start the process and move on:
System.Diagnostics.Process.Start("command", "arguments");
|
|
|
|
|
Process.Start() and its overloads are the way to create a new process. Which is exactly what you're doing with nbtstat -A. You can do something like:
Process.Start("nbtstat -A " + textBox1.Text);
The problem is, of course, getting the output from that. You won't be able to do it. So what you want to do instead is create a process like so:
Process proc = new Process(); proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.FileName = "nbtstat"; proc.StartInfo.Arguments = "-A " + textBox1.Text;
That tells the Process class that you want to redirect stdout so that it doesn't go to the console. After you do that, you can do this:
string output = proc.StandardOutput.ReadToEnd(); proc.WaitForExit(); textBox2.Text = output;
The docs mention that you have to call ReadToEnd() on the output stream before you call WaitForExit() because a deadlock condition could occur the other way 'round.And finally, put the output in textBox2. Just make sure textBox2 is a multiline textbox.
Once you wanted revolution
Now you're the institution
How's it feel to be the man?
|
|
|
|
|
THANK YOU!!!!
|
|
|
|
|
Ok I finally Got this to work
Here is the code I used:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Process p = new Process();
StreamWriter sw;
StreamReader sr;
StreamReader err;
ProcessStartInfo psI = new ProcessStartInfo("cmd");
psI.UseShellExecute = false;
psI.RedirectStandardInput = true;
psI.RedirectStandardOutput = true;
psI.RedirectStandardError = true;
psI.CreateNoWindow = true;
p.StartInfo = psI;
p.Start();
sw = p.StandardInput;
sr = p.StandardOutput;
err = p.StandardError;
sw.AutoFlush = true;
sw.WriteLine("nbtstat -A " +textBox1.Text);
sw.Close();
textBox2.Text = sr.ReadToEnd();
textBox2.Text += err.ReadToEnd();
|
|
|
|
|
|
Click the view details button, and show us some of that
|
|
|
|