-
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...????
Thanks very much for your helps..
Best Regards,
Jennifer ;)
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
in short, using the system info control,
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
-
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 ;)
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
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.
Do you have VB6.0?
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Thats a great idea Jmacp, but I've got one qestion how can I find other systems info/activeX controls? they sound like great fun :D
-
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...??
Thanks very much for your kind helps...
Jennifer :)
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
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....
Thanks a lot,
Jennifer ;)
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Do you have a sound file you want played when its charged, like a wav or mp3 etc..?
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
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...
Thank you for all your helps....Please let me try first...
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Hi,
I just follow your advice:
Create STANDARD EXE file --> go to "Component" --> and only "System Monitor Control appeared....I could not find "System Information Control".....
I am using VB 6...
Please help me..
Thanks,
Jennifer :wave:
-
1 Attachment(s)
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..???
Thanks for your kind helps..
Jennifer :confused:
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
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 :confused:
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 :thumb:
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...
Hi,
What should I change in this code in order my sound will be changed with the new one....
VB Code:
MediaPlayer1.FileName = App.Path & "\charged.wav"
My new sound is filed in this place: C:\WINDOWS\Media\notify.wav...and I want this sound to be hear...
Please help me.. ;)
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
Originally Posted by zach007
Hi,
What should I change in this code in order my sound will be changed with the new one....
VB Code:
MediaPlayer1.FileName = App.Path & "\charged.wav"
My new sound is filed in this place: C:\WINDOWS\Media\notify.wav...and I want this sound to be hear...
Please help me.. ;)
:confused: If you want to use your own wave file, then insert the path and name of your wave file in place of the one in the example.
VB Code:
MediaPlayer1.Filename = "c:\windows\media\notify.wav"
-
1 Attachment(s)
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,
It said like this:
"Compile error: Method or data member not found."
Yellow highlight: Private Sub Timer1_Timer()
Blue highlight: .FileName
Have you try it before..??
-
1 Attachment(s)
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
Originally Posted by zach007
Hi,
It said like this:
"Compile error: Method or data member not found."
Yellow highlight: Private Sub Timer1_Timer()
Blue highlight: .FileName
Have you try it before..??
:D
I've attatched a new project, this one uses a different way to play the sound using API.
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
follow the same steps as above.^
-
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....
Would you help me please...???
Jennifer :)
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
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...
Hi Hack,
What do you mean by that..??..You mean that I need to click (to run the program) everytime this machine was booted..????...Is that what you mean...???
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
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.
What country are you from by the way ? :wave:
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
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..??? :)
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
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...
Quote:
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...
Quote:
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...
Quote:
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.
Quote:
if your nice to it might open by itself everytime you start charging
Shouldn't have said that it was a bit of sarcasism :blush:
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
So...the conclusion...we could not make this program runs automatically ya..???
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
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...
Quote:
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...
Quote:
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...
The battery popup doesn't work with me...
-
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.... ;)
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
Originally Posted by zach007
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...????
Yes, your .Exe program resides in a folder on your hard drive. The path is where it is located. Example:
c:\program files\laptop\ would be the path
zach007.exe would be the program name
so, the full path and program name would be: c:\program files\laptop\zach007.exe and that is what needs to be entered into that registry key.
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
I might be able to get a laptop later on today and try it out.
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Hi,
Just near to finish...which one on registry "Run" should I add:
Key, String Value, Binary Value, DWORD Value, MultiString Value, or Expandable String Value...????....
Thanks...
-
Re: Please help me..create a pop up message (Battery is Full) with VB for Win XP...
Quote:
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. :thumb:
-
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.