hi all
i am making an address software any idea
how it run directly when computer start!
if helpful coding then welcome
THANKS ALL
Printable View
hi all
i am making an address software any idea
how it run directly when computer start!
if helpful coding then welcome
THANKS ALL
you can add an entry of your application to the registry's run section, so that when windows starts it will run automatically, other way is by adding a shortcut link to the startup folder you can perform the same.
how to do this
VB Code:
'in your form declaration Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Const HKEY_LOCAL_MACHINE = &H80000002 'in your command button click or wherever you want to call this Dim lRegKey As Long RegOpenKey HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", lRegKey If lRegKey Then RegSetValueEx lRegKey, "Testing", 0, 1, "YourApp.Exe", Len("YourApp.Exe") RegCloseKey lRegKey End If
IF ganesh moorti sir is hear then no fear
@GaneshMoorty Sir Please tell me how to use this code
VB Code:
'in your form declaration Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Const HKEY_LOCAL_MACHINE = &H80000002 'in your command button click or wherever you want to call this Public Sub Run_In_Back_Ground() Dim lRegKey As Long RegOpenKey HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", lRegKey If lRegKey Then RegSetValueEx lRegKey, "Testing", 0, 1, "directory.Exe", Len("directory.Exe") RegCloseKey lRegKey End If End Sub
You send me this code for run a vbexe in the back ground but i am not able to understand that how to use it..............
Please help me again
Thanks
Shakti: the code i have sent is to register your program in windows registry to make it run whenever windows starts and not for running your exe at the background.
do you get any errors by running this code...
I am running a programme using the submain......... and in it call the function
But it is not showing any error but not running in background or at TaskBarVB Code:
call Run_In_Back_Ground
Help
Any One Please help.............
Thanks
add to startup
http://www.vbforums.com/showpost.php...35&postcount=6
then use me.hide in the program to run in background..
:bigyello:Quote:
Originally Posted by shakti5385
What ur code doing tell meQuote:
how it working.......?
Any senior has any idea then please.... tell me
@Rorry ..........
<VBCODE>
"My Program", "C:\Program Files\IFW Directory\Directory.exe"
MsgBox "Added to Startup"
Exit Sub
</VBCODE>
how ur program in the background and when i am using above code it is not showing at the task bar
can u check it and tell me again
thanks
What!!!Quote:
Originally Posted by shakti5385
Thats not even VB Code!
Well parts of it is & some parts aint!
@ Roory.... :wave:
your code running programme automatically whan i restart my pc again....
but u have any idea that how to show it at task bar :confused:
Thanks :wave:
Hi .. do you mean the System Tray?Quote:
Originally Posted by shakti5385
If so, in your program, in The Main Form Load use Me.Hide to hide the Form (program)..
See this code .. basically just copy the code in there into your project (copy the module into a new module and name it the same as i have it) .. add Me.Hide in your Form Load then it should automatically goto the system tray on loading the program .. to show your program again they simply left click on your program icon in the system tray ... and you can then minimize your program again to set it to the system tray.
http://www.vbforums.com/attachment.p...chmentid=49433
If you have problems with this let me know, ill throw together a custom version that auto hides on load.
This shows the code i attached in the Form, Modified to Auto Hide ..
Also i included the 2 form event examples, Terminate and Query Unload, incase you want to use those.
Also set Form ShowInTaskbar to False.
VB Code:
Option Explicit '// FORM Private Sub Form_Load() mTray.Refresh Me ' TRAY ICON LOAD Me.Hide ' HIDE FORM (MIN) End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) mTray.Click Me, X ' TRAY ICON CLICK End Sub Private Sub Form_Resize() mTray.Resize Me ' TRAY ICON SHOW/HIDE End Sub Private Sub Form_Unload(Cancel As Integer) mTray.Destroy ' TRAY ICON CLOSE End Sub '// OPTIONAL - THE FOLLOWING 2 FORM EVENTS ARE FOR TERMINATING AND UNLOADING Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Cancel = vbNo Me.Hide ' program does not exit, it goes to system tray '// IF YOU WANT TO ASK THEM IF THEY WANT TO EXIT DO SOMETHING LIKE THIS '// IF THEY CLICK NO IT GOES TO THE SYSTEM TRAY, ELSE IT EXITS '// Cancel = MsgBox("Exit My Program?", vbQuestion + vbYesNo, "Confirm Exit") = vbNo: Me.Hide End Sub Private Sub Form_Terminate() Unload Me End Sub
i am checking
Thanks 4 reply
;)
:confused:Quote:
Invalid Attachment specified. If you followed a valid link, please notify the webmaster
Please check it :bigyello:
Your link is not opening.... :cry:
check it again.... :)
shakti :wave:
i included an attachment here that has the Auto Hide on Form Load, and Form Terminate/Unload feature (auto hide is commented out), i left in the part that asks the user if they want to exit, you could change that to ask them anything .. just there as an example.
Rory
sorry fixed that .. anyway try the last attachment i posted as it has the auto hide/minimize in it.Quote:
Originally Posted by shakti5385
@ roory it is working perfectly..........
now please tell me i want that when i send curser at the tash bar a text box open or a form wil open automatically
can we do this....
thanks 4 reply...
check ur reputation
you mean something like the MSN Popup thing .?
if so see this example .. originally from another member on this forum (Wokawidget), i just stripped it down ..
http://www.vbforums.com/attachment.p...chmentid=48852
If thats not what you want and you want to show another form of yours, or menu item, you would do something similar .. but instead of using the popup object such as in this example you would use the other form or the menu items .. a little different .. just depends what you want to do. Let me know ..
see the original from woko here:
http://www.vbforums.com/showthread.php?t=320639
@ roory
It is not opening
help me again
thanks 4 reply
whats not opening? the attachment or the popup ..?
Also you may not even want this type of thing .. do you just want that when you mouse over the icon or left click a current form in your project appears in that location at the bottom right of the screen? Or maybe a menu?
Attatchment is opening i send all the file in in attachment in a folder but when i am opening the oroject some form not opening basically it is not running.....
@ Roory In ur first attatchment....
when we run the program it send them at the task bar, but when we close it it also close from the task bar....
It is possible that it work at task bar and show icon there.....
when we close it
sure, you just use this instead, but then you will need a timer or something so you can exit the program at sometime .. otherwise it just stays in the system tray ..
VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Cancel = vbNo Me.Hide ' program does not exit, it goes to system tray End Sub Private Sub Form_Terminate() Unload Me End Sub
@roory
Thanks i am checking
@ roory please tell me again how to run programme automatically when our pc start....
thanks
I thought you got that part working?
see this code again ..
http://www.vbforums.com/showpost.php...35&postcount=6
Rory
PS. 6am here now, im off to sleep :bigyello:
@ roory do not go to bad....
here is 3.45..
wait i m coming after checking the problem
thanks
:)
@Roory ya i get the point
Now tell me that is it possible that if we place our cursor there then it show a textbox or a form that we can use for search our data
thanks
@ ROORY
Thanks A Lot
I done it!
shakti
Cool .. :bigyello:
@Roory
Please a problem is occuring...
program is automatically running at start up.......
but can we give option to user that if he want then program run at start up otherwise not
thnaks
sure, just provide them with a button or menu item to Install or Remove ..
Updated the following to include Add & Remove .. module also changed.
@rory
I am chacking
Thanks
Help ThanksVB Code:
Private Sub cmdRemove_Click() On Error GoTo Err: DeleteValue HKEY_LOCAL_MACHINE, _ "SOFTWARE\Microsoft\Windows\CurrentVersion\Run", _ "My Program" 'We Use Exe Path when we are adding softare at satrt up,But why we_ 'are not using exe path when we are deleting it from start up, is there is no need_ 'TO write the exe name here, When i am using the my program exe name (Path Of the exe) 'It is showing error MsgBox "Removed from Startup" Exit Sub Err: MsgBox "Error!" Exit Sub End Sub
You are deleting the Value by using the Value's Name as a reference, no need to know the Value's Data in this case.
Its like you can call my name, Rory, and ill answer, no need to call me by my First and Last Name ;)
@ so there is need to add again in the start up to my program........?
when you delete it, its gone ...
so when they want to add it to the start up again, use the Add to Start up code .. ;)
@Rory
Working Properly
But
Problem is that if we add the program in the start up, on a check box click
But how we know that program is already added in the start up?