Hmm.. I don't believe this is the case. If a hook is in place globally whether it is WH_MOUSE or WH_KEYBOARD or WH_KEYBOARD_LL the hook functions the exact same for each case. Nothing is injected into any running process, it doesn't work like that. A hook is ultimately a callback function that applications register with a particular system event. It is not injected into every running process as you say. Doing this with C# is no different then any other language as I am just using the windows API. Now I have the code that can capture WH_MOUSE events at the thread or local application level but I need them to be captured at the global or system level. Any suggestions?
gekoscan
Posts
-
WH_KEYBOARD Global Hook -
WH_KEYBOARD Global HookHello, http://msdn.microsoft.com/msdnmag/issues/02/10/cuttingedge/ I don't know if any of you are familiar with Dino Esposito article in MSDN magazine on .NET Hooks but I used the class he created named LocalWindowsHook that imports the below API calls protected static extern IntPtr SetWindowsHookEx(HookType code, HookProc func, IntPtr hInstance, int threadID); and a few other necessary functions from user32.dll to implement a hook. I ended up changing his Install function from public void Install() { m_hhook = SetWindowsHookEx( m_hookType, m_filterFunc, IntPtr.Zero, (int)AppDomain.GetCurrentThreadId()); } to public void Install() { m_hhook = SetWindowsHookEx( m_hookType, m_filterFunc, GetHInstance(), 0); } public static IntPtr GetHInstance() { return Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0]); } In an attempt to create a global hook using WH_KEYBOARD. The problem I have is it doesn't work. :| It works globally with WH_KEYBOARD_LL but as soon as I use WH_KEYBOARD it doesn't work at all. This meaning it doesn't capture keyboard strokes in either the windows form or anywhere else. Now Dino's code worked fine for a local hook (aka the form) but I want a global or system hook. Now I have the class he wrote in an external DLL but there must be something else i am missing. If anyone has any suggestions they would be very much appreciated. Thanks very much. Dino Esposito modified project and my test windows form can be found here http://scaninc.ca/hook/globalhook.zip
-
DLL outputIf am creating an ASP.NET solution and I have 10 online forms all in the same solution/project. The output is a .dll called MyForms.dll. Does this mean every time the user first visits my site he/she has to download this 160Kb file called MyForms.dll? If this is the case how can I have a bunch of forms in one project/solution but have them compile under different .dll names. ex. MyForm1.dll MyForm2.dll MyForm3.dll Could someone point me in the right direction as to how this works? Thanks, Steve.
-
Custom Control +Shopping Cart OptionsHey Jason, Thanks very much for taking the time to reply. You suggested and object factory. This sounds quite interesting, I have never heard of something like this. Is there a tutorial or some documentation on what you are describing? Thanks very much.
-
Custom Control +Shopping Cart OptionsHey, Okay here's the problem. I have a product line with shoes and clothes. The database for the productline looks like this. <-Table: Products-> ProductId ProductDescription ProductName ProductPrice ProductOption Now depending if the product is a shoe or a peice of clothing the ProductOption has a value of 0 or 1. When it is a 0 it is a shoe. When showing a shoe I want to be able to have a dropdown combobox that will allow the user to select the shoe size. But when it is not a shoe I don't want to see this control at all. Now this is a simple version but of what I am trying to accomplish. My product option actually ranges from 0 to 11 and I need different controls for each one. Some have textboxes and some have dropdowns. Can anyone give me some insight into how this is usually done? Or a tutorial posted somewhere that might lead to some answers? Thanks so much!:wtf:
-
Custom Web Control CrazinessI want to create a custom control that has 3 text fields. How would I go about doing it this way.
protected override void Render(HtmlTextWriter output) { StringBuilder s = new StringBuilder(); //Note I realize the opening tag for the asp:TextBox is missing but it wouldn't show in the forum the other way. s.Append(""); s.Append(""); s.Append(""); s.Append(""); output.Write(s.ToString()); } In my .ascx I have the follow overloaded function.. My table layout is a lot more advanced involving custom images and tables within tables but I am using this an a simple example. Now usually this is done with something similar to what is below. But my table html code is just to complex to get into creating the table like this. How can I use my code above to create a table but then somehow render it as a control? `TextBox txtUsername; protected override void CreateChildControls() { table = new Table(); TableRow tr = new TableRow(); TableCell td; td = new TableCell(); txtUsername = new TextBox(); td.Controls.Add(txtUsername); tr.Controls.Add(td); }` Thanks for your help everyone. Steve Nelson asp:TextBox id=textbox1 runat=server> asp:TextBox id=textbox2 runAt=server> asp:TextBox id=textbox3 runAt=server>
-
Custom Web ControlsI am creating a registration form which has 3 pages of content in 3 seperate blocks of html.. basically the 1 2 3 step registration. I want to be able to post back on my Registration.aspx?Page=2 and display a different page to the user by selecting a certain block of html. Page 1:
ASP:Textbox -name ASP:Textbox -password some radio buttons
Page 2:
ASP:Textbox - address ASP:Textbox - phone some check boxes
Basically I want to do this somehow with a custom web control displaying each block of html by somehow using the querystring. My Question is can I somehow pass the QueryString value into the the web control? Okay and if this isn't possible... Given that I have a Registration.aspx?Page=[somevalue] How could I go about doing what I have explained? Selecting different blocks of html depending on what the querystring yeilds. Thanks for your help everyone, steve.
-
MS_POSITIONING="GridLayout" (Correction)Hey, I created a html layout for my site.. with a nice menu on the side and top. I wanted to have a registration form so I just copied in the html layout into the body of my Registration.aspx. I took all
code containing my ASP:CONTROLS for the registration and placed it in a of a table in my nice html layout. aka.. ASP:CONTROLS
My problem now is the MS_POSITIONING gridlayout that made my Registration form look all aligned and neat looking isn't working. The html template looks great but all the registration controls aka ASP:LABELS and ASP:TEXTBOXES in the
ASP:CONTROLS HERE are all messed up (there positioning is all wrong). I guess my question is what is the best way to integrate a nice HTML layout with .aspx pages? Can someone point me in the right direction? If you say iframe i will cry. LOL:(( Thanks so much, Steve Nelson
-
Using MS_POSITIONING="GridLayout"Hey, I created a html layout for my site.. with a nice menu on the side and top. I wanted to have a registration form so I just copied in the html layout into the body of my Registration.aspx. Then copied all the form code containing . My problem now is the MS_POSITIONING gridlayout that made my Registration form look all aligned and neat looking isn't working. The html template looks great but all the registration ASP:LABELS and ASP:TEXTBOXES in the
ASP:CONTROLS HERE are all messed up (there positioning is all wrong). I guess my question is what is the best way to integrate a nice HTML layout with .aspx pages? Can someone point me in the right direction? If you say iframe i will cry. LOL Thanks so much, Steve Nelson
-
<form questionI already have a
on my page. I have a datalist inside this form. I need the ability to have a hyperlink on the page that needs to execute the following code when it is clicked Please can someone help me out it's crucial that I get this working. Thanks so much to anyone that can help me.
-
Calling C# function within javascriptI want to prompt the user with a alert message before they continue to delete a record from the database. Can anyone point me in the right direction. Thanks, Steve Nelson
-
why does .a.s.p.x extension come up as .phpx?What the hell i entered a question with the .a.sp.x extension for asp.net and it put in .phpx?>????? that's messed up!!!
-
.aspx or htmlIf I want to have a nice page design/theme throught a site but still want to use .aspx. How can i include a html template or whatever to accomplish this. Would i include it in the .aspx. or include the .aspx in the html file? Thanks, steve
-
Uploading PictureHmmm... but how does someone like MSN Messanger with like more then 10 million users store all the profile images of the users in a database. It would get rediculously large.. how is this managed? THanks, steve
-
Membership profile questionHmm.. Okay I have a website with a profile for the members. I am storing the members picture in a database. My worry is if my member community gets to large it will max out the storage on my database. So my other alternative is storing the member pictures right on the server. Really I don't know which one is a better way of doing things.. If anyone could shed some light on this it would be greatly appreciated. Thanks very much, Steve
-
SQL JOINI am using a dataList and i am joining two tables. Each table is linked by a foreign key of ListedById. But each table has a column in it called ImageId which points to a different image. In SQL I can point at a table.column name like this. tProperties.ImageId and tListedBy.ImageId how can I do this once the data is bound to my datalist control? aka... <%# DataBinder.Eval(Container.DataItem, "tProperties.ImageId")%> aka... <%# DataBinder.Eval(Container.DataItem, "tListedBy.ImageId")%> If anyone could help me it would be really appreciated but I am thinking that it might have to be done before the control is bound. Just it would be nice if this was possible. Thanks, Steve Nelson :((:eek:
-
Function calling from client sideHey... I have data bound to a DataList and I can access any column of it by going <%# DataBinder.Eval(Container.DataItem, "Description")%> in the html code. My problem is the data is to long and I want to trim it to 40 characters or less. So I wrote a function to do so. public void Description() { string sDescription = string sTemp = string.Empty; for (int i=0;i<40;i++) sTemp += sDescription[i]; sTemp += "..."; Response.Write(sTemp); } now how do I pass in the description string????? you can't use <% %> inside a scripted function???? Can anyone help me or if anyone has a better way of doing this I would love to hear it!! Thanks, Steve Nelson
-
Stream Write ProblemsI have a memorystream full of data. I try and use the MemoryStream.Write(byte[],0,MemoryStream.Length) and it fills my byte array up with all zero's almost like it never copied. I can verify there is data in the MemoryStream. The position of the memory stream is at 0 so that's not it.... Can anyone help me? I just don't get it. Thanks very much, Steve Nelson
-
Image Upload Stream ProblemI have the following code: TempImage.GetThumbnailImage(95,72,null,IntPtr.Zero); MemoryStream ThumbStream = new MemoryStream(); TempImage.Save(ThumbStream,System.Drawing.Imaging.ImageFormat.Jpeg); int iThumbSize = (int)ThumbStream.Length; byte[] ThumbImageData = new byte[iThumbSize]; ThumbStream.Write(ThumbImageData,0,iThumbSize); I am taking a image and creating a thumbnail to save to a database. I can see that there is data in the ThumbStream using quick watch. When I use the .Write it doesn't copy the data over. I seriously don't understand. oh and iThumbSize is 2996. If anyone can point me in the right direction it would be greatful. Thanks...
-
Ecommerce Image UploadingThanks so much for the reply. My worry is if i have write permissions on a certain folder anyone will be able to overwrite the images that have already been uploaded there. My client is a realestate agent and she wants the ability to add new realestate properties herself. We are using ASP.net to make it simple for her to upload the new properties she is advertising. I am just worried with write permissions on a folder mischievious users might overwrite or upload images. What is the best way to make sure my client can still upload pictures and others can't do the same. Thanks very much for your time. Sincerely, Steve Nelson