Useful Library


Active Member
Licensed User

Attached is file which contains dzHW.dll library I made (and dzHWdesktop.dll) and a b4ppc sample of how to use it.

Implements dzHW class with the following methods.

SoftReset: Soft resets the device
MessageBeep(wType): Beep! wTypw determines the type of sound and should be one of MsgBox icons (see B4PPC help, topic "MsgBox Constants")
GetTickCount: A high resolution timing method. Returns time elapsed in miliseconds since the computer/device is booted.
GetACLineStatus: Returns 1 if on AC power, 0 if not.
GetBatteryLifePercent: Returns percentage of Battery Life remaining.
InputPanel: Returns or Sets Soft Input Panel (SIP) state. 1 if it's active, 0 if not. Setting InputPanel = true, activates it and InputPanel = false deactivates it.

The desktop version has limited functionality. Implements only MessageBeep, GetTickCount, GetACLineStatus and GetBatteryLifePercent and not tested at all. Other function are dummy.

Edit (Erel): The most updated library is here:
See this thread about using this library with the optimized compiler:


  • dzHW.ZIP
    114.5 KB · Views: 694


Licensed User
Awsome job dzt...

I wish i could undertand the dll creation structure..


Wowwwwwwww..... feel like got a christmas gift! Finally i can get my SIP status... Thank you so MUCH dzt! :sign0060:


Active Member
Licensed User
Thanks so much,Dzt, for your library. It's very useful.

Bye et best regards



Well-Known Member
Licensed User
Hello Dimitris,
You did great on this DLL, indeed. Compliments!
Quick question please, dzHW.dll creates a number of objects in Tools/Add Object, such as MyComputer, MyApplication, MyProject, etc.
Please forgive my curiosity, what are these for?

Thanks to your DLL, I put together a precise Delay routine with DoEvents

Sub Delay (ms)
elapse = 0
begin = dz.GetTickCount
do While (elapse < ms)
elapse = dz.GetTickCount - begin
End Sub


Active Member
Licensed User
New version of dzHW.dll


Thank you all for your good words.

alfcen, objects My????? are useless objects created by default, which I forgot to remove in desktop version.

I added 4 new functions:

BringWindowToFront("WindowName"): If Window with Title WindowName is Acive becomes the front window.

BringWindowToFrontC("ClassName"): If Window with Class name ClassName is Acive becomes the front window.

PostMessageToWindow("WindowName", wMsg, wParam, lParam): Sends Message wMsg with parameters wParam and lParam to Window with Title WindowName. Does not wait for the Window to process the message.

PostMessageToWindowC("ClassName", wMsg, wParam, lParam): Sends Message wMsg with parameters wParam and lParam to Window with class name ClassName. Does not wait for the Window to process the message.

For wMsg, wParam, lParam values search the web for winuser.h
One of many google results is:

For how to use new functions look at sample test2.sbp included in zip file.

Best Regards


    6.9 KB · Views: 230
Last edited:


Well-Known Member
Licensed User
Hello Dimitris
Thanks a lot for your fast action. All side effects except for SPS are gone.
Visual Studio is an unaffordable suite for me (and probably for many other forum members as well). Please keep the DLL(s) coming.


Active Member
Licensed User
Hi. I don't know much about C/C++. What valid 32-bit integers can I pass to PostMessageToWindow(), for WMSG, wParam, lParam? I am not following winuser.h. Do I just convert those hexadecimal values to INT32 and use those in my program, and how can I tell what constants to reference when I need a particular feature other than writing to another application? What else can I make other windows do besides typing in other applications? Thank you very much, your library rules!


Active Member
Licensed User
I have an error with the new version of dzHW.dll.
dzHW.Inputpanel=true (or false) has no action on SIP.
With the old version it works fine.




Active Member
Licensed User

