a1200   NEWS   APPS   DOCS   ABOUT
a1200
----
a1200
----
Autodocs
 Libraries:
 intuition.library
  ActivateGadget
  ActivateWindow
  AddClass
  AddGList
  AddGadget
  AllocRemember
  AllocScreenBuffer
  AutoRequest
  BeginRefresh
  BuildEasyRequestArgs
  BuildSysRequest
  ChangeScreenBuffer
  ChangeWindowBox
  ClearDMRequest
  ClearMenuStrip
  ClearPointer
  CloseScreen
  CloseWindow
  CloseWorkBench
  CurrentTime
  DisplayAlert
  DisplayBeep
  DisposeObject
  DoGadgetMethodA
  DoubleClick
  DrawBorder
  DrawImage
  DrawImageState
  EasyRequestArgs
  EndRefresh
  EndRequest
  EraseImage
  FreeClass
  FreeRemember
  FreeScreenBuffer
  FreeScreenDrawInfo
  FreeSysRequest
  GadgetMouse
  GetAttr
  GetDefPrefs
  GetDefaultPubScreen
  GetPrefs
  GetScreenData
  GetScreenDrawInfo
  HelpControl
  InitRequester
  IntuiTextLength
  ItemAddress
  LendMenus
  LockIBase
  LockPubScreen
  LockPubScreenList
  MakeClass
  MakeScreen
  ModifyIDCMP
  ModifyProp
  MoveScreen
  MoveWindow
  MoveWindowInFrontOf
  NewModifyProp
  NewObject
  NextObject
  NextPubScreen
  ObtainGIRPort
  OffGadget
  OffMenu
  OnGadget
  OnMenu
  OpenScreen
  OpenScreenTagList
  OpenWindow
  OpenWindowTagList
  OpenWorkBench
  PointInImage
  PrintIText
  PubScreenStatus
  QueryOverscan
  RefreshGList
  RefreshGadgets
  RefreshWindowFrame
  ReleaseGIRPort
  RemakeDisplay
  RemoveClass
  RemoveGList
  RemoveGadget
  ReportMouse
  Request
  ResetMenuStrip
  RethinkDisplay
  ScreenDepth
  ScreenPosition
  ScreenToBack
  ScreenToFront
  ScrollWindowRaster
  SetAttrsA
  SetDMRequest
  SetDefaultPubScreen
  SetEditHook
  SetGadgetAttrsA
  SetMenuStrip
  SetMouseQueue
  SetPointer
  SetPrefs
  SetPubScreenModes
  SetWindowPointerA
  SetWindowTitles
  ShowTitle
  SizeWindow
  SysReqHandler
  TimedDisplayAlert
  UnlockIBase
  UnlockPubScreen
  UnlockPubScreenList
  ViewAddress
  ViewPortAddress
  WBenchToBack
  WBenchToFront
  WindowLimits
  WindowToBack
  WindowToFront
  ZipWindow
Include
GuruMeditation
Docs » Autodocs » intuition.library » CloseWindow

NAME

	CloseWindow -- Close an Intuition window.

SYNOPSIS

	CloseWindow( Window )
A0
VOID CloseWindow( struct Window * );

FUNCTION

	Closes an Intuition window.  Unlinks it from the system, deallocates
its memory, and makes it disappear.
When this function is called, all IDCMP messages which have been sent
to your window are deallocated. If the window had shared a message
Port with other windows, you must be sure that there are no unreplied
messages for this window in the message queue. Otherwise, your program
will try to make use of a linked list (the queue) which contains free
memory (the old messages). This will give you big problems.
See the code fragment CloseWindowSafely(), below.
NOTE: If you have added a Menu strip to this Window (via
a call to SetMenuStrip()) you must be sure to remove that Menu strip
(via a call to ClearMenuStrip()) before closing your Window.
NOTE: This function may block until it is safe to de-link and free
your window. Your program may thus be suspended while the user
plays with gadgets, menus, or window sizes and position.
New for V36: If your window is a "Visitor Window" (see OpenWindow)
CloseWindow will decrement the "visitor count" in the public screen
on which the window was open. When the last visitor window is
closed, a signal will be sent to the public screen task, if this
was pre-arranged (see OpenScreen).

INPUTS

	Window = a pointer to a Window structure

RESULT

	None

BUGS

SEE ALSO

OpenWindow(), OpenScreen(), CloseScreen()

EXAMPLE

    /*	CloseWindowSafely */
/* these functions close an Intuition window
* that shares a port with other Intuition
* windows or IPC customers.
*
* We are careful to set the UserPort to
* null before closing, and to free
* any messages that it might have been
* sent.
*/
#include "exec/types.h"
#include "exec/nodes.h"
#include "exec/lists.h"
#include "exec/ports.h"
#include "intuition/intuition.h"
CloseWindowSafely( win )
struct Window *win;
{
/* we forbid here to keep out of race conditions with Intuition */
Forbid();
/* send back any messages for this window
* that have not yet been processed
*/
StripIntuiMessages( win->UserPort, win );
/* clear UserPort so Intuition will not free it */
win->UserPort = NULL;
/* tell Intuition to stop sending more messages */
ModifyIDCMP( win, 0L );
/* turn multitasking back on */
Permit();
/* and really close the window */
CloseWindow( win );
}
/* remove and reply all IntuiMessages on a port that
* have been sent to a particular window
* (note that we don't rely on the ln_Succ pointer
* of a message after we have replied it)
*/
StripIntuiMessages( mp, win )
struct MsgPort *mp;
struct Window *win;
{
struct IntuiMessage *msg;
struct Node *succ;
msg = (struct IntuiMessage *) mp->mp_MsgList.lh_Head;
while( succ = msg->ExecMessage.mn_Node.ln_Succ ) {
if( msg->IDCMPWindow == win ) {
/* Intuition is about to free this message.
* Make sure that we have politely sent it back.
*/
Remove( msg );
ReplyMsg( msg );
}
msg = (struct IntuiMessage *) succ;
}
}

Comments

Name:
E-mail: Use this if you want a message if you get a response, will not be shown.
Comment:
Select correct short for:

Red Sector Inc.

HZ
TSL
RSI
ATX

Comments:

$VER: d0.se 1.14 Copyright © 2011-2024 Tobias Geijersson support at d0 dot se