dzSpy - Spy and Task Manager App - Open Source

dzt

Active Member
Licensed User
Hello,

1. About Open Source
First of all I'd like to say that as "Open Source Definition" explains in http://www.opensource.org/,
dzSpy is NOT a really Open Source Project for now. It will be very soon as I'll post the source code of dzHW and NotifyIcon libraries.

2. What is dzSpy?
dzSpy is Spy application like Microsoft Spy++ which comes with Visual Studio, and simultaneously is a Task Manager application like the Windows one.
Ii is made with Basic4PPC (I'll post sometime my thoughts in a kind of review, about this genius programming tool).
It uses three external libraries, TreeView.dll by Erel and dzHW.dll, NotifyIcon.dll by me.
I took special care about having the same exactly functionality in desktop and mobile version.

3. Setup instructions
For the desktop pc it must be installed .NET 1.1 and for the device .NETCF 1.0. Copy dzSpy.exe (or dzSpyDesktop.exe), Treeview.dll, dzHW.dll (or dzHWdesktop.dll) and NotifyIcon.dll (or NotifyIconDesktop.dll) to a folder and run dzSpy.exe (or dzSpyDesktop.exe)
You can download executables, .ico file and libraries from here
http://www.terracom.gr/basic4ppc/dzSpy-complete.zip (just to save forum's disk space)
B4PPC source code only is attached below

4. Quick user instructions
In Apps listbox shows currently active applications. Pressing the "Close" button it sends to the app a WM_CLOSE (similar to AppClose) message. The app should close or refuse to close (like CancelClose)
Pressing the "Activate" button it tries to make the app the first in Z-order window
Warning: I decided not to hide any apps from the listbox so be careful of what apps are you going to close. You may face bizarre behaviour.
In Processes listbox shows running processes. You can terminate processes by pressing the "Kill Process" button. dzSpy now don't ask but demands from the process to terminate. Be very careful of what processes are you killing.
In Windows TreeView you can see all active Windows with their children. Shows Handle, Class name, Window Text, (Left, Top, Width, Height). It is a complete view of what is going on to your PC or Mobile device.

5. External Libraries
dzSpy's dzHW.dll (and dzHWdesktop.dll) is an enhanced version of the library I have posted here http://www.b4x.com/forum/showthread.php?t=384
It has a lot of new functions. I'll post a short description for each of them soon with the source code in "Useful Library" thread.
NotifyIcon.dll (and NotifyIconDesktop.dll) is a new library helping to put an Icon to SystemTray (desktop version) and an Icon to Notification Area (device version). The mobile version is based on NotifyClient sample found on MSDN. For the device to work right needs a 16x16 pixels icon (not the usual 32x32). Your .ico resource file may include more icons than one.
Feel free to use this libraries to your projects

6. How to improve dzSpy?
This app I hope is useful as it is, but can be very improved. The user interface is awful and can be
better. It needs testing in several machines (I run it in few by myself), bug fixes, a better icon, a setup and a help file (.chm). And of course someone can add more functionality, like system info, storage cards info, DeviceID, remaining battery info, make it run on startup, or whatever anyone can think.
Are there in this community any members who like to contribute to this project to make it a teamwork (of course we'll change its name to b4ppcSpy or something)?

I hope this app should be useful to someone.

Best regards
 

Attachments

  • dzSpy-b4ppc_source.zip
    6 KB · Views: 755

mjcoon

Well-Known Member
Licensed User
I'm trying to develop shared creation "Simple MP3 Player" which happens to use NotifyIcon.dll. However the version I downloaded seems to have only NotifyIconDesktop.dll so I guess it was only compiled for Windows.

I can compile for Windows too. But when I added the device versions of the DLLs it uses and try to compile optimised for the device I get:

"error CS1501: No overload for method 'NotifyIcon' takes '1' arguments"

The line in question merely has:

ni.New1("Form1") ' New Notifyicon

Needless to say this line compiles for the desktop, and non-optimised for the device, so what is the problem?

Mike.
 

agraham

Expert
Licensed User
Longtime User

mjcoon

Well-Known Member
Licensed User
If it's a device application, which I assume it is, you are probably better using NotifyIcon from my http://www.b4x.com/forum/additional-libraries/1995-controlsexdevice-library.htmllibrary. It is more flexible than the dzt version and overcomes a bug/feature of the .NET implementation of NotifyIcon on the device. See the help in the archive for details.

Thank you Andrew, I was hoping that the application can be made both Desktop (which it was as found) and also Device. It already uses ControlEx.dll, so using NotifyIcon from that would be preferable.

But when I tried to remove NotifyIcon.dll and replace ControlEx.dll with ControlsExDevice.dll and ControlsExDesktop.dll I now get a complaint from B4PPC "An item with the same key has already been added". Do I have to perform some deeper purge to make the switch?

Cheers, Mike.
 

agraham

Expert
Licensed User
Longtime User
It sounds like you have both ControlsExDevice Dummy and ControlsExDesktop added to the desktop and I'm afraid that you can't do this. This is why I prefixed my post above "If it's a device application". You will need to remove ControlsExDesktop from your device project and you will need a separate project for the desktop version of your app.

However I don't understand why you are removing ControlsEx as there is (deliberately) no overlap in functionality with ControlsExDevice and they will work together.
 

mjcoon

Well-Known Member
Licensed User
It sounds like you have both ControlsExDevice Dummy and ControlsExDesktop added to the desktop and I'm afraid that you can't do this. This is why I prefixed my post above "If it's a device application". You will need to remove ControlsExDesktop from your device project and you will need a separate project for the desktop version of your app.

However I don't understand why you are removing ControlsEx as there is (deliberately) no overlap in functionality with ControlsExDevice and they will work together.

Thank you Andrew. I hadn't appreciated that ControlsEx works together with ControlsExDe... But at least I had put the two ControlsExDe... on their corresponding sides of the Components dialogue! However I still cannot compile for the device, which is maybe what you are telling me. I had thought that the list of DLLs is separate, as implied by the Components dialogue, so I don't understand why a whole separate project is required.

I'm not really bothered about the Notify/Suspend aspect, so I'll probably leave that alone now that it doesn't seem to be tripping the code up.

Best regards, Mike.
 

agraham

Expert
Licensed User
Longtime User
! However I still cannot compile for the device, which is maybe what you are telling me.
If you can't then I suspect you have removed ControlsExDeviceDummy from the desktop instead of ControlsExDesktop. The optimising compiler assumes that the structure of the desktop and device libraries are identical and uses the structure it derives from the desktop library when it compiles. This is why a "dummy" desktop library is required when functionality is required in a device library that is not present on the desktop. The dummy desktop library looks like the device library but the functionality missing on the desktop is implemented as do-nothing code.
 

derez

Expert
Licensed User
Longtime User
mjcoon,

As for your original question :

"error CS1501: No overload for method 'NotifyIcon' takes '1' arguments"

The line in question merely has:

ni.New1("Form1") ' New Notifyicon

If you use version 03 of NotifyIcon then you should initialize the object without an argument:

ni.new1

and make sure you have an icon attached to your program.

Thats' all !
 

mjcoon

Well-Known Member
Licensed User
If you can't [compile for device] then I suspect you have removed ControlsExDeviceDummy from the desktop instead of ControlsExDesktop. The optimising compiler assumes that the structure of the desktop and device libraries are identical and uses the structure it derives from the desktop library when it compiles. This is why a "dummy" desktop library is required when functionality is required in a device library that is not present on the desktop. The dummy desktop library looks like the device library but the functionality missing on the desktop is implemented as do-nothing code.

Thanks for that explanation, I now understand why the same project cannot be recompiled for device as for desktop, and how to tweak it between the two.

Off-topic, I tried to use a TrackBar (partly because the code already uses one as a volume control) to follow the playing of a music file and allow the user to move the playing point. But I find that the _ValueChanged call-back is triggered each time the program adjusts the pointer to follow progress, generating a double alteration (very audibly). If I used a scroll-bar instead, would this be avoided? (In other words, _ValueChanged reacts only to user action.)

Cheers, Mike.
 

agraham

Expert
Licensed User
Longtime User
If I used a scroll-bar instead, would this be avoided?
I don't think so but you could try something like this

B4X:
' TBchanged is a Global variable 

   ...
   TB.Value = something
   TBchanged = True
   ...


Sub TB_ValueChanged
   If Not(TBchanged) Then
      ' do whatever
   End If
   TBchanged = False
End Sub
 

mjcoon

Well-Known Member
Licensed User
I don't think so but you could try something like this

B4X:
   ...
 Sub TB_ValueChanged
   If Not(TBchanged) Then
      ' do whatever
   End If
   TBchanged = False
End Sub

Thanks, Andrew, I have implemented exactly that solution. Rather clunky, but it works!

Cheers, Mike.
 
Top