Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8533187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:54:11+00:00 2026-06-11T09:54:11+00:00

I want to sub-class the actual window to detect when its size has changed.

  • 0

I want to sub-class the actual window to detect when its size has changed.

This is the code relevant where I’ve tried to subclassing it, using CallWindowProcW and SetWindowLongW, but it does not show any message when I maximize the window, so I’m supposed I’ve set wrongly some of those procedures. How to do it?

var oldWindowProc uintptr

func windowProc(hwnd syscall.Handle, msg uint32, wparam, lparam uintptr) (rc uintptr) {
    switch msg {
    case WM_SIZE:
        fmt.Println("Size")
        if wparam == SIZE_MAXIMIZED {
            fmt.Println("Changed!")
        }
    default:
        return CallWindowProcW(oldWindowProc, hwnd, msg, wparam, lparam)
    }
    return 0
}

func main() {
    oldWindowProc, _ = SetWindowLongW(syscall.Stdin, GWLP_WNDPROC,
        syscall.NewCallback(windowProc))

    for {

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:54:13+00:00Added an answer on June 11, 2026 at 9:54 am

    I don’t know much about winapi, but it seems your code closely resembles an example of go-winapi wrapper

    And using that wrapper lib, this modified version seems to work for me:

    (Full code)

    snip

    // window procedure
    func WndProc(hwnd winapi.HWND, msg uint32, wparam uintptr, lparam uintptr) uintptr {
        switch msg {
        case winapi.WM_SIZE:
            if wparam == SIZE_MAXIMIZED {
                fmt.Println("Changed!")
            }
        }
        // call original procedure
        return winapi.CallWindowProc(uintptr(oldWndProc), hwnd, msg, wparam, lparam)
    }
    

    I am sure you could look at that wrapper lib and derive the more direct way of doing it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to modify this code which works pretty good but (or I don't
I want my AbstracttableModel subclass data() method to return html i.e. PreText<b>Text</b>PostText And this
I want to have a UIView subclass that has a border image, but I
According to this answer I want to create my own subclass of Array QArray
I'm trying to create a sub-class of the JButton component that will enable or
I am sending emails with the following method: class Communicate < ActionMailer::Base def message(sub,msg,people)
I have a sub that handles when 14 ComboBoxes have their Index changed. I
If I want to return an immutable array like this + (NSArray *)ids but
Basically my view controller has 49 different instance variables of class CircleView (called circleView1
I'm trying to find the actual class of a django-model object, when using model-inheritance.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.