Beispiel #1
0
BOOL RegisterHanCharListBoxControl( HAB hab )
{
    if( !WinRegisterClass( hab, WC_HCHLB, HCHLBWndProc,
                           CS_SYNCPAINT | CS_SIZEREDRAW, sizeof( PVOID )))
        return FALSE;

    if( !WinRegisterClass( hab, WC_HCHLB_CLIENT, HCHLBClientWndProc,
                           CS_SYNCPAINT | CS_SIZEREDRAW, sizeof( PVOID )))
        return FALSE;

    return TRUE;
}
void __glutOpenOS2Connection(char* display)
{
  static char *classname=NULL;
extern HAB   hab;      /* PM anchor block handle         */
ERRORID  erridErrorCode;/* last error id code */
int ii;

  /* Make sure we register the window only once. */
  if(classname)
    return;

  classname = "GLUT";

    if ( !WinRegisterClass( hab, /* PM anchor block handle     */
             classname,/* window class name          */
             GlutWindowProc,/* address of window procedure*/
             CS_SIZEREDRAW, /* |CS_SYNCPAINT size changes cause redrawing */
             0UL ) )        /* window data                  */
    {   erridErrorCode = WinGetLastError(hab);
        ii = erridErrorCode;
          return;
    }

  classname = "GLUTCHILD";

    if ( !WinRegisterClass( hab, /* PM anchor block handle     */
             classname,/* window class name          */
             GlutWindowChildProc,/* address of window procedure*/
             CS_SIZEREDRAW, /* size changes cause redrawing */
             0UL ) )        /* window data                  */
    {   erridErrorCode = WinGetLastError(hab);
        ii = erridErrorCode;
          return;
    }

  __glutScreenWidth     = GetSystemMetrics(SM_CXSCREEN);
  __glutScreenHeight    = GetSystemMetrics(SM_CYSCREEN);

  /* Set the root window to NULL because windows creates a top-level
     window when the parent is NULL.  X creates a top-level window
     when the parent is the root window. */
  __glutRoot            = NULLHANDLE;

  /* Set the display to 1 -- we shouldn't be using this anywhere
     (except as an argument to X calls). */
  __glutDisplay         = (Display*)1;

  /* There isn't any concept of multiple screens in Win32, therefore,
     we don't need to keep track of the screen we're on... it's always
     the same one. */
  __glutScreen          = 0;
}
Beispiel #3
0
void main (void)
{
   QMSG  qmsg;
   HMQ   hmq;
   HWND  hwndClient;
   ULONG flFrameFlags;

   WinInitialize(0);
   hmq = WinCreateMsgQueue(hab, 0);

   /* get access to shared memory */
   DosGetNamedSharedMem((PVOID*)&memptr, MEM_NAME, PAG_READ);
   if (!memptr)
      WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
                    "  FreeType/2 is not running!",
                    "Error", 0, MB_OK | MB_ERROR);

   else {
      meminfo = memptr->address;
      if (meminfo->signature != 0x46524545)
         WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
                       "  FreeType/2 is not running!",
                       "Error", 0, MB_OK | MB_ERROR);
      else {
         flFrameFlags = FCF_TITLEBAR      | FCF_SYSMENU  |
                        FCF_TASKLIST ;

         WinRegisterClass(hab, "MyClass",
                          (PFNWP) ClientWndProc,
                          CS_SIZEREDRAW, 0);

         hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
                                        WS_VISIBLE,
                                        &flFrameFlags,
                                        "MyClass", "FreeType/2 Heap Usage",
                                        0, (HMODULE) NULL,
                                        0, &hwndClient);

         WinSetVisibleRegionNotify(hwndClient, TRUE);

         /* make titlebar text look better */
         WinSetPresParam(WinWindowFromID(hwndFrame, FID_TITLEBAR),
                         PP_FONTNAMESIZE, 9, (PVOID)"8.Helv");

         WinSetWindowPos(hwndFrame, NULLHANDLE, 0, 0, 350, 42,
                         SWP_MOVE | SWP_SIZE | SWP_SHOW);

         while (WinGetMsg(hab, &qmsg, (HWND) NULL, 0, 0))
            WinDispatchMsg(hab, &qmsg);

         WinSetVisibleRegionNotify(hwndClient, FALSE);
      }
   }
   /* free shared memory block */
   DosFreeMem(memptr);

   WinDestroyWindow(hwndFrame);
   WinDestroyMsgQueue(hmq);
   WinTerminate(hab);
}
Beispiel #4
0
nsresult
nsAppShell::Init()
{
  // a message queue is required to create a window but
  // it is not necessarily created yet
  if (WinQueryQueueInfo(HMQ_CURRENT, NULL, 0) == FALSE) {
    // Set our app to be a PM app before attempting Win calls
    PPIB ppib;
    PTIB ptib;
    DosGetInfoBlocks(&ptib, &ppib);
    ppib->pib_ultype = 3;

    HAB hab = WinInitialize(0);
    WinCreateMsgQueue(hab, 0);
  }

  if (!sMsgId) {
    sMsgId = WinAddAtom( WinQuerySystemAtomTable(), "nsAppShell:EventID");
    WinRegisterClass((HAB)0, "nsAppShell:EventWindowClass", EventWindowProc, NULL, 0);
  }

  mEventWnd = ::WinCreateWindow(HWND_DESKTOP,
                                "nsAppShell:EventWindowClass",
                                "nsAppShell:EventWindow",
                                0,
                                0, 0,
                                10, 10,
                                HWND_DESKTOP,
                                HWND_BOTTOM,
                                0, 0, 0);
  NS_ENSURE_STATE(mEventWnd);

  return nsBaseAppShell::Init();
}
SOM_Scope void   SOMLINK vptextc_somInitClass(M_VPText *somSelf,
                IN zString className,
                IN SOMAny *parentClass,
                IN integer4 instanceSize,
                IN int maxStaticMethods,
                IN integer4 majorVersion,
                IN integer4 minorVersion)
{
    M_VPTextData *somThis = M_VPTextGetData(somSelf);
    CHAR ErrorBuffer[100];
    M_VPTextMethodDebug("M_VPText","vptextc_somInitClass");

    DosLoadModule((PSZ) ErrorBuffer, sizeof(ErrorBuffer), "VPText",
                  &_hModResource);
    WinRegisterClass(                     /* Register window class        */
         0,                             /* Anchor block handle          */
         szClass,                       /* Window class name            */
         TestWndProc,              /* Address of window procedure  */
         0,                               /* Class style                  */
         12                                /* No extra window words        */
         );

    parent_somInitClass(somSelf,className,parentClass,instanceSize,
                        maxStaticMethods,majorVersion,minorVersion);
}
int main()
{
    HMQ   hmq;
    QMSG  qmsg;
    ULONG flFrameFlags    = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER |
                            FCF_MINMAX   | FCF_SHELLPOSITION | FCF_TASKLIST |
                            FCF_ICON | FCF_MENU;
    CHAR  szClientClass[] = "CLIENT";

    hab = WinInitialize (0);
    hmq = WinCreateMsgQueue (hab, 0);

    WinRegisterClass (hab, szClientClass, (PFNWP)ClientWndProc, 0, 0);
    WinLoadString (hab, 0, ID_APPNAME, sizeof(szTitle), szTitle);

    hWndFrame = WinCreateStdWindow (HWND_DESKTOP, WS_VISIBLE,
        &flFrameFlags, szClientClass, szTitle, 0, 0, ID_APPNAME, &hWndClient);

    while (WinGetMsg (hab, &qmsg, 0, 0, 0))
        WinDispatchMsg (hab, &qmsg);

    WinDestroyWindow (hWndFrame);
    WinDestroyMsgQueue (hmq);
    WinTerminate (hab);
    return (0);
}
Beispiel #7
0
int main()
{
ULONG fl = FCF_SIZEBORDER | FCF_TASKLIST | FCF_ICON | FCF_TITLEBAR | FCF_SYSMENU | FCF_MINMAX | FCF_SHELLPOSITION;
static CHAR  szClass [] = "Tray Example" ;
HMQ          hmq ;
QMSG         qmsg ;
LONG i;

hab = WinInitialize (0) ;
hmq = WinCreateMsgQueue (hab, 0) ;

WinRegisterClass (hab, (PSZ)szClass, (PFNWP)windowproc, CS_SIZEREDRAW, 0) ;

hwndFrame = WinCreateStdWindow (HWND_DESKTOP, WS_VISIBLE,
                                &fl, (PSZ)szClass, (PSZ)szClass,
                                0L, NULL, 100, &hwndClient) ;

for(i=100;i<=104;i++)
hIcon[i-100] = WinLoadPointer(HWND_DESKTOP,NULLHANDLE,i);

while (WinGetMsg (hab, &qmsg, NULL, 0, 0))
       WinDispatchMsg (hab, &qmsg) ;

WinDestroyWindow (hwndFrame) ;
WinDestroyMsgQueue (hmq) ;
WinTerminate (hab) ;
return 0 ;

}
Beispiel #8
0
void RegisterToolBarClass(HAB hab) {
    assert(WinRegisterClass(hab,
                            WC_MTOOLBAR,
                            (PFNWP)ToolBarProc,
                            CS_SIZEREDRAW,
                            sizeof(void *)) == TRUE);
}
VOID _System threadTimerMgr(ULONG ul) {
   HMQ hmq;
   QMSG qmsg;

   DosSetPriority(PRTYS_THREAD, PRTYC_FOREGROUNDSERVER, 31, 0);
   // inizializzazione
   hmq = WinCreateMsgQueue((g.timerThrd.hab = WinInitialize(0)), 0);
   WinCancelShutdown(hmq, TRUE);
   // registra classe WC_TIMERMGRCLASS
   if (!WinRegisterClass(g.timerThrd.hab, WC_TIMERMGRCLASS,
                         threadTimerMgrProc, 0L, 0L))
      terminateTimerMgr(hmq);

   // crea l'object window
   if (!(g.timerThrd.hwnd = WinCreateWindow(HWND_OBJECT, WC_TIMERMGRCLASS,
                                            NULL, 0, 0, 0, 0, 0, NULLHANDLE,
                                            HWND_BOTTOM, 0, NULL, NULL)))
      terminateTimerMgr(hmq);

   // message loop
   while (WinGetMsg(g.timerThrd.hab, &qmsg, NULLHANDLE, 0, 0))
      WinDispatchMsg(g.timerThrd.hab, &qmsg);

   // terminazione
   terminateTimerMgr(hmq);
}
Beispiel #10
0
BOOL RegisterHanAutomataClass(HAB hab)
{
    if( !WinRegisterClass(hab,WCOBJ_HIA,HIA_WndProc,0,HIA_cbWINDOWDATA))
        return FALSE;

    return RegisterHanCharListBoxControl( hab );
}
/*--------------------------------------------------
 *  Constructs the presentation window
 *--------------------------------------------------*/
