void CreateColumnWindows(void) { ULONG flCreateFlags; flCreateFlags = (FCF_NOBYTEALIGN); stWrite.hwnd = WinCreateStdWindow(hwndClient, 0L, // (WS_CLIPSIBLINGS | WS_PARENTCLIP | WS_SAVEBITS), &flCreateFlags, "WRITE COLUMN", NULL, // 0L, (WS_CLIPSIBLINGS | WS_PARENTCLIP | WS_SAVEBITS), (HMODULE)NULL, IDM_COMSCOPE, (HWND *)&stWrite.hwndClient); stRead.hwnd = WinCreateStdWindow(hwndClient, 0L, // (WS_CLIPSIBLINGS | WS_PARENTCLIP | WS_SAVEBITS), &flCreateFlags, "READ COLUMN", NULL, // 0L, (WS_CLIPSIBLINGS | WS_PARENTCLIP | WS_SAVEBITS), (HMODULE)NULL, IDM_COMSCOPE, (HWND *)&stRead.hwndClient); }
// ------------------------------------------------------------------------------------------------------------ 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; }
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); }
HWND CreateStdWindow(HWND hwndParent, ULONG flStyle, ULONG flCreateFlags, PSZ pszClientClass, PSZ pszTitle, ULONG styleClient, HMODULE hmod, ULONG idResources, PHWND phwndClient, LONG x, LONG y, LONG cx, LONG cy) { HWND hwndFrame; /* Frame Window Handle */ POINTL aptl[2]; /* Point Translation Array */ if ( !(hwndFrame = WinCreateStdWindow(hwndParent, flStyle, &flCreateFlags, pszClientClass, pszTitle, styleClient, hmod, idResources, phwndClient)) ) return((HWND)NULL); if ( !(flCreateFlags & FCF_SHELLPOSITION) ) { aptl[0].x = x; aptl[0].y = y; aptl[1].x = cx; aptl[1].y = cy; WinMapDlgPoints(HWND_DESKTOP, aptl, 2UL, TRUE); WinSetWindowPos(hwndFrame, HWND_TOP, aptl[0].x, aptl[0].y, aptl[1].x, aptl[1].y, SWP_ACTIVATE | SWP_SIZE | SWP_MOVE | (ULONG)((flStyle & WS_VISIBLE) ? SWP_SHOW : 0UL)); } /* Return back the window handle */ return(hwndFrame); }
static BOOL init_instance( int show ) { HWND frame_hwnd; ULONG flags = FCF_SIZEBORDER | FCF_TITLEBAR | FCF_SYSMENU | FCF_MENU | FCF_MINMAX | FCF_SHELLPOSITION; frame_hwnd = WinCreateStdWindow( HWND_DESKTOP, WS_VISIBLE, &flags, "DrawDemo", "Draw a Picture", WS_VISIBLE, 0, 200, &hwnd ); /* If window could not be created, return "failure" */ if( hwnd == 0 || frame_hwnd == 0 ) { return (FALSE); } /* Make the window visible; update its client area; and return "success" */ WinSetWindowPos( frame_hwnd, HWND_TOP, 50, 50, 200, 200, show ); make_buttons( hwnd ); WinShowWindow( frame_hwnd, TRUE ); WinUpdateWindow( frame_hwnd ); return( TRUE ); }
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; }
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 ; }
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); }
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 ; }
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 }
/* * _NewWindow - create a new window */ unsigned _NewWindow( char *name, ... ) { LPWDATA w; MENUITEM menus; HWND hwnd,frame,temp; char str[80]; int x1,x2,y1,y2; ULONG style; RECTL rcl; va_list al; _GetWindowNameAndCoords( name, str, &x1, &x2, &y1, &y2 ); style = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX | FCF_VERTSCROLL; frame = WinCreateStdWindow( _MainWindow, WS_VISIBLE | WS_CLIPSIBLINGS, &style, _ClassName, str, 0, NULL, 0, &hwnd ); if( frame == 0 ) return( FALSE ); WinSetOwner( hwnd, _MainWindow ); va_start( al, name ); w = _AnotherWindowData( hwnd, al ); w->frame = frame; w->text_color = CLR_WHITE; w->background_color = CLR_BLACK; WinSendMsg( frame, WM_SETICON, MPFROMLONG( WinQuerySysPointer( HWND_DESKTOP, SPTR_APPICON, TRUE ) ), 0 ); WinSetWindowBits( WinWindowFromID( w->frame, FID_VERTSCROLL ), QWL_STYLE, SBS_AUTOTRACK, SBS_AUTOTRACK ); _CreateFont( w ); _PositionScrollThumb( w ); WinQueryWindowRect( _MainWindow, &rcl ); WinSetWindowPos( frame, HWND_TOP, x1*w->xchar, (rcl.yTop - rcl.yBottom)-y1*w->ychar-y2*w->ychar, x2*w->xchar, y2*w->ychar, SWP_SIZE | SWP_MOVE | SWP_ZORDER ); menus.iPosition = _MainWindowData->window_count - 1; menus.afStyle = MIS_TEXT; menus.afAttribute = 0; menus.id = DID_WIND_STDIO + w->handles[0]; menus.hwndSubMenu = NULL; menus.hItem = 0; if ( MIT_ERROR == (BOOL)WinSendMsg( menuHandle, ( ULONG )MM_INSERTITEM, MPFROMP( &menus ), MPFROMP( str ) ) ) abort(); temp = WinWindowFromID( frame, FID_SYSMENU ); WinSendMsg( temp, MM_QUERYITEM, MPFROM2SHORT(SC_SYSMENU, TRUE), MPFROMP((PSZ)&menus) ); WinSendMsg( menus.hwndSubMenu, MM_DELETEITEM, MPFROM2SHORT( SC_CLOSE, TRUE ), 0 ); WinUpdateWindow( hwnd ); WinSetFocus( HWND_DESKTOP, hwnd ); return( TRUE ); } /* _NewWindow */
/****************************************************************\ * 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() */
int main(int argc, char **argv) { ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_HIDEBUTTON | FCF_SHELLPOSITION | FCF_TASKLIST; HAB hab; HMQ hmq; HWND Client; QMSG qmsg; arglist args; int python_tid; /* init PM and create message queue */ hab = WinInitialize(0); hmq = WinCreateMsgQueue(hab, 0); /* create a (hidden) Window to house the window procedure */ args.Frame = WinCreateStdWindow(HWND_DESKTOP, 0, &FrameFlags, NULL, "PythonPM", 0L, 0, 0, &Client); /* run Python interpreter in a thread */ args.argc = argc; args.argv = argv; args.running = 0; if (-1 == (python_tid = _beginthread(PythonThread, NULL, 1024 * 1024, &args))) { /* couldn't start thread */ WinAlarm(HWND_DESKTOP, WA_ERROR); PythonRC = 1; } else { /* process PM messages, until Python exits */ while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0)) WinDispatchMsg(hab, &qmsg); if (args.running > 0) DosKillThread(python_tid); } /* destroy window, shutdown message queue and PM */ WinDestroyWindow(args.Frame); WinDestroyMsgQueue(hmq); WinTerminate(hab); return PythonRC; }
/********************** 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 */ }
HWND CreateCanvas(HWND hParent, HWND *hwnd ) { static ULONG flFrameFlags = FCF_BORDER | FCF_HORZSCROLL | FCF_VERTSCROLL; return WinCreateStdWindow (hParent, WS_CLIPCHILDREN,&flFrameFlags, (PSZ)szCanvasClass,NULL, 0L,(HMODULE)0,0L, hwnd); }
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; }
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 EDITAPI EDITConnect( void ) /**************************************/ { ULONG style = 0; if( hwndDDE != NULLHANDLE ) return( TRUE ); hwndDDE = WinCreateStdWindow( HWND_DESKTOP, 0, &style, WC_FRAME, NULL, 0, NULLHANDLE, 0, NULL ); if( hwndDDE == NULLHANDLE ) { return( FALSE ); } prevClientProc = WinSubclassWindow( hwndDDE, (PFNWP)clientProc ); return( TRUE ); }
INT main(INT argc, CHAR *argv[ ]) { QMSG qmsg; /* PM Message Queue Holder */ ULONG flCreateFlags; /* Window Creation Flags */ /* Initialize the program for PM and create the */ /* message queue */ WinSetCp(hmqDriver = WinCreateMsgQueue(hAB = WinInitialize(0), 0), 850); /* Register the main program window class */ if ( !WinRegisterClass(hAB, pszDriverClassName, (PFNWP)DriverWndProc, CS_CLIPCHILDREN | CS_SYNCPAINT | CS_SIZEREDRAW, 0) ) return(1); /* Register the main program window class */ if ( !fRegisterListBox(hAB) ) return(1); /* Create the main program window but do not */ /* show it yet */ flCreateFlags = FCF_TITLEBAR | FCF_NOBYTEALIGN | FCF_SYSMENU | FCF_SIZEBORDER | FCF_SHELLPOSITION; if ( !(hwndDriverFrame = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE, &flCreateFlags, pszDriverClassName, NULL, 0L, (HMODULE)0L, 0L, &hwndDriver)) ) { return(1); } /* Retrieve and then dispatch messages */ while ( WinGetMsg(hAB, &qmsg, (HWND)NULL, 0, 0) ) WinDispatchMsg(hAB, &qmsg); WinDestroyWindow(hwndDriverFrame); WinDestroyMsgQueue(hmqDriver); /* Notify PM that main program thread not needed */ /* any longer */ WinTerminate(hAB); return(0); }
//-------------------------------------------------------------------------- // // main() procedure. // --> Initialize PM for this process // --> Create our message queue // --> Create frame and client windows // --> Show the window // --> Enter our message dispatching loop // // // -------------------------------------------------------------------------- void cdecl main(VOID) { HMQ hmq; HWND hwndclient; QMSG qmsg; ULONG flCreateFlags = FCF_BORDER | FCF_SHELLPOSITION | FCF_TASKLIST | FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX | FCF_MENU ; hab = WinInitialize( (USHORT)NULL ); hmq=WinCreateMsgQueue( hab,0 ); WinRegisterClass( hab , XFORM_CLASSNAME , (PFNWP)ClientWndProc , (ULONG)CS_SIZEREDRAW , (USHORT)256 ); hwndFrame = WinCreateStdWindow( HWND_DESKTOP , 0UL , &flCreateFlags , XFORM_CLASSNAME , "Xform - Model transform examples" , WS_VISIBLE , (HMODULE)0 , ID_PIN , &hwndclient ); WinShowWindow( hwndFrame, TRUE ); while ( WinGetMsg( hab,&qmsg, (HWND)0, 0, 0 ) ) { WinDispatchMsg( hab,&qmsg ); } if ( hwndFrame ) { WinDestroyWindow(hwndFrame); WinDestroyMsgQueue(hmq); WinTerminate(hab); } }
WEXPORT WClient::WClient( WObject *owner, cbc notify ) : _owner( owner ) , _notify( notify ) , _connected( false ) , _prevClientProc( NULL ) , _serverWindow( NULLHANDLE ) { /*************************************/ ULONG style = 0; _clientWindow = WinCreateStdWindow( HWND_DESKTOP, 0, &style, WC_FRAME, NULL, 0, NULLHANDLE, 0, NULL ); if( _clientWindow != NULLHANDLE ) { _prevClientProc = WinSubclassWindow( _clientWindow, (PFNWP)clientWindowProc ); WinSetWindowPtr( _clientWindow, 0, this ); } }
/************************************************************************** * * Name : InitMainWindow() * * Description: Creates the application window and puts it into * its initial state. * * Concepts : Called once by the Init() routine * - create main application window * - detach scrollbars from window * - subclass frame window procedure * * API's : WinCreateStdWindow * WinWindowFromID * WinSetParent * WinSendMsg * WinRegisterClass * WinSubclassWindow * * Parameters : [none] * * Return : TRUE - window successfully created * FALSE - window creation failed * *************************************************************************/ BOOL InitMainWindow(VOID) { ULONG ctlData = FCF_STANDARD | FCF_VERTSCROLL | FCF_HORZSCROLL; /* * Create a window with standard controls. */ vhwndFrame = WinCreateStdWindow( HWND_DESKTOP, WS_VISIBLE, (PULONG)&ctlData, (PSZ)szAppName, (PSZ)NULL, WS_VISIBLE, (HMODULE)NULL, IDR_MAIN, (PHWND)&vhwndClient); if (!vhwndFrame) return FALSE; /* * for the time being detach the scrollbars from the main * window - but remember their handles for later */ vhwndVScroll = WinWindowFromID(vhwndFrame, FID_VERTSCROLL); vhwndHScroll = WinWindowFromID(vhwndFrame, FID_HORZSCROLL); WinSetParent(vhwndVScroll, HWND_OBJECT, FALSE); WinSetParent(vhwndHScroll, HWND_OBJECT, FALSE); WinSendMsg(vhwndFrame, WM_UPDATEFRAME, MPFROMLONG(FCF_VERTSCROLL | FCF_HORZSCROLL), (MPARAM)NULL); /* save menubar handle */ vhwndMenu = WinWindowFromID(vhwndFrame, FID_MENU); /* * the frame window procedure is subclassed, so that frame-sizing * restrictions can be implemented. */ if (!WinRegisterClass(vhab, "SUBFRAME", (PFNWP)FrameWndProc, 0L, 0)) return FALSE; vpfnwpFrame = WinSubclassWindow(vhwndFrame, (PFNWP)FrameWndProc); return TRUE; } /* End of InitMainWindow() */
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; }
int main(void) { static ULONG flFrameFlags = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX | FCF_MENU | FCF_SHELLPOSITION | FCF_ACCELTABLE | FCF_TASKLIST; hab = WinInitialize(0L); hmq = WinCreateMsgQueue (hab,0L); WinRegisterClass (hab, (PSZ) szProgName, (PFNWP) ClientWndProc, CS_SIZEREDRAW|CS_CLIPCHILDREN,0L); hwndMain = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE, &flFrameFlags, szClientClass, "Drift Warpspeed", WS_VISIBLE, 0L,ID_RESOURCE, (PHWND) &hwndClient); // generate gonio tables generate_tables(); idTimer = WinStartTimer(hab,hwndClient,ID_TIMER,31); while (WinGetMsg(hab,&qmsg,NULLHANDLE,0,0)) { WinDispatchMsg(hab,&qmsg); } save_hiscores(); if (saveonexit) save_settings(); free_all(); free_demo(); WinStopTimer(hab,hwndClient,idTimer); //WinDestroyWindow(hwndMain); WinDestroyMsgQueue(hmq); WinTerminate(hab); return (0); }
/**************************************************************************** * main * * - Typical PM main skeleton. Creates object window for hiding frame * * controls. * * - No I/O * ****************************************************************************/ void main(void) { static ULONG flFrameFlags = FCF_SHELLPOSITION | FCF_SIZEBORDER | FCF_TASKLIST | FCF_MINMAX | FCF_TITLEBAR | FCF_SYSMENU | FCF_MENU | FCF_ACCELTABLE; QMSG qmsg; hab = WinInitialize(0); hmq = WinCreateMsgQueue(hab,0); WinRegisterClass(hab, szClientClass, (PFNWP) ClientWndProc, CS_SIZEREDRAW | CS_MOVENOTIFY, 0); hwndFrame = WinCreateStdWindow( HWND_DESKTOP, 0L, &flFrameFlags, szClientClass, szClientClass, 0L, NULLHANDLE, ID_RESOURCE, &hwndClient); /* If WM_CREATE did not fail, initialize and go into input loop */ if (hwndFrame != NULLHANDLE) { /* Create an object window to pass parenthood of frame controls * * to in order to hide them */ hwndObject = WinCreateWindow(HWND_OBJECT, WC_FRAME, (PUCHAR)" ", 0L, 0, 0, 0, 0, NULLHANDLE, HWND_TOP, ID_OBJECT, NULL, NULL); /* Save control window handles for use in Show-/Hide-FrameControls */ hwndTitleBar = WinWindowFromID(hwndFrame, FID_TITLEBAR); hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU); hwndMenu = WinWindowFromID(hwndFrame, FID_MENU); hwndMinMax = WinWindowFromID(hwndFrame, FID_MINMAX); Initialize(); while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0)) WinDispatchMsg(hab, &qmsg); } Shutdown(0L); }
int main (void) { static CHAR szClientClass [] = "Welcome" ; 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, // Anchor block handle szClientClass, // Name of class being registered ClientWndProc, // Window procedure for class 0L, // Class style 0) ; // Extra bytes to reserve hwndFrame = WinCreateStdWindow ( HWND_DESKTOP, // Parent window handle WS_VISIBLE, // Style of frame window &flFrameFlags, // Pointer to control data szClientClass, // Client window class name NULL, // Title bar text 0L, // Style of client window 0, // Module handle for resources 0, // ID of resources &hwndClient) ; // Pointer to client window handle while (WinGetMsg (hab, &qmsg, NULLHANDLE, 0, 0)) WinDispatchMsg (hab, &qmsg) ; WinDestroyWindow (hwndFrame) ; WinDestroyMsgQueue (hmq) ; WinTerminate (hab) ; return 0 ; }
INT main (VOID) { HMQ hMsgQ; /* Message queue handle */ QMSG qMsg; /* Message structure */ HWND hFrame; /* Frame window handle */ ULONG flCreate = FCF_STANDARD; /* Frame creation flags */ ULONG rc; /* Return code */ hAB = WinInitialize(0); /* Register application */ hMsgQ = WinCreateMsgQueue(hAB, 0); /* Create message queue */ rc = WinRegisterClass(hAB, /* Register window class */ (PSZ)"MyWindow", /* Class name */ (PFNWP)MyWindowProc, /* Window procedure address */ CS_SIZEREDRAW, /* Class style */ sizeof(PVOID)); /* Window words */ hFrame = WinCreateStdWindow(HWND_DESKTOP, /* Desktop is parent */ 0, /* Standard window style */ &flCreate, /* Frame control flags */ "MyWindow", /* Window class name */ "DragInfo", /* Window title text */ 0, /* No special class style */ (HMODULE)0L, /* Resources in EXE file */ ID_WINDOW, /* Frame window identifier */ NULL); /* No pres params */ while (WinGetMsg(hAB, &qMsg, 0L, 0, 0)) /* Process messages until */ WinDispatchMsg(hAB, &qMsg); /* WM_QUIT received */ WinDestroyWindow(hFrame); /* Destroy window */ WinDestroyMsgQueue(hMsgQ); /* Destroy message queue */ WinTerminate(hAB); /* Deregister application */ return (rc); }
INT main( int argc, char **argv ) { QMSG qmsg; /* Message from message queue */ ULONG flCreate; /* Window creation control flags*/ TID tid; ULONG height; ULONG width; DosExitList( EXLST_ADD, (PFNEXITLIST)CleanUp ); if( argc >= 3 ) { InStream = *argv[1] - ADJUST_HFILE; OutStream = *argv[2] - ADJUST_HFILE; } AbortIf( ( Hab = WinInitialize( 0 )) == 0L ); AbortIf( ( Hmq = WinCreateMsgQueue( Hab, 0 ) ) == 0L ); AbortIf( !WinRegisterClass( Hab, (PSZ)"MyWindow", (PFNWP)MyWindowProc, CS_SIZEREDRAW, 0 ) ); flCreate = FCF_TITLEBAR | FCF_MENU | FCF_SIZEBORDER | FCF_ACCELTABLE | FCF_SHELLPOSITION | FCF_TASKLIST; height = WinQuerySysValue( HWND_DESKTOP, SV_CYMENU ) + 2*WinQuerySysValue( HWND_DESKTOP, SV_CYBORDER ) + 2*WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER ) + WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ); AbortIf( ( hwndFrame = WinCreateStdWindow( HWND_DESKTOP, 0L, &flCreate, "MyWindow", "", 0L, 0, ID_WINDOW, &hwndClient ) ) == 0L ); WinSetWindowText( hwndFrame, TRP_The_WATCOM_Debugger ); width = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); AbortIf( !WinSetWindowPos( hwndFrame, HWND_TOP, 0, WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ) - height, width / 3, height, SWP_MOVE | SWP_SHOW | SWP_SIZE | SWP_ACTIVATE ) ); AbortIf( DosCreateThread( (PFNTHREAD)ServiceRequests, &tid, stack + STACK_SIZE ) ); while( WinGetMsg( Hab, &qmsg, 0L, 0, 0 ) ) { WinDispatchMsg( Hab, &qmsg ); } WinDestroyWindow(hwndFrame); WinDestroyMsgQueue( Hmq ); WinTerminate( Hab ); return( 1 ); }
int main (int argc, char *argv[]) { static ULONG flFrameFlags = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX | FCF_SHELLPOSITION | FCF_TASKLIST | FCF_MENU ; HMQ hmq ; HWND hwndFrame, hwndClient ; QMSG qmsg ; // Check for filename parameter and copy to szFileName if (argc > 1) ParseFileName (szFileName, argv [1]) ; // Continue normally 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, ID_RESOURCE, &hwndClient) ; if (hwndFrame != NULLHANDLE) { while (WinGetMsg (hab, &qmsg, NULLHANDLE, 0, 0)) WinDispatchMsg (hab, &qmsg) ; WinDestroyWindow (hwndFrame) ; } WinDestroyMsgQueue (hmq) ; WinTerminate (hab) ; return 0 ; }
FrameWindow::FrameWindow( AWindow *parent, STRING title, int x, int y, int width, int height ) : Window( x, y, width, height ) { oldWndProc = NULL; this->parent = parent; type = WINDOW; id = -1; char str[10]; HWND hWndParent = ((Window *)parent)->getHWND(); Application::tempthis = this; ULONG flCreate = FCF_STANDARD & // Set frame control flags ~FCF_SHELLPOSITION & ~FCF_ACCELTABLE | FCF_NOBYTEALIGN; flCreate = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_TASKLIST | FCF_MINBUTTON | FCF_MAXBUTTON; if( !WinRegisterClass( Application::hab, (PSZ)itoa( Iterator::getNext(), str, 10), WndProc, CS_SIZEREDRAW | CS_MOVENOTIFY | WS_CLIPCHILDREN, sizeof(Window *) ) ) { exit( 1 ); } hWndFrame = WinCreateStdWindow( HWND_DESKTOP/*hWndParent*/, 0L, &flCreate, (PSZ)str, title, 0L, NULLHANDLE, 1, &hWndClient ); if( hWndFrame == NULLHANDLE ) exit( 1 ); WinSetWindowPos( hWndFrame, HWND_TOP, x, y, width, height, SWP_MOVE | SWP_SIZE ); graphics = new Graphics( WinGetPS( hWndClient ) ); }