Results 1 to 6 of 6

Thread: Window Style Bits

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662
    I'd like to remove to Thickboarder, Min and max buttons, and the sysmenu from another window. I've already worked out the code to get the hwnd and the current style flags.

    So far, I've tried most of the logic functions with the bits to try to turn them off.

    the code looks something like this:
    Code:
        Dim newstyle As Long
        
        oldstyle = GetWindowLong(hwnd&, GWL_STYLE)
        newstyle = oldstyle Or (WS_CAPTION Or WS_MAXIMIZEBOX Or WS_MINIMIZEBOX Or WS_SYSMENU Or WS_THICKFRAME)
        SetWindowLong hwnd&, GWL_STYLE, newstyle
    I've tried "or not", "and", "or", "and not", "-", "+", and "xor"

    None seem to have any effect.

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Why don't you post a FOR...NEXT loop until it's set everything off? Boolean logic is tricky, and (most of the time) it only works with Booleans.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Wouldn't just using Not work?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    This worked for me:
    Code:
        Dim newstyle As Long
        
        oldstyle = GetWindowLong(Form1.hwnd, GWL_STYLE)
        newstyle = oldstyle Xor (WS_CAPTION Or WS_MAXIMIZEBOX Or WS_MINIMIZEBOX Or WS_SYSMENU Or WS_THICKFRAME)
        SetWindowLong Form1.hwnd, GWL_STYLE, newstyle
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Aha! I see now...
    Collect all the settings together (Or them), then remove (Xor the result).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662
    Unfortunately, the code i'm looking for is to modify a window outside of my own. The programmer has somehow managed to "lock" the window's style bits. I'll have to see if there is another way around it. Is there a way to make another (non-vb) program's form non-movable (except for with SetWindowPos)?

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