JJM thank you for your note and sorry for the bug.
I attached at the same post (#8) new dzHW-2.ZIP with fixed dzHW.dll, please download it again.

alfcen, SPS stands for System Power Status structure used for quering the power status of the device.
You are right about Visual Studio and therefore after first version of dzHW library, I'm using sharpdevelop (, an open source IDE VS alternative, to develop this librariy. I will post the source code in the near future, so everyone could be able to continue it's development, because I'll stop some moment (not enough free time to spent)

conf, sorry no SMS library for now. I develop these libraries for my own use and just share them with b4ppc community.

Louis, PostMessage functions can be used by your app to communicate with other apps. You can use Bitwise library to convert hex values to decimal at runtime. Maybe I'll post some more examples later in this thread.


Active Member
Licensed User
New version & new dzForm object for desktop

Hi to all,

A new dzHW version is here with more functions and with a new dzForm control for desktop only.
I thought that Form control of B4PPC is not enough for desktop applications so I created this.

For how to use dzForm control see attached B4PPC sample. Documentation for dzForm I'll not post (I hate writing documentation especially in a foreign language) but I think it is simple to understand it. Ask for everything you do not understand.

A simple description for dzHW added function follows.

GetProcesses: Returns in a table of string the names of active processes KillProcess("ProcessName"): Kills the process
GetProcessHandle("ProcessName"): Returns the handle of process with name ProcessName
GetModuleHandle("Modulename"): Return the Handle for a loaded module. ModuleName = "null" returns the handle of myapp
GetActiveWindowHandle: Returns the Handle of the Active Window
GetWindowHandle("ClassName", "WindowName"): Returns the handle of Window with class name ClassName and window name WindowName. ClassName and or WindowName can be null
GetClassName(hWnd, StrLen): Returns in a string the class name of the given hWnd. StrLen the maximum length of class name to return
GetWindowtext(hWnd, StrLen): Returns in a string the window text of the given hWnd. StrLen the maximum length of window name to return
SetWindowText(hWnd, WindowText): Sets the Window Title or Caption of window eith Handle hWnd
GetParent(hWnd): Returns the parent window handle of window with handle hWnd
GetWindowFirst(hWnd): Returns the handle of the first in order window of window with handle hWnd
GetWindowNext(hWnd): Returns the handle of the next in order window of window with handle hWnd
GetWindowChild(hWnd): Returns the first child window of thw window with handle hWnd
PostMessage(hWnd, wMsg, wParam, lParam): Posts a message to the window with hWnd handle
ShowWindow(hWnd, nCmdShow): Send mCmdShow command to the window with handle hWnd. If mCmdShow = 0 hides the window. If mCmdShow = 5 shows the window. See winuser.h as above
GetWindowRect(hWnd): Return a table(4) of int32 with left, top, right, bottom of window with Handle hWnd
IsWindowVisible(hWnd): Returns true if the window with handle hWnd is visible
IsWindow(hWnd): Returns true if the window with handle hWnd is window (!!!)

For how to use these functions see dzSpy I've posted here

Desktop version source code can be found here

Device version source code can be found here

Attached contains compiled DLLs.
Attached contains .sbp sample dzHWDesktop.dll and FormLib.dll.



    15.2 KB · Views: 312
    12.2 KB · Views: 234
  • dzHWForm.jpg
    25.7 KB · Views: 164


Well-Known Member
Licensed User
How do you find time to sleep?
Amazing work, by all means!
I second your feeling about manuals. You have done so much for the forum. The example code is more than sufficient help.
Respectful greetings


Licensed User
Hi dzt. Many thanks for the kind words in another thread. I know you hate documentation so I have attached an attempt at a help file for your dzHW library. I would appreciate some comments on the dzProcesses class in the device library, is it intended for use with B4PPC? If so a few words on what the members do perhaps?- and any other comments of course.

Hi everyone else. This chm is a work in progress I will post the final version in a few days time.


    10 KB · Views: 169


Active Member
Licensed User
Hello agraham,

Thank you very very very much for your work.
dzProcesses is a helper class and there is no need to be visible to Basic4ppc.

I'll post more comments in the near future, since I'm very busy for now.

Thanks again!

@Erel: What do you say about hiding protected classes ?