Results 1 to 4 of 4

Thread: Window On Top - Using Checked Mark

  1. #1

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Window On Top - Using Checked Mark

    I need some help or some explaining on the option of when the user chooses the on top or not on top, which ever one is selected then a tick appears next to it, maybe my code needs a slight add or simple modification. My code currently works and I have no errors, just looking to working out there check option, here is the code at the top of the form:

    Code:
    'window thingy
        Private Const HWND_TOPMOST = -1
        Private Const HWND_NOTOPMOST = -2
    
        Private Const SWP_NOSIZE = &H1
        Private Const SWP_NOMOVE = &H2
        Private Const SWP_NOACTIVATE = &H10
        Private Const SWP_SHOWWINDOW = &H40
        
        'declare API
        Private Declare Sub SetWindowPos Lib "user32" (ByVal hWnd As Long, _
          ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal Y As Long, _
          ByVal cX As Long, ByVal cY As Long, ByVal wFlags As Long)
    The On Top Code:

    Code:
    SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or _
            SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
    The Not On Top Code:

    Code:
    SetWindowPos Me.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or _
            SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
    Is there something in my code I can change so when the user chooses not on top the option shows a tick next to it?

    In the menu editor I have the On Top check box ticked.

    Thank you.

  2. #2
    Fanatic Member AceInfinity's Avatar
    Join Date
    May 2011
    Posts
    696

    Re: Window On Top - Using Checked Mark

    You could add a boolean "switch" as a True/False variable? I don't use VB6, just giving off suggestions. Everytime you invoke a Window position change, then change the variable as True or False depending on whether you've recently set it on top or not.
    <<<------------
    Improving Managed Code Performance | .NET Application Performance
    < Please if this helped you out. Any kind of thanks is gladly appreciated >


    .NET Programming (2012 - 2018)
    ®Crestron - DMC-T Certified Programmer | Software Developer
    <<<------------

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Window On Top - Using Checked Mark

    When you see apps that have a checkmark on the window or a menu option that says "always on top" or something similar, it is remembered by storing the value somewhere. This could be stored in the registry, an INI file, a simple text file, a database, and other places.

    When the user changes the setting, the app stores the updated settings. When the app starts, it reads the setting.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4
    Fanatic Member AceInfinity's Avatar
    Join Date
    May 2011
    Posts
    696

    Re: Window On Top - Using Checked Mark

    Quote Originally Posted by LaVolpe View Post
    When you see apps that have a checkmark on the window or a menu option that says "always on top" or something similar, it is remembered by storing the value somewhere. This could be stored in the registry, an INI file, a simple text file, a database, and other places.

    When the user changes the setting, the app stores the updated settings. When the app starts, it reads the setting.
    Yes, I used my own INI configuration to save information like that. I believe it's much better to do it that way because you don't have to deal with removing any of those entries that may not be wanted on the users PC if they choose to get rid of your program.

    If an INI file doesn't exist on app startup, then it gets created with default settings, and loads those defaults.

    That's the way i've always done it.
    <<<------------
    Improving Managed Code Performance | .NET Application Performance
    < Please if this helped you out. Any kind of thanks is gladly appreciated >


    .NET Programming (2012 - 2018)
    ®Crestron - DMC-T Certified Programmer | Software Developer
    <<<------------

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