PMWindow::PMWindow( SHORT       id         ,
                    const char* caption    ,
                    HWND        parent     ,
                    HWND        owner      ,
                    long        x          ,
                    long        y          ,
                    long        cx         ,
                    long        cy         ,
                    ULONG       style      )

: win_id     ( id    ),
  win_wrapper( FALSE ),

  win_default_handler(0)
{
  static BOOL initialized = FALSE;

  if( !initialized )
  {
    if( !WinRegisterClass( PMGUI::hab(), "PMWindow", WinDefWindowProc, CS_SIZEREDRAW, 4 ))
      PM_THROW_GUIERROR();

    initialized = TRUE;
  }

  win_handle = WinCreateWindow( parent, "PMWindow", caption, style,
                                x, y, cx, cy, owner, HWND_BOTTOM, id, NULL, 0 );
  if( win_handle == NULLHANDLE )
    PM_THROW_GUIERROR();

  handle_events();
}
Beispiel #12
0
int main(int argc,char **argv) {
    ULONG flFrameFlags = FCF_TITLEBAR | FCF_SYSMENU | FCF_TASKLIST | FCF_SIZEBORDER | FCF_SHELLPOSITION | FCF_MINBUTTON | FCF_MAXBUTTON;
    QMSG qmsg;
    HAB hab;
    HMQ hmq;

    hab = WinInitialize(0);
    if (hab == (HAB)0) return 1;

    hmq = WinCreateMsgQueue(hab,0);
    if (hmq == (HMQ)0) return 1;

    WinRegisterClass(hab,"HelloWnd",(PFNWP)HelloWndProc,CS_SIZEREDRAW,0);

    HelloWnd = WinCreateStdWindow(HWND_DESKTOP,WS_VISIBLE,&flFrameFlags,"HelloWnd","Hello world",0L,0/*NULLHANDLE*/,ID_PRIMWIN,&HelloWndClient);
    if (HelloWnd == (HWND)0 || HelloWndClient == (HWND)0) return 1;

    while (WinGetMsg(hab,&qmsg,0/*NULLHANDLE*/,0,0))
        WinDispatchMsg(hab,&qmsg);

    WinDestroyWindow(HelloWnd);
    WinDestroyMsgQueue(hmq);
    WinTerminate(hab);
    return 0;
}
/*------------------------------------------------------------------------*/
void RegCanv(HAB hab, WINDOWINFO *pwi)
{
   WinRegisterClass (hab,(PSZ)szCanvasClass,(PFNWP)CanvasWndproc,
                     0L,0L);

   pwiCanv = pwi; /* Get a ref.. */
}
/****************************************************************\
 *  Initialization routine                                      *
 *--------------------------------------------------------------*
 *                                                              *
 *  Name:    Init()                                             *
 *                                                              *
 *  Purpose: Performs initialization functions required before  *
 *           the main window can be created.                    *
 *                                                              *
 *  Usage:   Called once before the main window is created.     *
 *                                                              *
 *  Method:  - installs the routine ExitProc into the           *
 *              DosExitList chain                               *
 *           - registers all window classes                     *
 *           - performs any command line processing             *
 *                                                              *
 *  Returns: TRUE - initialization is successful                *
 *           FALSE - initialization failed                      *
 *                                                              *
\****************************************************************/
BOOL Init(VOID)
{
    /* Add ExitProc to the exit list to handle the exit processing */
    if(DosExitList(EXLST_ADD, ExitProc))
    {
        return FALSE;
    }
                       /* load application name from resource file */
    if(!WinLoadString(hab, (HMODULE)0, IDS_APPNAME, MAXAPPNAMELEN, szAppName))
        return FALSE;
    if(!WinLoadString(hab, 0, IDS_UNTITLED, MESSAGELEN, szUntitled))
        return FALSE;
                          /* register the main client window class */
    if(WinRegisterClass(hab,
                        (PSZ)szAppName,
                        (PFNWP)MainWndProc,
                        CS_SIZEREDRAW | CS_SYNCPAINT | CS_CLIPCHILDREN,
                        0) == 0)
        return FALSE;

    /* Turn off hard-error popup after GP-FAULT. No return codes
       checked as it is cosmetic and if it doesn't work the only side
       effect will be to have the default hard-error popup show up. */

    return TRUE;
}                                                         /* Init() */
ULONG __export EXPENTRY
WgtInitModule( HAB hab,             // XCenter's anchor block
               HMODULE hmodPlugin,  // module handle of the widget DLL
               HMODULE hmodXFLDR,   // XFLDR.DLL module handle
               PXCENTERWIDGETCLASS *ppaClasses,
               PSZ pszErrorMsg )    // if 0 is returned, 500 bytes of error msg
{
  ULONG ulrc = 0;

  // Save the DLL hmod in a global variable
  // not really needed but I'm lazy
  hmodMe = hmodPlugin;

  // register our PM window class
  if( !WinRegisterClass( hab,
                         WNDCLASS_WIDGET_TASKS,
                         fnwpWxTaskWidget,
                         CS_PARENTCLIP | CS_SIZEREDRAW | CS_SYNCPAINT,
                         sizeof(PVOID))) // extra memory to reserve for QWL_USER
  {
    // error registering class: report error then
    strcpy( pszErrorMsg, "WinRegisterClass failed." );
  } else {
    // no error:
    // return widget classes array
    *ppaClasses = G_WidgetClasses;

    // return no. of classes in this DLL (one here):
    ulrc = sizeof(G_WidgetClasses) / sizeof(G_WidgetClasses[0]);
  }

  return ulrc;
}
int main (void)
     {
     static CHAR  szClientClass [] = "EndJoin" ;
     static ULONG flFrameFlags = FCF_TITLEBAR      | FCF_SYSMENU  |
                                 FCF_SIZEBORDER    | FCF_MINMAX   |
                                 FCF_SHELLPOSITION | FCF_TASKLIST ;
     HAB          hab ;
     HMQ          hmq ;
     HWND         hwndFrame, hwndClient ;
     QMSG         qmsg ;

     hab = WinInitialize (0) ;
     hmq = WinCreateMsgQueue (hab, 0) ;

     WinRegisterClass (hab, szClientClass, ClientWndProc, CS_SIZEREDRAW, 0) ;

     hwndFrame = WinCreateStdWindow (HWND_DESKTOP, WS_VISIBLE,
                                     &flFrameFlags, szClientClass, NULL,
                                     0L, 0, 0, &hwndClient) ;

     while (WinGetMsg (hab, &qmsg, NULLHANDLE, 0, 0))
          WinDispatchMsg (hab, &qmsg) ;

     WinDestroyWindow (hwndFrame) ;
     WinDestroyMsgQueue (hmq) ;
     WinTerminate (hab) ;
     return 0 ;
     }
