|
-
Jan 27th, 2012, 12:17 AM
#1
Thread Starter
Hyperactive Member
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.
-
Jan 27th, 2012, 12:31 AM
#2
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.
<<<------------
.NET Programming (2012 - 2018)
®Crestron - DMC-T Certified Programmer | Software Developer <<<------------
-
Jan 27th, 2012, 09:25 AM
#3
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.
-
Jan 27th, 2012, 08:49 PM
#4
Re: Window On Top - Using Checked Mark
 Originally Posted by LaVolpe
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.
<<<------------
.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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|