|
|
does any one of u know a
free-ware tool that can
test software. i.e
does its black box, white box,
regression or other type of testing
|
|
|
|
|
|
OK
After some serious research i've managed to display some balloon tooltips on a notifiyicon, hooked up to a windows form.
But i inteded to write a windows service instead of a form-based application.
Since you need a window handle to run the shell_notifyicon function, needed to display the balloon tooltips, and i don't seem to find the handle from a service, i have a problem
Does anybody know how to get the handle from a windows service, or any way to hook up a balloon tooltip to the notifyicon from a service??
Thx in front
Jochen
|
|
|
|
|
A Windows Service doesn't have a Window handle, so you'll have to P/Invoke GetDesktopWindow :
[DllImport("user32.dll")]
private static extern IntPtr GetDesktopWindow(); Your service, if run as LocalSystem, will also have to have the "Allow service to interact with desktop" option checked in the Service snap-in. See your Control Panel\Administrative Tools for the snap-in.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hello,
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
|
|
|
|
|
The WH_KEYBOARD_LL hook is called in your app. context so can easily be made in C#.
A global WH_KEYBOARD hook however executes in teh context of the app. that is recieving the keyboard message so your code has to be injected into every running process. This is NOT a good idea IMHO. It only seems to work if the m_filterfunc is exported from the DLL in the [EXPORTS] table.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
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?
|
|
|
|
|
I take it you have read the MSDN article on hooks? It states:
....This is because global hook procedures are called in the process context of every application in the desktop, causing an implicit call to the LoadLibrary function for all of those processes....
If you only want to be aware of mouse or keyboard events system wide use a WH_JOURNALRECORD hook. Otherwise write your hook stuff in a standard DLL with an EXPORTS section.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
I have a custom graphic file format for my application. I would like to write a shell extension so that it shows in the Thumbnail Preview in Windows Explorer.
I would also like to write a browser plugin so that when users click on the file, instead of the save or open dialog, it shows in the browser.
Where should I start? Pointers are welcome.
|
|
|
|
|
To have the shell extract an image for your document, you must register an IconHandler and implement IExtractImage , as well as the necessary icon handler interfaces. For more information about the IExtractImage interface, which you can declare in .NET using COM interop, see http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/iextractimage/iextractimage.asp[^]. For more information about creating icon handlers, see Creating Icon Handlers[^] in MSDN. This can all be done via a CCW (COM-Callable Wrapper) in .NET, but you'll have to re-declare all the interfaces, structs, and constants necessary. Fortunately, there isn't too many in this case.
As far as writing a browser plugin, that gets a lot more complicated and you might consider doing this in C++ because there's a lot of interfaces, structs, and constants that you'll need to use. It's not that you can't do it in .NET, just make sure you fully understand COM interoperability in .NET.
This uses MIME handlers to host controls like Acrobat, or your document has to be an Active Document like Word and other Office formats. For more information and documentation on MIME handlers (asynchronous pluggable protocols), see About Asynchronous Pluggable Protocols[^]. For more information about Active Documents, see http://msdn.microsoft.com/library/en-us/vccore/html/vcconactivedocuments.asp[^]. Internet Explorer, BTW, is an Active Document Container and can display Active Documents, as well as host any toolbars if they're exposed properly. Other containers like Word, Excel, PowerPoint, and even a few non-MS container applications could also container your document. This requires that your document class implements a few COM interfaces and that your document server is registered using regasm.exe or some other installation utility. Some custom registry editing (see the Microsoft.Win32.RegistryKey class) will be required.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
I have created a windows application in CSharp that is using a web browser control.
When i did some coding to handle a chat window an exception was thrown with the following message:
"COM object that has been separated from its underlying RCW can not be used"
The chat browser window is constantly updating its content automatically.
My question is how can i work around this problem?
I appreciate any help you can give me.
Yours sincerely
Andla
|
|
|
|
|
I have several different tables with textboxes
I want user fill out some information into those boxes and after hit save, I
want to store all those values from those textboxes into database
I don't know why after I hit button save, all the values are gone. Pleaes
tell me how i can keep those values? We
Thanks
|
|
|
|
|
Is that ASP.NET? So you should post it there.
I think you have to set AutoPostback property to false for those textboxes.
Mazy
No sig. available now.
|
|
|
|
|
Set EnableViewState to true and in the server event handler for the "Save" button (or whatever you call it), gather the values from each TextBox and save them to a database using ADO.NET. Search the CodeProject web site for examples. There's also several examples of inserting data into a database from ASP.NET using ADO.NET. For example, if you have a couple TextBox es on the page and a button with the Client event handler save_Click , you could do something like the following:
private void save_Click(object sender, EventArgs e)
{
if (!IsValid) return;
SqlConnection conn = new SqlConnection("...");
SqlCommand cmd = conn.CreateCommand();
cmd.CommentText = "INSERT INTO Table1 (FirstName, LastName) " +
"VALUES (@FirstName, @LastName)";
cmd.Parameters.Add("@FirstName", SqlDbType.NVarChar, 40).Value = textBox1.Text;
cmd.Parameters.Add("@LastName", SqlDbType.NVarChar, 40).Value = textBox2.Text;
try
{
conn.Open();
cmd.ExecuteNonQuery();
}
catch (Exception e)
{
DisplayError(e.Message);
}
finally
{
conn.Close();
}
}
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks for posting.
I really appreciate your time. My problem here is a littl bit different. All those textboxes are creating during running time. Tables (or datagrids not bond from data),
are an array of tables (or datagrids).
I fill all those datagrids(tables) into a place holder.
I'm really frustrated now. I just created another version which does not use datagrid. I use Table of Web Control, everything seemed work fine until I started collecting data. Fromdate, todate have textboxes for user to enter values. I have a submit button, I don't know why everytime I hit button, all the values are gone. My best guess is whenever i hit the button the application has to postback, therefore my array of datagrids(or web tables) are NULL.
Is there a way that I can collect data from these tables (remember these tables are also dynamically change; hence I need help so much, I never built any programatic talbes like these before)
Month fromdate todate Values
Month1
Month2
Month3
Month4
Month5
Month6
Month7
Month8
Month9
Month10
Month11
Month12
--------------------------------------------------------------------------------
|
|
|
|
|
First of all, in order to get values from dynamically generated controls you can either follow the steps I'll discuss after this, or use Request.QueryString for GET requests, Request.Forms for POST requests, or Request.Params if you don't care which HTTP method the parameters come through. Since each is a collection, you can either enumerate all the values and sort out what is what using the names and values, or access the values using the name (like Request.Params["Month1"] ).
Second, in order to keep the controls on the page, you must make sure that in Page_Load you are not clearing the controls or re-binding them when you don't want to by using the IsPostBack property. On the first request to the page, this property is false so bind any data / generate controls. If a user submits the page form, this property is true so skip all that stuff, but only if you've set EnableViewState for the page and other controls to true (which is the default).
For more information, see Page.EnableViewState Property[^] (includes example), Page.IsPostBack Property[^] (includes example), and a nice little article that should help tie them all together, Taking a Bite out of ASP.NET ViewState[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Is there a way to add methods with a wizard. For instance, if I drop a button on the form, double click on the button the code....(assuming the button name is calculate)
private void calculate_Click(object sender, System.EventArgs e)
How can I add other methods like when the mouse moves over it or when the button gets the focus. VC++ 6.0 had a wizard to add event handlers.... what does C# have?
Thanks
Ralph
|
|
|
|
|
There isn't such a thing in C#. You can add other handlers through property grid for the controls.
Mazy
No sig. available now.
|
|
|
|
|
Errm, there are plently ways to do it. AddIns, that VB script thing they have, and if you want more you can go thru the VSIP SDK.
mazy.PostCount--;
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
leppie wrote:
mazy.PostCount--;
He said about wizard that exist in VC6.0. I haven't seen it in C#. There is property dialog there that do it,as other CPains said. Am I wrong?
Mazy
No sig. available now.
|
|
|
|
|
Select the control you want to add the method, press F4 to get the property window for that control. On the top of the property window, there is a button with a lightnigbolt in it, click it. No you have all the events fired by that control. Double click on the event you want and the code will be written on the file.
Free your mind...
|
|
|
|
|
Hello,
i'm having difficulties to use a multidimensional array of pointers in C#. The objective would be to have an array of pointer (2D) using the type TestClass. Here is the example test code that doesn't work:
public class MainClass
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
unsafe
{
TestClass obj = new TestClass(2);
TestClass *[,] ptrArray = new TestClass *[2,2];
ptrArray[1,1] = &obj;
ptrArray[1,1]->Display();
}
}
}
public class TestClass
{
private int data;
public TestClass (int d) { data = d; }
public void Display() { Console.WriteLine(data.ToString()); }
}
The following error is encountered:
Cannot take the address or size of a variable of a managed type.
Thanks for helping.
|
|
|
|
|
You dont have to use the pointer notation, that will automatically create it. If u wanna use the pointer notation , I think u need to use a struct rather.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Thx for your reply. Are you sure it does not copy the object, because i'm developping a system that will instanciate huge amount of objects and i couldn't afford to increase the memory allocated.
thanks, regards.
|
|
|
|