[comp.sys.amiga] IDCMP question

leibow@video.dec.com (MICHAEL LEIBOW) (06/29/88)

================================================================================
Note 1496.0                IDCMP and window questions                 No replies
VIDEO::LEIBOW "Michael Leibow"                       42 lines  22-JUN-1988 15:24
--------------------------------------------------------------------------------
    
    I have a program which needs to open many windows.  I would like
    to use the IDCMP to talk with intuition.  Would the following
    pseudo-code work?
    
    GetMeAWindow( garbage, ... )
    {
    	...
    	if ( first_window )
    		new_window_stuff->IDCMPFlags = MyIDCMPFlags;
    	else
    		new_window_stuff->IDCMPFlags = 0;
        some_struct[n].window = OpenWindow( new_window_stuff );
        if ( first_window ) {
    		MasterPort = some_struct[n].window->UserPort;
    		some_struct[n].window->UserPort = NULL;
        } else {
    		ModifyIDCMP( ... , MyIDCMPFlags, ..., MasterPort)
        }
    }
    
    KillAWindow( garbage, ... )
    {
    	...
    	CloseWindow( some_struct[n].window );
    	if ( that was the last window ) {
    		DeletePort( MasterPort );
    		MasterPort = NULL;
    	}
    }
    
    
    Is the DeletePort enough to tell intuition I don't need it anymore?
    Will the ModifyIDCMP attach a window to a port?
    Is it OK to remove the IDCMP port from the window structure and
    use it reguardless of whether the original window exists or not?
    
    	Thanks for your help,
    
    	--Mike
    
    PS: I didn't take time to look up the actual paramaters to ModifyIDCMP().