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?
It will update it if the Value Name is already there, otherwise it will add it.
But i want to check the value.. before adding in the start up...
On a form a check box is there... if programme is already in the start up then the check box value will be show one... other it will be zero....
is it possible?
thanks 4 reply
yep just updated the module and form again .. see modified version attached.
[the reg module is simply a stipped down version of one with tons of functions]
:bigyello:
@ Rory Thanks a lot........
send me your Yahoo Id
add this example on the form .. or modify to your needs
(or put as public in a module, or even modify the QueryValue Function if wanted) ..
example uses a Checkbox (Check1)
VB Code:
Private Function CheckValue() As Boolean If Len(QueryValue(HKEY_LOCAL_MACHINE, _ "SOFTWARE\Microsoft\Windows\CurrentVersion\Run", _ "My Program")) Then CheckValue = True Else CheckValue = False End If End Function Private Sub Form_Load() If CheckValue Then Check1.Value = vbChecked Else Check1.Value = vbUnchecked End If End Sub
@Rory :wave: We
Done It
Thanks :thumb: :D :bigyello: :p :)
Thanks a lot.....
See The Image.... By me Thanks :)
Quote:
If Rory is here then No Fear ;) :bigyello:
Ok .. see if this revised version helps .. module called mStart contains all the main functions, the global module contains global registry functions. Examples in the Form for the checkbox and everything else you asked.
Edit: i see you got it after i posted, well done :thumb: :bigyello:
@ Rory
Thanks 4 great response....
But why u add 2 module in new file............
one module is only for the Startup functions/subs .. all private and just 3 public functions; exists, add, remove .. the other module is just a general global module that contains the Registry API Functions .. if you dont have them elsewhere you can just chuck them in the Startup module and make it one file .. could have made it a class module, but its 5am and a regular module should suffice :wave:
@rory.........
Thanks a Lot..........Again.... :)
@Rory :wave:
Another concept coming in my mind our project running at the task bar and I am showing it at startup using some code..
When we click on mouse at the start up the pop up (msn type) form appear…
And when pc start pc name saved in the database
A combo is appearing showing all pc names that are presently login….
Database is at server….
What I want that I select a pc name from the combo…..
And type a message then the message goes to another pc…. :confused:
Or directly I want to say have u any concepts of LAN chat….? :)
Thanks :thumb:
You'd want to use winsock... check the Networking forum here, or search for Winsock .. ;)
Winsock's a little more detailed as its all event related so you have to handle everything that can occur .. there's plenty of copy paste code in these forums for Winsock server & clients though.
You have any code for it.........
@Rory :)
Please Check this one what error is occuring... :confused:
run and click on connect... then type data in the text box...
The code above creates a simple client-server application. To try the two together, run the project, and click Connect. Then type text into the txtSendData TextBox on either form, and the same text will appear in the txtOutput TextBox on the other form.
But error is occuring ... please any one is able to sloe it.... :confused:
thanks.. :thumb:
Can any one check my upper project and slove the error please
thanks
@Roory
another problem occuring..
how to minimize dirictly when running a programme at the task bar...
thanks
@roory r u there please help again
some problem is occuring in my mind please read the post 56 again....
thanks................
How we check that the software is already running in the background or not....
I got the solution to check that if the software isalready running in the back ground or not..
see it.......
VB Code:
If App.PrevInstance = True Then MsgBox "This Software Is Already Running", vbInformation Else MDIForm1.Show End If
Thanks all for help...
thats what you wanted to know :bigyello:
VB Code:
Private Sub Form_Initialize() If App.PrevInstance Then Beep: End End Sub
on ur birthday i got the solution....Quote:
thats what you wanted to know
visual basic code:--------------------------------------------------------------------------------
Private Sub Form_Initialize()
If App.PrevInstance Then Beep: End
End Sub
;)