Beispiel #17
0
void PM_mainloop(VOID *arg)
{
    SIZEL sizelHps = {0,0};
    HAB   hab;  // Anchor Block to PM
    HMQ   hmq;  // Handle to Msg Queue
    HDC   hdc;  // Handle to Device (Window-Screen)
    QMSG  qmsg; // Msg Queue Event
    video_canvas_t *ptr=(video_canvas_t*)arg;

    hab = WinInitialize(0);            // Initialize PM
    hmq = WinCreateMsgQueue(hab, 0);   // Create Msg Queue

    // 2048 Byte Memory (Used eg for the Anchor Blocks
    WinRegisterClass(hab, szClientClass, PM_winProc, CS_SIZEREDRAW, 2048);

    (*ptr)->hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
                                   WS_ANIMATE, &flFrameFlags,
                                   szClientClass, szTitleBarText, 0L, 0, 0,
                                   &((*ptr)->hwndClient));

    WinSetWindowPos((*ptr)->hwndFrame, HWND_TOP, 0, 0,
                    (*ptr)->width*stretch,
                    (*ptr)->height*stretch+
                    WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR), // +1 with gcc?
                    SWP_SIZE|SWP_SHOW|SWP_ZORDER|SWP_ACTIVATE);    // Make visible, resize, top window
    WinSetWindowPtr((*ptr)->hwndClient, QWL_USER, (VOID*)(*ptr));
    // --------------------
    // maybe ---> WM_CREATE
    // --------------------
    hdc         = WinOpenWindowDC((*ptr)->hwndFrame);
    (*ptr)->hps = GpiCreatePS(WinQueryAnchorBlock((*ptr)->hwndFrame),
                              hdc, &sizelHps,
                              PU_PELS|GPIF_DEFAULT|GPIT_MICRO|GPIA_ASSOC); // GPIT_NORMAL does also work with vac++

    (*ptr)->pbmi = lib_calloc(1, 16+sizeof(RGB2)*256);
    (*ptr)->pbmi->cbFix      = 16; // Size of cbFix, cPlanes, cBitCount = Begin of RGB2
    (*ptr)->pbmi->cPlanes    =  1;
    (*ptr)->pbmi->cBitCount  =  8; // Using 8-bit color mode
    (*ptr)->palette=(RGB2*)((ULONG)(*ptr)->pbmi+(*ptr)->pbmi->cbFix);

    vidlog("pbmiAllocated",0);
    (*ptr)->pbmi_initialized = TRUE;    // All stuff for pbmi created
    //    DosReleaseMutexSem(hmtx); // gfx init end
    //-----------------------
    
    while (WinGetMsg (hab, &qmsg, NULLHANDLE, 0, 0))
        WinDispatchMsg (hab, &qmsg) ;

    //    (*ptr)->pbmi_initialized = FALSE;
    DosRequestMutexSem(hmtx, SEM_INDEFINITE_WAIT);
    GpiDestroyPS((*ptr)->hps);
    WinDestroyWindow ((*ptr)->hwndFrame); // why was this commented out? --> WM_CLOSE ??
    WinDestroyMsgQueue(hmq);  // Destroy Msg Queue
    WinTerminate (hab);       // Release Anchor to PM
    lib_free((*ptr)->pbmi);   // is this the right moment to do this???
    //    lib_free(*ptr); // Vice crashes... why??? This must be done in the main thread!
    exit(0);                  // Kill VICE, All went OK
}
SOM_Scope BOOL   SOMLINK src_wpFormatDragItem(SrcTransient *somSelf,
		PDRAGITEM pdrgItem)
{
    HAB     hab;
    HWND    hwnd;
    PSZ     pszRealName;
    ULONG   pcbRealName=260;
    PDRAGSTRUCT  pDragData;
    /* SrcTransientData *somThis = SrcTransientGetData(somSelf); */
    SrcTransientMethodDebug("SrcTransient","src_wpFormatDragItem");

    // Call the parent method
    parent_wpFormatDragItem(somSelf,pdrgItem);

    // Set the Rendering mechanism to DRM_OS2FILE, DRF_UNKNOWN and null
    // out the hstrSourceName to force the target to send a DM_RENDER
    // to the object window
    pdrgItem->hstrRMF = DrgAddStrHandle ("<DRM_OS2FILE, DRF_UNKNOWN>");
    pdrgItem->hstrSourceName = DrgAddStrHandle ("");

    // Register the class
    hab = WinQueryAnchorBlock(HWND_DESKTOP);
    if (!WinRegisterClass( hab , "DragObjectWin", (PFNWP)DragWndProc ,
                            CS_SIZEREDRAW | CS_SYNCPAINT, sizeof(pDragData)))
        {
        return FALSE;
        }

    // Set up the window data structure
    pDragData = (PDRAGSTRUCT) somSelf->wpAllocMem(sizeof(*pDragData), FALSE);
    pDragData->somSelf = somSelf;
    pDragData->cb = sizeof(*pDragData);

    // Create the window
    hwnd =                                        /* create frame window */
        WinCreateWindow(
            HWND_OBJECT,                /* parent-window handle                    */
            "DragObjectWin",            /* pointer to registered class name        */
            "",                         /* pointer to window text                  */
            0,                          /* window style                            */
            0, 0, 0, 0,                 /* position of window                      */
            NULLHANDLE,                 /* owner-window handle                     */
            HWND_TOP,                   /* handle to sibling window                */
            (USHORT) IDD_DRAGWIN,       /* window identifier                       */
            (PVOID) pDragData,          /* pointer to buffer                       */
            NULL);                      /* pointer to structure with pres. params. */

    if (!hwnd)
        {
        return FALSE;
        }

    // Set the hwndItem to the Object window handle, so that the DM_RENDER
    // gets sent to it when a Drag/Drop occurrs
    pdrgItem->hwndItem = hwnd;

    return TRUE;
}
/****************************************************************\
 *  Initialization routine
 *--------------------------------------------------------------
 *
 *  Name:   Init()
 *
 *  Purpose: Performs initialization functions.
 *
 *  Usage:  Called once before the message queue is queried.
 *
 *  Method:
 *          - starts processing thread
 *          - registers all window classes
 *
 *  Returns:
 *          TRUE  - initialization is successful
 *          FALSE - initialization failed
\****************************************************************/
BOOL Init(int argc, char *argv[])
{
   PTIB   ptibDummy;
   PIB    *ppibProcess;
   ULONG  flCtlData;    /* frame control data */


   /* load application name from resource file */
   if(!WinLoadString(hab, NULLHANDLE, IDS_APPNAME, MAXNAMEL, (PSZ)szAppName))
      return FALSE;

   /* register the main client window class */
   if(!WinRegisterClass(hab,
                        (PSZ)szAppName,
                        MainWndProc,
                        CS_SIZEREDRAW | CS_CLIPCHILDREN,
                        0UL))
   {
      return FALSE;
   }

   flCtlData = FCF_STANDARD | FCF_VERTSCROLL | FCF_HORZSCROLL;

   hwndMainFrame = WinCreateStdWindow(HWND_DESKTOP,
                                      WS_VISIBLE,
                                      &flCtlData,
                                      (PSZ)szAppName,
                                      (PSZ)NULL,
                                      WS_VISIBLE,
                                      NULLHANDLE,
                                      IDR_MAIN,
                                      &hwndMain);
   if (NULLHANDLE == hwndMainFrame)
      return FALSE;

   WinSetWindowText(hwndMainFrame, (PSZ)szAppName);

   if (DosGetInfoBlocks(&ptibDummy, &ppibProcess) ||
       !(hqQ = InitQ((*ppibProcess).pib_ulpid,  /* process that will send WM_CLOSE command */
                     hwndMainFrame)))           /* window to post to */
      return FALSE;

   if (argc > 1)
   {
      RESULTCODES  resc;
      CHAR  pszBuff[CCHMAXPATH];

      if ((BOOL)DosExecPgm((PSZ)pszBuff, CCHMAXPATH, EXEC_ASYNC, NULL, NULL, &resc, argv[1]))
      {
         MessageBox(hwndMain, IDMSG_CANNOT_EXEC_CLIENT, MB_CUAWARNING | MB_OK, TRUE);
      }
   }

   InitHelp();

   return TRUE;
}  /* Init() */
void main( void )
{
    ULONG flCreate;
    HWND hwndFrame;
    HWND hwndClient;

    hab = WinInitialize((USHORT) NULL);

    hmq = WinCreateMsgQueue(hab,0);

    WinRegisterClass(hab,
                     "miscMainWindow",
                     (PFNWP) miscMainWinProc,
                     CS_SIZEREDRAW,
                     0);

    WinRegisterClass(hab,
                     "editorWindow",
                     (PFNWP) editorWinProc,
                     CS_SIZEREDRAW,
                     0);

    flCreate= FCF_MAXBUTTON | FCF_MENU | FCF_MINBUTTON | FCF_SIZEBORDER | FCF_SYSMENU |
              FCF_TITLEBAR | FCF_TASKLIST ;

    hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
                                       WS_VISIBLE,
                                       &flCreate,
                                       "miscMainWindow",
                                       "DBCS Misc Samples",
                                       CS_SIZEREDRAW,
                                       NULLHANDLE,
                                       WID_MAIN,
                                       (PHWND) & hwndClient);

    while ( WinGetMsg(hab, (PQMSG) &qmsg, (HWND) NULL, 0, 0))
       WinDispatchMsg(hab, (PQMSG) &qmsg );

    WinDestroyWindow(hwndFrame);
    WinDestroyMsgQueue( hmq );
    WinTerminate( hab );

  return;
}
Beispiel #21
0
BOOL createKtbHelp( HAB hab, HWND hwndParent, HWND hwndOwner )
{
    if( WinRegisterClass( hab, WC_KTBHELP, helpWndProc, CS_SIZEREDRAW, sizeof( PVOID )))
        return WinCreateWindow( hwndParent, WC_KTBHELP, "ktbHelp", WS_VISIBLE,
                    0, 0, 0, 0,
                    hwndOwner, HWND_TOP,
                    ID_KTBHELP, NULL, NULL );

    return FALSE;
}
VOID Mouse_Focus_CreatePage( VOID )
{
 // Указатель на страницу.
 PPAGE Page = Enhancer.Pages.Mouse_focus;

 // Создаем страницу.
 CHAR Page_class_name[] = "Mouse_Focus_WndClass";
 WinRegisterClass( Enhancer.Application, Page_class_name, (PFNWP) Mouse_Focus_WndProc, 0, 0 );
 Page->Window = WinCreateWindow( Enhancer.Client_window, Page_class_name, NULL, 0, 0, 0, 0, 0, NULLHANDLE, HWND_TOP, 0, NULL, NULL );

 // Задаем шрифт.
 SetCommonEnhancerFont( Page->Window );

 // Узнаем страну, в которой работает приложение.
 LONG Code_page = Enhancer.Code_page;

 // Создаем поля ввода.
 LitCreateLayout( &Page->Layout, Page->Window );

 CreateCtlButtons( Page );

 {
  for( INT Count = 0; Count < 5; Count ++ )
   {
    LTBRICK Space_brick; LitPrepareBrick( &Space_brick );
    Space_brick.hwnd = WinCreateWindow( Page->Window, WC_STATIC, NULL, SS_TEXT, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, 0, NULL, NULL );
    Space_brick.prpWidthInParent = LTM_FULL_WIDTH; Space_brick.prpHeightInParent = EMPTY_LINE_HEIGHT;
    LitJoinBrick( &( Page->Layout ), &Space_brick );

    LitCompleteRow( &( Page->Layout ) );
   }
 }

 {
  LTBRICK Checkbox_brick; LitPrepareBrick( &Checkbox_brick );
  Checkbox_brick.hwnd = WinCreateWindow( Page->Window, WC_BUTTON, NULL, BS_CHECKBOX, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Mouse_Focus.Settings.Scrolling_ID, NULL, NULL );
  Checkbox_brick.prpWidthInParent = LTM_COMMON_WIDTH; Checkbox_brick.prpHeightInParent = LTM_COMMON_HEIGHT;
  SetCommonEnhancerColors( Checkbox_brick.hwnd );
  if( Code_page == RUSSIAN ) WinSetWindowText( Checkbox_brick.hwnd, StrConst_RU_Pages_Mouse_focus_Scrolling );
  else WinSetWindowText( Checkbox_brick.hwnd, StrConst_EN_Pages_Mouse_focus_Scrolling );
  LitJoinBrick( &( Page->Layout ), &Checkbox_brick );

  LitCompleteRow( &( Page->Layout ) );
 }

 if( Code_page == RUSSIAN )
  CreatePromptText( Page, StrConst_RU_Pages_Mouse_focus_Prompt );
 else
  CreatePromptText( Page, StrConst_EN_Pages_Mouse_focus_Prompt );

 CompleteCreation( Page );

 // Возврат.
 return;
}
Beispiel #23
0
TOOLBAR :: Toolbar (HWND hwndFrame)
{
    TOOLBAR::ptb = this; // FIXME puke!

    fHidden = TRUE;
    this->hwndFrame = hwndFrame;

    if (WinWindowFromID (hwndFrame, FID_CLIENT))
        fOwnerIsDialog = FALSE;
    else
        fOwnerIsDialog = TRUE;

    // no buttons by now ...
    c = 0;
    memset (aid, 0x00, sizeof (aid[0]) * TOOLBARBUTTONSMAX);

    if (! (pfnwpOldFrame =
           WinSubclassWindow (hwndFrame, PFNWP (fnwpNewFrame))))
        return;

    // if not already registered, register our window class
    if (! fClassRegistered)
    {
        WinRegisterClass (GETHAB, PSZ_WCTOOLBAR, fnwp, 0L, 4L);
        fClassRegistered = TRUE;
    }

    // either place under menu or under titlebar
    SHORT  y, cx;
    SWP    swp;

    if ((hwndAnchor = WinWindowFromID (hwndFrame, FID_MENU)))
    {
        WinQueryWindowPos (hwndAnchor, &swp);
        cx = swp.cx;
        y  = swp.y-CY_TOOLBAR;
    }
    else if ((hwndAnchor = WinWindowFromID (hwndFrame, FID_TITLEBAR)))
    {
        WinQueryWindowPos (hwndAnchor, &swp);
        cx = swp.cx;
        y  = swp.y-CY_TOOLBAR;
    }
    else
    {
        cx = 1;
        y = 0;
    }

    // create client window and assign object ptr to window word
    hwnd = WinCreateWindow (hwndFrame, PSZ_WCTOOLBAR, "", 0L, 0,y,
                            cx,CY_TOOLBAR, hwndFrame, HWND_TOP, FID_TOOLBAR,
                            NULL, NULL);
    WinSetWindowPtr (hwnd, 0, this);
}
Beispiel #24
0
/**********************  Start of main procedure  ***********************/
void main(  )
{
  HMQ  hmq;                             /* Message queue handle         */
  HWND hwndClient;                      /* Client area window handle    */
  HWND hwndFrame;                       /* Frame window handle          */
  QMSG qmsg;                            /* Message from message queue   */
  ULONG flCreate;                       /* Window creation control flags*/

  Hab = WinInitialize( NULL );          /* Initialize PM                */
  hmq = WinCreateMsgQueue( Hab, 0 );    /* Create a message queue       */

  WinRegisterClass(                     /* Register window class        */
     Hab,                               /* Anchor block handle          */
     "MyWindow",                        /* Window class name            */
     MyWindowProc,                      /* Address of window procedure  */
     CS_SIZEREDRAW,                     /* Class style                  */
     0                                  /* No extra window words        */
     );

  flCreate = FCF_STANDARD &             /* Set frame control flags to   */
             ~FCF_SHELLPOSITION;        /* standard except for shell    */
                                        /* positioning.                 */

   hwndFrame = WinCreateStdWindow(
               HWND_DESKTOP,            /* Desktop window is parent     */
               0L,                      /* No frame styles              */
               &flCreate,               /* Frame control flag           */
               "MyWindow",              /* Client window class name     */
               "",                      /* No window text               */
               0L,                      /* No special class style       */
               NULL,                    /* Resource is in .EXE file     */
               ID_WINDOW,               /* Frame window identifier      */
               &hwndClient              /* Client window handle         */
               );

  WinSetWindowPos( hwndFrame,           /* Shows and activates frame    */
                   HWND_TOP,            /* window at position 100, 100, */
                   100, 100, 400, 200,  /* and size 200, 200.           */
                   SWP_SIZE | SWP_MOVE | SWP_ACTIVATE | SWP_SHOW
                 );


/************************************************************************/
/* Get and dispatch messages from the application message queue         */
/* until WinGetMsg returns FALSE, indicating a WM_QUIT message.         */
/************************************************************************/
  while( WinGetMsg( Hab, &qmsg, NULL, 0, 0 ) ) {
    WinDispatchMsg( Hab, &qmsg );
  }

  WinDestroyWindow( hwndFrame );        /* Tidy up...                   */
  WinDestroyMsgQueue( hmq );            /* and                          */
  WinTerminate( Hab );                  /* terminate the application    */
}
ULONG Init(VOID)
#endif
{
    /* Add ExitProc to the exit list to handle the exit processing.  If
     * there is an error, then terminate the process since there have
     * not been any resources allocated yet
     */
   if (DosExitList(EXLST_ADD, (PFNEXITLIST)ExitProc))
   {
       MessageBox(HWND_DESKTOP,
                  IDMSG_CANNOTLOADEXITLIST, 0,
                  MB_OK | MB_ERROR,
                  TRUE);
       DosExit(EXIT_PROCESS, RETURN_ERROR);
   }

   /* load application name from resource file */
   if(0==WinLoadString(vhab, (HMODULE)NULL, IDS_APPNAME, CCHAPPNAME, szAppName))
       return IDMSG_CANNOTLOADSTRING;

   /* register the main client window class */
   if (!WinRegisterClass(vhab,
                szAppName,
                (PFNWP)MainWndProc,
                0L,
                0))
       return IDMSG_INITFAILED;

   /*
    * create main application window & detach scrollbars
    */
   if (!InitMainWindow())
       return IDMSG_MAINWINCREATEFAILED;

   /*
    * set up globals used for sizing & system pointers
    */
   if (!InitGlobalVars())
      return IDMSG_INITFAILED;

   /*
    * this function prepares the application for loading images
    */
   InitClientArea(vhwndClient);

   /*
    * initialize help mechanism
    */
#ifdef HELP_MANAGER_ENABLED
   HelpInit();
#endif

   return NO_ERROR;
}  /* End of Init */
WindowRegistration::WindowRegistration(HAB hab, PFNWP proc)
{
  if (registered == FALSE)
    {
      WinRegisterClass(hab,
                       windowClassName,
                       proc,
                       CS_SIZEREDRAW,
                       4);
      registered = TRUE;
    }
}
Beispiel #27
0
int winmain()
{
HAB   hab = NULLHANDLE;
HMQ   hmq = NULLHANDLE;
QMSG  qmsg;
HWND  hwndFrame = NULLHANDLE;
HWND  hwndClient = NULLHANDLE;
ULONG ctlData = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX |
		FCF_TASKLIST;

	do	{
		if ((hab = WinInitialize(0)) == NULLHANDLE) break;
		if ((hmq = WinCreateMsgQueue(hab,0)) == NULLHANDLE) break;
		if (!WinRegisterClass(hab, APPCLASS,
			ClientWndProc, CS_SIZEREDRAW, 4)) break;


		// Register the HanMLE and HanInputAutomata window class
		if (!RegisterHanAutomataClass(hab)) break;
		if (!RegisterHanEntryFieldControl(hab)) break;
		if ((hwndFrame = WinCreateStdWindow(
					HWND_DESKTOP, WS_VISIBLE,
					&ctlData,
					APPCLASS,
					APPTITLE,
					0, NULLHANDLE,
					ID_APP,
					&hwndClient )) == NULLHANDLE )
			{
			printf("errorcode: %x\n",WinGetLastError(hab));
			break;
			}

		WinSetWindowPos(hwndFrame,NULLHANDLE,
				300,300,300,200,
				SWP_MOVE|SWP_SIZE);

		houtInit(hab,256);

		while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0))
			{
			WinDispatchMsg(hab, &qmsg);
			}

		houtClose();

		} while (FALSE);

	if (hmq != NULLHANDLE) WinDestroyMsgQueue(hmq);
	if (hab != NULLHANDLE) WinTerminate(hab);

	return 0;
}
void _Optlink threadmain( void * pv  )
{
  BOOL       bSuccess;
  HAB        hab;
  HMQ        hmq;
  QMSG       qmsg;
  PGLOBALS   pg;


  // cast and set the void pointer coming in
  pg = (PGLOBALS) pv;

  // thread initialization
  hab = WinInitialize( 0 );
  hmq = WinCreateMsgQueue( hab, 0 );

  bSuccess = WinRegisterClass( hab, OBJECTCLASSNAME, ObjectWinProc, 0, sizeof( PGLOBALS ) );
  pmassert( hab, bSuccess );

  // create a window where its parent is the PM object window
  pg->hwndObject = WinCreateWindow( HWND_OBJECT,       // parent
                                    OBJECTCLASSNAME,   // class name
                                    "",                // name
                                    0,                 // style
                                    0,                 // x,y
                                    0,
                                    0,                 // cx,cy
                                    0,
                                    HWND_OBJECT,       // owner
                                    HWND_BOTTOM,       // position behind this window (nop)
                                    0,                 // id
                                    (PVOID)pg,         // globals pointer as control data
                                    NULL );            // presparams
  pmassert( hab, pg->hwndObject );


  // WM_CREATE processing completed; application has completely initialized
  WinPostMsg( pg->hwndClient, WM_USER_ACK, (MPARAM)WM_CREATE, 0 );


  // dispatch messages; these messages will be mostly user-defined messages
  while( WinGetMsg ( hab, &qmsg, 0, 0, 0 ))  {
    WinDispatchMsg ( hab, &qmsg );
  }

  // wrap up
  WinDestroyWindow ( pg->hwndObject );
  WinDestroyMsgQueue ( hmq );
  WinTerminate ( hab );

  return;
}
Beispiel #29
0
static void CreateDummyWindow( void )
{
    ULONG     flCreate;
    HWND      frame;

    WinRegisterClass( HabDebugger, "Dummy", WinDefWindowProc, CS_SIZEREDRAW, 0 );
    flCreate = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX;
    frame = WinCreateStdWindow( HWND_DESKTOP, 0L, &flCreate, "Dummy",
                                "", 0L, NULLHANDLE, 99, &HwndDummy );
    if( frame == NULLHANDLE ) {
        HwndDummy = HwndDebugger;
    }
}
// ------------------------------------------------------------------------------------------------------------
int main( int argc, char **argv )
{
  HMQ           hmq;
  QMSG          qmsg;
  ULONG         ulWork;
  SWP           swp;
  LONG          cx;

  // initialize globals struct to defaults
  memset( &globals, 0, sizeof( globals ));
  strcpy( globals.szRexxFileName, "DRAW.CMD" );
  // parameter is a REXX filename
  if( argc > 1 ) {
    strcpy( globals.szRexxFileName, argv[ 1 ] );
  }
  // PM application init
  globals.hab = WinInitialize( 0 );
  hmq = WinCreateMsgQueue( globals.hab, 0);
  // create a frame window with listbox to display REXX diagnostic output
  ulWork = FCF_SYSMENU | FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_TASKLIST;
  globals.hwndOutputFrame = WinCreateStdWindow( HWND_DESKTOP, 0, &ulWork, WC_LISTBOX, OUTPUTCAPTION, LS_NOADJUSTPOS,
                                               (HMODULE)0, ID_RXDRAW, &globals.hwndOutputListbox );
  assert( globals.hwndOutputFrame   );
  assert( globals.hwndOutputListbox );
  // create a frame window to display REXX graphical output
  WinRegisterClass( globals.hab, CLASSNAME, (PFNWP)ClientWinProc, CS_SIZEREDRAW, 0 );
  ulWork = FCF_SYSMENU | FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX | FCF_MENU | FCF_ICON | FCF_TASKLIST;
  globals.hwndFrame = WinCreateStdWindow( HWND_DESKTOP, 0, &ulWork, CLASSNAME, CAPTION, 0,
                                         (HMODULE)0, ID_RXDRAW, &globals.hwndClient );
  assert( globals.hwndFrame  );
  assert( globals.hwndClient );
  // tile the two windows using shell's preferred placement for one
  WinQueryTaskSizePos( globals.hab, 0, &swp );
  cx = (swp.cx * 2) / 3;
  ulWork = SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_SHOW | SWP_ACTIVATE | SWP_RESTORE;
  WinSetWindowPos( globals.hwndOutputFrame, HWND_TOP, swp.x+cx, swp.y, swp.cx-cx, swp.cy, ulWork );
  WinSetWindowPos( globals.hwndFrame, HWND_TOP, swp.x, swp.y, cx, swp.cy, ulWork );
  // message loop
  while( WinGetMsg( globals.hab, &qmsg, 0, 0, 0 ))   WinDispatchMsg( globals.hab, &qmsg );
  if( !globals.fCloseMsgSent ) {
    // got a WM_QUIT without WM_CLOSE; must be shutdown or Close from Window List
    WinPostMsg( globals.hwndObject, WM_QUIT, 0, 0 );
  }
  // clean up
  WinDestroyWindow( globals.hwndFrame );
  WinDestroyWindow( globals.hwndOutputFrame );
  WinDestroyMsgQueue( hmq );
  WinTerminate( globals.hab );
  DosWaitThread( &globals.tidObject, DCWW_WAIT );
  return 0;
}