Page 1 of 2 12 LastLast
Results 1 to 40 of 47

Thread: [STILL UNRESOLVED] destroy timer question

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    [STILL UNRESOLVED] destroy timer question

    my splash screen fades in to display the splash screen and then after X seconds, it automatically closes and then displays the login form. i would like to destroy the timer (set = nothing). I have done this when the user clicks on the splash screen but where would I set it for when the form closes after X seconds? Would this be in Form_QueryUnload, Form_Terminate or Form_Unload??

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: destroy timer question

    seems i am doing it wrong because i am getting an error:
    compile error:
    invalid use of property
    VB Code:
    1. Private Sub imgSplash_Click()
    2.     'when the splash screen is clicked on, set the timer to nothing so that the
    3.     'login form doesnt haunt the end user
    4.     Set tmrSplash = Nothing ' <--------------------------errors here
    5.    
    6.     frmLoginForm.Show
    7.    
    8.     Unload Me
    9. End Sub

    complete code:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, _
    4.                                                                             ByVal nIndex As Long) As Long
    5.  
    6. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, _
    7.                                                                             ByVal nIndex As Long, _
    8.                                                                             ByVal dwNewLong As Long) As Long
    9.  
    10. Private Const GWL_EXSTYLE      As Long = (-20)
    11. Private Const WS_EX_LAYERED    As Long = &H80000
    12.  
    13. Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, _
    14.                                                                   ByVal crKey As Long, _
    15.                                                                   ByVal bAlpha As Byte, _
    16.                                                                   ByVal dwFlags As Long) As Long
    17.  
    18. Private Const LWA_ALPHA        As Long = &H2
    19. Private lngForNum              As Long
    20. Private lngStyle               As Long
    21. Private bolActive              As Boolean
    22.  
    23. Private Sub Form_Activate()
    24.     If Not bolActive Then
    25.         bolActive = True
    26.  
    27.         For lngForNum = 10 To 255
    28.             MakeWindowTransparent Me.hwnd, lngForNum
    29.             DoEvents
    30.         Next
    31.     End If
    32. End Sub
    33.  
    34. Private Sub Form_Load()
    35.     MakeWindowTransparent Me.hwnd, 10
    36. End Sub
    37.  
    38. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    39.     'when the splash screen is automatically closed, set the timer to nothing so that the
    40.     'login form doesnt haunt the end user
    41.     Set tmrSplash = Nothing
    42. End Sub
    43.  
    44. Private Sub Form_Terminate()
    45.     'when the splash screen is clicked on, set the timer to nothing so that the
    46.     'login form doesnt haunt the end user
    47.     Set tmrSplash = Nothing
    48. End Sub
    49.  
    50. Private Sub Form_Unload(Cancel As Integer)
    51.     'when the splash screen is clicked on, set the timer to nothing so that the
    52.     'login form doesnt haunt the end user
    53.     Set tmrSplash = Nothing
    54. End Sub
    55.  
    56. Private Sub imgSplash_Click()
    57.     'when the splash screen is clicked on, set the timer to nothing so that the
    58.     'login form doesnt haunt the end user
    59.     Set tmrSplash = Nothing
    60.    
    61.     frmLoginForm.Show
    62.    
    63.     Unload Me
    64. End Sub
    65.  
    66. Public Sub MakeWindowTransparent(ByVal lngHwnd As Long, _
    67.                                  ByVal bytRate As Byte)
    68.    
    69.     lngStyle = GetWindowLong(lngHwnd, GWL_EXSTYLE)
    70.     lngStyle = lngStyle Or WS_EX_LAYERED
    71.     SetWindowLong lngHwnd, GWL_EXSTYLE, lngStyle
    72.     SetLayeredWindowAttributes lngHwnd, 0, bytRate, LWA_ALPHA
    73. End Sub
    74.  
    75. Private Sub tmrSplash_Timer()
    76.     frmLoginForm.Show
    77.     tmrSplash.Enabled = False
    78.     Unload Me
    79. End Sub

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: destroy timer question

    I wouldn't think you would need to set a control to nothing. That is done with objects (assuming tmrSplash is a VB timer control.)

    I believe this is what is causing the "Invalid use of Property"

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: destroy timer question

    yes, its a vb timer control. the problem i am having is when i am in my app after login, the damned login screen will just popup. i thought it might have been the timer that was doing it. everywhere else in my app where frmLoginForm is called from is within a click event so it couldnt be those, and also form_unload events so couldnt be that either. need to figure out why the damned login form is haunting me, lol.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: destroy timer question

    In the QueryUnload event of your splash form, I would check to see if frmLogin has already been loaded.

    If so, do nothing. If not, then load it.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: destroy timer question

    the login form isnt loaded until the splash form is either clicked on or automatically closed by the timer. when i am in the MDI parent, the login form is haunting me. thats why i am wondering where it is coming from, but alas, cannot figure out where its coming from.

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: destroy timer question

    Quote Originally Posted by BrailleSchool
    the login form isnt loaded until the splash form is either clicked on or automatically closed by the timer. when i am in the MDI parent, the login form is haunting me. thats why i am wondering where it is coming from, but alas, cannot figure out where its coming from.
    Well, it can only be loaded after an explicit .Show has been performed. So, take a look at every place in your code where it says frmLogin.Show

    That is where it is coming from.

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: destroy timer question

    Quote Originally Posted by Hack
    Well, it can only be loaded after an explicit .Show has been performed. So, take a look at every place in your code where it says frmLogin.Show

    That is where it is coming from.
    These are the places its coming from.
    frmAccessDenied = Form_Unload
    frmAccessDenied = cmdAccessDeniedOK_Click()
    frmInternalSplash = Private Sub cmdLogout_Click()
    frmMain = MDIForm_Unload
    frmMain = Private Sub mnuLogout_Click() (MDI Form)
    frmSplash = Private Sub imgSplash_Click()
    frmSplash = Private Sub tmrSplash_Timer()
    frmAccountDisabled = Private Sub cmdAccountDisabledOK_Click()
    frmAccountDisabled = Private Sub Form_Unload

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: destroy timer question

    Is frmSplash your startup form, or is that called from somewhere else?

    Is this issue with the login form happening only at startup time, or periodically, throughout the application?

  10. #10
    Hyperactive Member
    Join Date
    Feb 2003
    Location
    Grenada
    Posts
    346

    Re: destroy timer question

    Here's your new code... all I did was comment out the Bold lines... and it worked properly for me...

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, _
    4.                                                                             ByVal nIndex As Long) As Long
    5.  
    6. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, _
    7.                                                                             ByVal nIndex As Long, _
    8.                                                                             ByVal dwNewLong As Long) As Long
    9.  
    10. Private Const GWL_EXSTYLE      As Long = (-20)
    11. Private Const WS_EX_LAYERED    As Long = &H80000
    12.  
    13. Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, _
    14.                                                                   ByVal crKey As Long, _
    15.                                                                   ByVal bAlpha As Byte, _
    16.                                                                   ByVal dwFlags As Long) As Long
    17.  
    18. Private Const LWA_ALPHA        As Long = &H2
    19. Private lngForNum              As Long
    20. Private lngStyle               As Long
    21. Private bolActive              As Boolean
    22.  
    23. Private Sub Form_Activate()
    24.     If Not bolActive Then
    25.         bolActive = True
    26.  
    27.         For lngForNum = 10 To 255
    28.             MakeWindowTransparent Me.hwnd, lngForNum
    29.             DoEvents
    30.         Next
    31.     End If
    32. End Sub
    33.  
    34. Private Sub Form_Load()
    35.     MakeWindowTransparent Me.hwnd, 10
    36. End Sub
    37.  
    38. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    39.     'when the splash screen is automatically closed, set the timer to nothing so that the
    40.     'login form doesnt haunt the end user
    41.     [B]Set tmrSplash = Nothing[/B]
    42. End Sub
    43.  
    44. Private Sub Form_Terminate()
    45.     'when the splash screen is clicked on, set the timer to nothing so that the
    46.     'login form doesnt haunt the end user
    47.     [B]Set tmrSplash = Nothing[/B]
    48. End Sub
    49.  
    50. Private Sub Form_Unload(Cancel As Integer)
    51.     'when the splash screen is clicked on, set the timer to nothing so that the
    52.     'login form doesnt haunt the end user
    53.     [B]Set tmrSplash = Nothing[/B]
    54. End Sub
    55.  
    56. Private Sub imgSplash_Click()
    57.     'when the splash screen is clicked on, set the timer to nothing so that the
    58.     'login form doesnt haunt the end user
    59.     [B]Set tmrSplash = Nothing[/B]
    60.    
    61.     frmLoginForm.Show
    62.    
    63.     Unload Me
    64. End Sub
    65.  
    66. Public Sub MakeWindowTransparent(ByVal lngHwnd As Long, _
    67.                                  ByVal bytRate As Byte)
    68.    
    69.     lngStyle = GetWindowLong(lngHwnd, GWL_EXSTYLE)
    70.     lngStyle = lngStyle Or WS_EX_LAYERED
    71.     SetWindowLong lngHwnd, GWL_EXSTYLE, lngStyle
    72.     SetLayeredWindowAttributes lngHwnd, 0, bytRate, LWA_ALPHA
    73. End Sub
    74.  
    75. Private Sub tmrSplash_Timer()
    76.     frmLoginForm.Show
    77.     tmrSplash.Enabled = False
    78.     Unload Me
    79. End Sub

    Make sure you have no references made to the splash form on your login form or any other subsequent form... cause this will cause the splash for to be loaded again...

    Plus I would put the entire code for the fade effect in a module, including the declarations and just have a function to it... that way the form doesn't reopen if you were to call eg. frmSplash.GetWindowLong...
    If my post has been helpful, then please rate it accordingly...
    If it has solved your question(s), then don't forget to mark the thread as "[Resolved]"... thank you.

  11. #11

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: destroy timer question

    Quote Originally Posted by Hack
    Is frmSplash your startup form, or is that called from somewhere else?

    Is this issue with the login form happening only at startup time, or periodically, throughout the application?
    when you click on the exe icon (on desktop), frmSplash is loaded, then if the user clicks on frmSplash then frmLoginForm is loaded, otherwise frmLoginForm is loaded when the timer reaches its limit and closes frmSplash. Then when the user logins in and the information is wrong, frmAccessDenied comes up. if the account has been disabled (either by an admin or entering wrong info 4x) then frmAccountDisabled is shown. But this is where I am having the problem (when the frmLoginForm is haunting me...) frmMain is the MDI form and I am using an internal form to show buttons called frmInternalSplash, so I am thinking it has to be either frmMain or frmInternalSplash (i am not sure if its the timer on frmSplash.) So least I have narrowed it down to 3 of the forms. However, the .Show is within a click event of cmdLogout (frmInternalSplash) or mnuLogout within frmMain, and of course the MDIForm_Unload event when the red X is clicked on.

  12. #12
    Lively Member rush_shri's Avatar
    Join Date
    Dec 2005
    Location
    Pune,India
    Posts
    78

    Re: destroy timer question

    Although I am not very good in VB but what I feel is if you make the vb timer interval to 0 it will help you.
    U KNOW U R INTERNET JUNKIE WHEN U CHAT WITH UR FINGERS NOT FROM MOUTH.

    U KNOW U R INTERNET JUNKIE WHEN UR SPOUSE E-MAIL U 2 CALL U 4 DINNER

    U KNOW U R INTERNET JUNKIE WHEN UR ADDRESS BEGINS WITH http:

    U KNOW U R INTERNET JUNKIE WHEN THE PROGRAM TOLD 2 U HAPPENS 2 B TV PROGRAM.

  13. #13
    Hyperactive Member
    Join Date
    Feb 2003
    Location
    Grenada
    Posts
    346

    Re: destroy timer question

    Is frmSplash and frmLogin an MDI Child form... cause if it is then that could be where your problem lies...

    Check the AutoShowChildren property and make sure it's enabled to false...
    If my post has been helpful, then please rate it accordingly...
    If it has solved your question(s), then don't forget to mark the thread as "[Resolved]"... thank you.

  14. #14

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: destroy timer question

    Quote Originally Posted by Protocol
    Is frmSplash and frmLogin an MDI Child form... cause if it is then that could be where your problem lies...

    Check the AutoShowChildren property and make sure it's enabled to false...
    no, they are regular forms outside the MDI

  15. #15
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: destroy timer question

    Try something like this and see if it works.

    Create a public boolean. Something like IsLoggedIn.

    After a successful log, set the Boolean to true, and then in every place where frmLogin can be called, prior to calling it, check the state of this Boolean. If it is true, then don't do a .Show

    You may need to reset it to False in other places like frmAccessDenied, or whatever. I'm not familiar with exacly how your app works, but this approach may help you out.

  16. #16

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: destroy timer question

    Quote Originally Posted by Hack
    Try something like this and see if it works.

    Create a public boolean. Something like IsLoggedIn.

    After a successful log, set the Boolean to true, and then in every place where frmLogin can be called, prior to calling it, check the state of this Boolean. If it is true, then don't do a .Show

    You may need to reset it to False in other places like frmAccessDenied, or whatever. I'm not familiar with exacly how your app works, but this approach may help you out.
    Ill try it and see what happens. havent done much with flags before

  17. #17

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: destroy timer question

    frmAccessDenied is a form that is used like a message box to tell end user that login details are wrong. Same for frmAccountDisabled. I dislike the look of the MsgBox so use forms in their place to make them a little nicer in appearance.

  18. #18

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: destroy timer question

    ok, i set the IsLoggedIn to true or false and the frmLoginForm hasnt haunted me yet, let's see if it stays that way. will report back if it doesn't. hope the ghost has been laid to rest. hehehe.

  19. #19

  20. #20
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: destroy timer question

    Quote Originally Posted by BrailleSchool
    unfortunately, no change. the login form still haunts me.
    Is the problem still coming from one of the three forms that mentioned previously?

  21. #21
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [STILL UNRESOLVED] destroy timer question

    I don't understand why you can't just set .Enabled to False ?

  22. #22
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [STILL UNRESOLVED] destroy timer question

    Quote Originally Posted by penagate
    I don't understand why you can't just set .Enabled to False ?
    Set .Enabled to False for what control?

  23. #23
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [STILL UNRESOLVED] destroy timer question

    The Timer. I don't understand why you need a timer for this anyway, maybe I'm being thick.

  24. #24
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [STILL UNRESOLVED] destroy timer question

    Quote Originally Posted by penagate
    The Timer. I don't understand why you need a timer for this anyway, maybe I'm being thick.
    No, you aren't thick...he wants to provide two ways of opening his app from the splash screen.

    1. The traditional way of just clicking an Ok button on the splash screen.

    2. If nothing is done within X amount of time, the splash screen closes all by itself and calls his login form...hence the use of the timer.

  25. #25
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: [STILL UNRESOLVED] destroy timer question

    Quote Originally Posted by Hack
    No, you aren't thick...he wants to provide two ways of opening his app from the splash screen.

    1. The traditional way of just clicking an Ok button on the splash screen.

    2. If nothing is done within X amount of time, the splash screen closes all by itself and calls his login form...hence the use of the timer.
    so cant it be like this:

    -the splash screen is loaded and it fires the timer.
    -let the timer do its work until user clicks the button.
    -if the user clicks the button before the time (of the timer) completes, then disable the timer.

    or am i saying something wrong?
    Show Appreciation. Rate Posts.

  26. #26
    Member
    Join Date
    Aug 2005
    Posts
    34

    Re: [STILL UNRESOLVED] destroy timer question

    From the code provided, it seems that the timer is being disabled in the timer event, and not the click event.

    From my limited experience, I have found that the timer is activated anytime a control, sub, or any event is triggered on the form that the timer resides.

    I suggest disabling the timer in the click event, timer event, and the form unload event.

  27. #27

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: destroy timer question

    Quote Originally Posted by Hack
    Is the problem still coming from one of the three forms that mentioned previously?
    Yes, because those forms are the only places where frmLoginForm is shown (unload and click events)

  28. #28

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [STILL UNRESOLVED] destroy timer question

    Quote Originally Posted by Hack
    No, you aren't thick...he wants to provide two ways of opening his app from the splash screen.

    1. The traditional way of just clicking an Ok button on the splash screen.

    2. If nothing is done within X amount of time, the splash screen closes all by itself and calls his login form...hence the use of the timer.
    exactly. however, i dont have a button on the splash screen, the splash image is in a picturebox and when the image/picure box is clicked, it closes the splash screen and calls the login form

  29. #29
    Junior Member TheMinime's Avatar
    Join Date
    Dec 2005
    Posts
    27

    Re: [STILL UNRESOLVED] destroy timer question

    Quote Originally Posted by Hack
    No, you aren't thick...he wants to provide two ways of opening his app from the splash screen.

    1. The traditional way of just clicking an Ok button on the splash screen.

    2. If nothing is done within X amount of time, the splash screen closes all by itself and calls his login form...hence the use of the timer.
    it's right, I think there are something missing, and i think it's a little problem, he should zip the project and send it, to see the whole functions

  30. #30
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: destroy timer question

    Quote Originally Posted by BrailleSchool
    Yes, because those forms are the only places where frmLoginForm is shown (unload and click events)
    And you have incorporate the boolean flag, especially in the .Show on these three forms, right?

    If so, then somehow that boolean is getting reset to False when it hits one of them.

    I'm almost afraid to ask this question because I just know you are going to say: No ....but I gotta ask anyway....is there any consistent pattern to when your login form shows up uninvited?

  31. #31

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [STILL UNRESOLVED] destroy timer question

    Quote Originally Posted by zeusspider
    From the code provided, it seems that the timer is being disabled in the timer event, and not the click event.

    From my limited experience, I have found that the timer is activated anytime a control, sub, or any event is triggered on the form that the timer resides.

    I suggest disabling the timer in the click event, timer event, and the form unload event.
    This is what I have so far for frmSplash
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, _
    4.                                                                             ByVal nIndex As Long) As Long
    5.  
    6. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, _
    7.                                                                             ByVal nIndex As Long, _
    8.                                                                             ByVal dwNewLong As Long) As Long
    9.  
    10. Private Const GWL_EXSTYLE      As Long = (-20)
    11. Private Const WS_EX_LAYERED    As Long = &H80000
    12.  
    13. Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, _
    14.                                                                   ByVal crKey As Long, _
    15.                                                                   ByVal bAlpha As Byte, _
    16.                                                                   ByVal dwFlags As Long) As Long
    17.  
    18. Private Const LWA_ALPHA        As Long = &H2
    19. Private lngForNum              As Long
    20. Private lngStyle               As Long
    21. Private bolActive              As Boolean
    22.  
    23. Private Sub Form_Activate()
    24.     If Not bolActive Then
    25.         bolActive = True
    26.  
    27.         For lngForNum = 10 To 255
    28.             MakeWindowTransparent Me.hwnd, lngForNum
    29.             DoEvents
    30.         Next
    31.     End If
    32. End Sub
    33.  
    34. Private Sub Form_Load()
    35.     MakeWindowTransparent Me.hwnd, 10
    36. End Sub
    37.  
    38. Private Sub imgSplash_Click()
    39.     IsLoggedIn = False
    40.     frmLoginForm.Show
    41.     tmrSplash.Enabled = False
    42.     Unload Me
    43. End Sub
    44.  
    45. Public Sub MakeWindowTransparent(ByVal lngHwnd As Long, _
    46.                                  ByVal bytRate As Byte)
    47.    
    48.     lngStyle = GetWindowLong(lngHwnd, GWL_EXSTYLE)
    49.     lngStyle = lngStyle Or WS_EX_LAYERED
    50.     SetWindowLong lngHwnd, GWL_EXSTYLE, lngStyle
    51.     SetLayeredWindowAttributes lngHwnd, 0, bytRate, LWA_ALPHA
    52. End Sub
    53.  
    54. Private Sub tmrSplash_Timer()
    55.     IsLoggedIn = False
    56.     frmLoginForm.Show
    57.     Unload Me
    58. End Sub

  32. #32

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: destroy timer question

    Quote Originally Posted by Hack
    And you have incorporate the boolean flag, especially in the .Show on these three forms, right?

    If so, then somehow that boolean is getting reset to False when it hits one of them.

    I'm almost afraid to ask this question because I just know you are going to say: No ....but I gotta ask anyway....is there any consistent pattern to when your login form shows up uninvited?
    I am not sure if I have setup the boolean flag correctly or not. I havent worked with boolean until the other day so i am very new to it.

  33. #33
    Member
    Join Date
    Aug 2005
    Posts
    34

    Re: [STILL UNRESOLVED] destroy timer question

    Do you reference the spalsh screen or any subs/controls etc anywhere else in your project?

    Try these changes:

    VB Code:
    1. Private Sub tmrSplash_Timer()
    2.     IsLoggedIn = False
    3.     tmrSplash.Enabled = False
    4.     frmLoginForm.Show
    5.     Unload Me
    6. End Sub
    7.  
    8. Private Sub Form_UnLoad()
    9.     MakeWindowTransparent Me.hwnd, 10
    10.     tmrSplash.Enabled = False
    11. End Sub

  34. #34

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [STILL UNRESOLVED] destroy timer question

    Quote Originally Posted by zeusspider
    Do you reference the spalsh screen or any subs/controls etc anywhere else in your project?

    Try these changes:

    VB Code:
    1. Private Sub tmrSplash_Timer()
    2.     IsLoggedIn = False
    3.     tmrSplash.Enabled = False
    4.     frmLoginForm.Show
    5.     Unload Me
    6. End Sub
    7.  
    8. Private Sub Form_UnLoad()
    9.     MakeWindowTransparent Me.hwnd, 10
    10.     tmrSplash.Enabled = False
    11. End Sub
    made the changes except for including MakeWindowTransparent Me.hwnd, 10
    into the unload event because that part is what makes the form fade in and you cant fade in if the form is unloaded

  35. #35
    Junior Member TheMinime's Avatar
    Join Date
    Dec 2005
    Posts
    27

    Re: [STILL UNRESOLVED] destroy timer question

    declare then in a module and make them public

  36. #36

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [STILL UNRESOLVED] destroy timer question

    Quote Originally Posted by zeusspider
    Do you reference the spalsh screen or any subs/controls etc anywhere else in your project?
    Everything starts from Sub Main() and this is where the splash screen is started

    Sub Main() looks like so:
    VB Code:
    1. Option Explicit
    2.  
    3. Public Sub Main()
    4.     If App.PrevInstance Then
    5.         Beep
    6.         frmAppAlreadyRunning.Show
    7.         IsLoggedIn = False
    8.     Else
    9.         If Not App.PrevInstance Then
    10.             If LenB(Dir("license.lic")) Then
    11.                 frmSplash.Show
    12.                 IsLoggedIn = False
    13.             ElseIf LenB(Dir("licence.lic")) = 0 Then
    14.                 frmRegister.Show
    15.                 IsLoggedIn = False
    16.             Else
    17.                 End
    18.             End If
    19.         End If
    20.     End If
    21. End Sub

  37. #37
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: destroy timer question

    Quote Originally Posted by BrailleSchool
    I am not sure if I have setup the boolean flag correctly or not. I havent worked with boolean until the other day so i am very new to it.
    Show me an example of how you are using it.

  38. #38
    Junior Member TheMinime's Avatar
    Join Date
    Dec 2005
    Posts
    27

    Re: [STILL UNRESOLVED] destroy timer question

    man send all the project we already have this code

  39. #39

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [STILL UNRESOLVED] destroy timer question

    Quote Originally Posted by TheMinime
    man send all the project we already have this code
    if i sent the project then it would check for the .lic file based on your hard drive volumn number

  40. #40
    Junior Member TheMinime's Avatar
    Join Date
    Dec 2005
    Posts
    27

    Re: [STILL UNRESOLVED] destroy timer question

    I think I cant' comment the check code, it's not a big deal

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width