PowerNotify Beta

ashrafidkaidek

Member
Licensed User
Longtime User
Problem using PwerNotify.DLL

I have an issue when using PwerNotify.DLL, I have used it to show the battery status in my app, it worked with no problems, the only issue I have noticed is: when my app is running; if I try to terminate it via task manager the device will get stock (the screen and hardware bottoms will be unresponsive) therefore device soft reset is required.

If I keep my application exactly the same, but just remove the battery status and not use the PwerNotify.DLL library, then my application has no issues when trying to terminate it via task manager

The code, which I used to get the battery status:
=======================================
Sub App_Start
pwr.New1
pwr.Start
End Sub



Sub Form1_Close
pwr.Stop
End Sub



Sub pwr_Battery

ImageButton1.Text = pwr.BatteryPercent & " %"

End Sub
========================================
Can any body help me with this regard?

Thank you all
 

cactus

Member
Licensed User
Longtime User
Formless?

Hi,

Mabey a stupid question, but can this be used with a formless project?

I need to monitor the AcLineStatus but don't want a form or anyhing, all I need to do is change some registry settings.

TIA,

Kind regards,
Cactus
 

cactus

Member
Licensed User
Longtime User
K,

Not trying to bumb or anything (or do I?) but a closed main form would do to :)

TIA,
Cactus
 

agraham

Expert
Licensed User
Longtime User
You cannot have a Formless Basic4ppc program. App_Start will terminate the program when it returns unless there is a Form present to run the application message loop. I think some people have achieved something similar to what you want by making the Form not visible but I haven't played with that myself. Doing that sort of thing you risk losing control of the application and needing to reboot in order to kill it.
 

cactus

Member
Licensed User
Longtime User
Hi,

I tried to run a loop with a wait statement after closing the form. The program still ran, but the events (or at least the messagbox I let it popup) didn't show up.

Is that normal? Are events always bound to a form?

TIA,
Cactus
 

cactus

Member
Licensed User
Longtime User
Hi,

Maybe there are better ways (if someone knows please let me know) but I'm using sitajony's splashscreen example now, and with an added endless loop I now have a formless AcLineStatus event driven application. It run's in the background and does exactly what I want.

Thansk for the tips,

Cheers,
Cacti
 
Top