Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Dear Expert,
Anyone could help me please...I want to make a pop up message that would be appeared after my notebook battery was fully charged and also with its sound...My question is: How to create a pop up message for that with its sound please...????
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Hi,
Thanks for your reply...sorry, I am newbie for VB 6...If you dont mind, I have several questions:
1. What do you mean about the Systems Controls..??..
2. With your code, you mean...I write all your code into a VB 6..??..(or in windows somewhere..??) and after wrote codes, do I need to create an exe file..??..or what..???
What I really mean is..everytime I am charging my notebook battery, it will pop up a message to let me know that the battery was fully charged...
Sorry for this silly questions...I just want to make sure....
Thanks a lot for your helps...
Jennifer
Last edited by zach007; Jan 3rd, 2006 at 03:53 AM.
Reason: something miss...
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by zach007
Hi,
Thanks for your reply...sorry, I am newbie for VB 6...If you dont mind, I have several questions:
1. What do you mean about the Systems Controls..??..
2. With your code, you mean...I write all your code into a VB 6..??..(or in windows somewhere..??) and after wrote codes, do I need to create an exe file..??..or what..???
What I really mean is..everytime I am charging my notebook battery, it will pop up a message to let me know that the battery was fully charged...
Sorry for this silly questions...I just want to make sure....
Thanks a lot for your helps...
Jennifer
1) The systems info control is an activeX (ocx) Control that should be on your computer. You right click on the toolbox, select components and look for the system info control and add it.
2) VB 6.0 is fine. After you write your code compile it into an EXE after that you have the choice of having the program run all the time or run it when yu start charging and stop after charging is done.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Hi,
Yes...I have VB 6....By the way...it is s good idea.."running when start charging and informing when the battery is fully charged.."....What should I do then to create that one...would you please provide me a walktrough...???..Please...??
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by zach007
Hi,
Yes...I have VB 6....By the way...it is s good idea.."running when start charging and informing when the battery is fully charged.."....What should I do then to create that one...would you please provide me a walktrough...???..Please...??
Thanks very much for your kind helps...
Jennifer
Maybe somebody with a laptop might write it just to double check that eveything works.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Hi,
What should I do..???..Should I start with VB 6..??..or I write somewhere in the Windows XP..???...Please let me know...I dont know what do you mean in the last post....I really need helps....
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by zach007
Hi,
What should I do..???..Should I start with VB 6..??..or I write somewhere in the Windows XP..???...Please let me know...I dont know what do you mean in the last post....I really need helps....
Thanks a lot,
Jennifer
from what I understand, write
VB Code:
Private Sub Form_Load()
Timer1.Interval = 5000
End Sub
Private Sub Timer1_Timer()
If SysInfo1.BatteryLifePercent >= 100 Then
MsgBox "charged"
MediaPlayer1.FileName = App.Path & "\charged.wav"
Timer1.Enabled = False
End If
End Sub
in any old form you created, just place a timer, some controls (project> components) and then compile it to an .exe like he said.
dont write this stuff somewhere in windows, you're creating a program yourself, then run it when you start charging.
this is from what i understand, im not too good with the active X stuff
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Hi...
I have got the Sys Info Control......however, when I follow your code...how to test it...????...would you please check into my codes..???...to see if there is something miss..???
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by zach007
Hi...
I have got the Sys Info Control......however, when I follow your code...how to test it...????...would you please check into my codes..???...to see if there is something miss..???
Thanks for your kind helps..
Jennifer
You need a wav file and name it charged.wav, any wav file will do, and put it in a folder with the compiled exe, has to be in the same folder. Then compile the exe and run it. The form will popup on your screen . Then charge your battery and when the battery gets fully charged see if the mesagebox pops up and sound plays. I dont have a laptop and am just posting the code i think will work, it might need some tweaking but you can test it yourself, might take an hour or two
You need to add the windows media player componet to your form and put an on error resume next in the timer sub.
VB Code:
Private Sub Form_Load()
Timer1.Interval = 2000
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
If SysInfo1.BatteryLifePercent >= 100 Then
MediaPlayer1.FileName = App.Path & "\charged.wav"
MsgBox "charged"
End If
End Sub
See if that works first of all then you can add things to it..
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Another thing, this is just like a draft, if it works you can add to it.
Actually you'd better put timer1.enabled = false in there.
I've attached a project.
Make a folder on your desktop and call it battery.
Click start, then, find files, then type in notify.wav in the search box. When the file appears in the results list, right click it and choose copy, then paste the notify.wav into the battery folder.
Open up the project i attached and compile it into the battery folder. If you get compile errors post back here, it will probably be to do with the media player component.
Then double click the EXE you just made, stick in the charger and make a pot of tea.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Hi,
Thanks for your helps...it works....However, how to make it automatically play without double click on the .EXE file please...???...What I mean is, I would like this program runs automatically...For an example, everytime I charge my battery....this program will automatically notice me when it is fully charged...something like that....
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by zach007
Hi,
Thanks for your helps...it works....However, how to make it automatically play without double click on the .EXE file please...???...What I mean is, I would like this program runs automatically...For an example, everytime I charge my battery....this program will automatically notice me when it is fully charged...something like that....
Would you help me please...???
Jennifer
Do do something like this you would have to execute your program every time your machine was booted. You would have to have a timer event in the program that would poll the batter every so often to check its state, but only actually do something if it is fully charged.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by zach007
Hi,
Thanks for your helps...it works....However, how to make it automatically play without double click on the .EXE file please...???...What I mean is, I would like this program runs automatically...For an example, everytime I charge my battery....this program will automatically notice me when it is fully charged...something like that....
Would you help me please...???
Jennifer
hmm... well you can have it running all the time, just make a shortcut for it and put that shortcut in your startup folder or... if your nice to it might open by itself everytime you start charging and finally you could open it manually everytime you start to charge the battery. I would have it run 24/7 and see how it goes.
Add some system tray code and have an icon for it display like the clock does in the bottom right of your screen. You can then make the form invisible.
Its coded to show a msgbox and play a sound when the battery is fully charged but you must first test it to see if this works.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by Jmacp
if your nice to it might open by itself everytime you start charging and finally you could open it manually everytime you start to charge the battery.
I'm not seeing how this could happen unless you have another program that actually starts the charging. Then, it could call the other, but if all you are doing is plugging the laptop into a battery charger, then it has no way of either knowing it should start this program, and, even if it did somehow know, it wouldn't know how to start it. It is just a battery charger.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by zach007
Hi,
Thanks for your helps....it is works...but manually...I really newbie in VB 6....that is why I really need your helps...my questions are:
How to make it open itself everytime I start charging please...???..can I have the code please...???
By the way, I already make the form invisible.....hmmm, what country are you from anyway..???
You cant make it start evertime you start charging you need either 1) user input..i.e.. click a button or 2) have it running all the time.
If you want it running all the time then right click the EXE and select 'create shortcut' then... right click start and choose explore that should take you to the startup folder, now right click the shortcut you just made and select cut...then paste that shortcut into the startup folder. That will have it running everytime you boot up.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by Jmacp
If you want it running all the time then right click the EXE and select 'create shortcut' then... right click start and choose explore that should take you to the startup folder, now right click the shortcut you just made and select cut...then paste that shortcut into the startup folder. That will have it running everytime you boot up.
Exactly...and in addition to this, your program would need to contain code in a timer that would fire every X amount of time to check the existing state of the battery.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by Hack
I'm not seeing how this could happen unless you have another program that actually starts the charging. Then, it could call the other, but if all you are doing is plugging the laptop into a battery charger, then it has no way of either knowing it should start this program, and, even if it did somehow know, it wouldn't know how to start it. It is just a battery charger.
if your nice to it might open by itself everytime you start charging
Shouldn't have said that it was a bit of sarcasism
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by zach007
So...the conclusion...we could not make this program runs automatically ya..???
Sure you can. You can put the path/name in the registry so it boots everytime the laptop does and just have it sit there and monitor the battery status.
However, if you are asking if you can have it run automatically everytime the battery is being charged, the answer is no.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by Hack
Sure you can. You can put the path/name in the registry so it boots everytime the laptop does and just have it sit there and monitor the battery status.
Sorry...what do you mean about this..????...Is that what you mean..when I put the path/name in the registry so my program will monitor the battery status...???...is that right...???
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by zach007
Sorry...what do you mean about this..????...Is that what you mean..when I put the path/name in the registry so my program will monitor the battery status...???...is that right...???
It is so your program will start automatically at boot time. What it does when it starts depends on your code.
Use regedit and navigate to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Add the full path and exe name of your program to that key.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
What do you mean by "add the full path" please..???..is this a folder of the program...???...or just the full path of the .EXE file...????...would you please explain by walktrough please...???...or provide me example for those..???..because, sorry...i really dont know what it means....
Last edited by zach007; Jan 4th, 2006 at 10:12 AM.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Originally Posted by Jmacp
I might be able to get a laptop later on today and try it out.
It works great. I have a company laptop and my own personal laptop and both of them have the path/exe name to my code library in that key so it gets fired up everytime I boot.
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
I just put a short cut to the exe in my startup folder and it works fine for my laptop. Didnt have to tweek a thing (besides the location of the sound file). zach007, if your still having trouble let me know. Its rather simple to do if you follow Jmacp directions.