Solved

Best way to code something vb6

Posted on 2015-02-24
4
95 Views
Last Modified: 2015-02-24
I have a reminder program that loops thru files that contain a date Eg:
C:\Backups\Tasks\02-20-2016.rtf
C:\Backups\Tasks\02-28-2015.rtf
C:\Backups\Tasks\03-01-2015.rtf
C:\Backups\Tasks\03-10-2015.rtf
C:\Backups\Tasks\03-10-2016.rtf
C:\Backups\Tasks\06-23-2015.rtf
C:\Backups\Tasks\06-23-2016.rtf
the current date is 4 days before one of the dates then a message box displays
Call MsgBox("You have a scheduled task to consider in " & miFirstReminderDays & " days", vbInformation, "Needs attention") and the rtf files is loaded and the form displayed
I have the program run when windows starts invisible and only is shown if a reminder date is found
but i also need to start the program visible to add new items
The only way i could determine a way is to make 2 exeys
one visible and one invisible
Is there another way ?
0
Comment
Question by:isnoend2001
  • 2
  • 2
4 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40629144
Add a timer to your form and then add this code. with this code the form will show up 1 second after F3 is pressed. You can use any function key that's convenient and you can also make the reaction fater by decreasing the 1000, but the smaller it is the more recourses you will be using up.

Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Private Sub Form_Load()
Me.Visible = False
Timer1.Interval = 1000 ' 1 second
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()

   If GetAsyncKeyState(vbKeyF3) <> 0 Then
      Me.Visible = True
   End If

End Sub

Open in new window

0
 

Author Closing Comment

by:isnoend2001
ID: 40629259
Thanks Marty glad you are here
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40629275
So am I:)  You're welcome.
0
 

Author Comment

by:isnoend2001
ID: 40629284
Lot better than 2 exeys I added this:
Private Sub Form_Load()
MsgBox "Press F3 to open"
Me.Visible = False
Timer1.Interval = 1000 ' 1 second
Timer1.Enabled = True
End Sub
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now