Exemple #1
0
MRESULT EXPENTRY wpCTTrack(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
{
	switch(msg)
	{
		case WM_CHAR:
		{
			SHORT fsflags = SHORT1FROMMP(mp1);
			SHORT usvkey = SHORT2FROMMP(mp2);
			if(fsflags & KC_KEYUP) break;

			if((fsflags & KC_SHIFT) && (usvkey == VK_F10))
			{
				RECORDCORE *record;
				record = searchRecords(hwnd, 0, (RECORDCORE *) CMA_FIRST, CRA_SELECTED);

				processPopUp(WinQueryWindow(hwnd, QW_PARENT), WinQueryWindowUShort(hwnd,QWS_ID),
					record, PUM_CDRECORD, PUM_CDCONTAINER, &sourceEmphasisInfo);

				WinSendMsg(sourceEmphasisInfo.PUMHwnd, MM_SETITEMATTR,
					MPFROM2SHORT(IDM_MINIICONS, FALSE),
					MPFROM2SHORT(MIA_CHECKED, miniIcons ? MIA_CHECKED : 0));
				return 0;
			}

			else if((fsflags & KC_SHIFT) && (usvkey == VK_F9))
			{
				CNREDITDATA editdata;
				CNRINFO cnrInfo;

				WinSendMsg(hwnd,CM_QUERYCNRINFO, MPFROMP(&cnrInfo),MPFROMLONG(sizeof(cnrInfo)));

				editdata.cb = sizeof(editdata);
				editdata.hwndCnr = hwnd;
				editdata.pRecord = searchRecords(hwnd, 0, (RECORDCORE *) CMA_FIRST, CRA_CURSORED);
				editdata.ppszText = NULL;
				editdata.cbText = 0;

				if(cnrInfo.flWindowAttr & CV_DETAIL)
				{
					editdata.pFieldInfo = (FIELDINFO*) WinSendMsg(hwnd, CM_QUERYDETAILFIELDINFO, MPFROMP(NULL), MPFROMSHORT(CMA_FIRST));
					editdata.pFieldInfo = (FIELDINFO*) WinSendMsg(hwnd, CM_QUERYDETAILFIELDINFO, MPFROMP(editdata.pFieldInfo), MPFROMSHORT(CMA_NEXT));
					editdata.id = CID_LEFTDVWND;
				}
				else
				{
					editdata.pFieldInfo = NULL;
					editdata.id = WinQueryWindowUShort(hwnd,QWS_ID);
				}

				WinSendMsg(hwnd,CM_OPENEDIT,MPFROMP(&editdata),0);

				return 0;
			}

			break;
		}
	}

	return wpCT( hwnd, msg, mp1, mp2 );
}
static MRESULT EXPENTRY AttribSelectProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
   PATTRIBSELECTDATA pWinData = WinQueryWindowPtr(hwnd, QWL_USER);

   switch(msg)
   {
      case WM_CREATE:
         return (MRESULT) CreateWindow(hwnd, (PCREATESTRUCT) mp2);

      case WM_DESTROY:
         DestroyWindow(pWinData);
         break;

      case WM_HELP:
         /* Weiterleiten mit eigener ID */
         mp1 = MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID));
         break;

      case ATTSM_SETATTRIB:
         return (MRESULT) SetAttrib(hwnd, pWinData, (ULONG) mp1, (ULONG) mp2);

      case ATTSM_QUERYATTRIB:
         return (MRESULT) QueryAttrib(pWinData);

      case WM_CONTROL:
         if (SHORT1FROMMP(mp1) == ATTSID_VALUE)
         {
            switch(SHORT2FROMMP(mp1))
            {
               case VN_ENTER:
                  AttribClicked(hwnd, pWinData, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
                  break;

               case VN_HELP:
#if 0
                  WinPostMsg(WinQueryWindow(hwnd, QW_OWNER), WM_HELP,
                             MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                             mp2);
#endif
                  break;
            }
         }
         break;

      case WM_DRAWITEM:
         if (SHORT1FROMMP(mp1) == ATTSID_VALUE)
            return (MRESULT) DrawItem(pWinData, (POWNERITEM) mp2);
         else
            break;

      case WM_QUERYDLGCODE:
         return WinSendMsg(pWinData->hwndValueSet, msg, mp1, mp2);

      default:
         break;
   }
   return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
MRESULT _System DrvMountDrivesDlg( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 
{
    if (msg == WM_TIMER && mp1 == (MP)CAM_LVMTMR) {
        HEV  hev = WinQueryWindowULong( hwnd, QWL_USER);

        if (!WinWaitEventSem( hev, 0))
            WinSendMsg( hwnd, WM_COMMAND, (MP)CAM_LVMTMR, 0);
        return (0);
    }

    if (msg == WM_COMMAND || msg == WM_SYSCOMMAND) {
        ULONG   ulChk;

        if (!WinStopTimer( 0, hwnd, CAM_LVMTMR))
            printf( "DrvMountDrivesDlg - WinStopTimer\n");

        ulChk = (ULONG)WinSendDlgItemMsg( hwnd, IDC_AUTOMOUNT,
                                          BM_QUERYCHECK, 0, 0);
        DrvSetUseLvm( WinQueryWindow( hwnd, QW_OWNER), ulChk);

        WindowClosed( WinQueryWindowUShort( hwnd, QWS_ID));
        WinDismissDlg( hwnd, (mp1 == (MP)CAM_LVMTMR));
        return (0);
    }

    if (msg == WM_INITDLG) {
        HEV  hev = (HEV)mp2;

        WinSetWindowULong( hwnd, QWL_USER, hev);
        LoadDlgStrings( hwnd, nlsMountDlg);
        WinSendDlgItemMsg( hwnd, IDC_AUTOMOUNT, BM_SETCHECK,
                           (MP)(CAMDRV_IS_NOLVM ? 0 : 1), 0);
        ShowDialog( hwnd, 0);

        if (!WinWaitEventSem( hev, 0)) {
            WindowClosed( WinQueryWindowUShort( hwnd, QWS_ID));
            WinDismissDlg( hwnd, TRUE);
        }
        else
            if (!WinStartTimer( 0, hwnd, CAM_LVMTMR, 250))
                printf( "DrvMountDrivesDlg - WinStartTimer\n");
        return (0);
    }

    if (msg == WM_FOCUSCHANGE) {
        if (SHORT1FROMMP(mp2) && !WinIsWindowEnabled( hwnd)) {
            WinPostMsg( WinQueryWindow( hwnd, QW_OWNER),
                        CAMMSG_FOCUSCHANGE, 0, 0);
            return (0);
        }
    }

    return (WinDefDlgProc( hwnd, msg, mp1, mp2));
}
extern MRESULT EXPENTRY Button_Processor ( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) {

   static PWINDOWPROC DefaultProcessor = 0 ;

   switch ( msg ) {

      case WM_CREATE: {
         CLASSINFO ClassInfo ;
         WinQueryClassInfo ( WinQueryAnchorBlock(hwnd), WC_BUTTON, &ClassInfo ) ;
         DefaultProcessor = ClassInfo.pfnWindowProc ;
         break; }

      case WM_SETFOCUS: {
         USHORT Id = WinQueryWindowUShort ( hwnd, QWS_ID ) ;
         if ( mp2 ) {
            Sys_SendMessage( hwnd, BM_SETDEFAULT, MPFROMSHORT(TRUE), 0 ) ;
            Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,BN_SETFOCUS), 0 ) ;
         } else {
            Sys_SendMessage( hwnd, BM_SETDEFAULT, MPFROMSHORT(FALSE), 0 ) ;
            Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,BN_KILLFOCUS), 0 ) ;
         } /* endif */
         break; }

   } /* endswitch */

   return ( DefaultProcessor ? DefaultProcessor ( hwnd, msg, mp1, mp2 ) : 0 ) ;
}
Exemple #5
0
void notify( HWND hwnd, USHORT notifyCode, MPARAM mp2 )
{
    HWND hwndOwner = WinQueryWindow( hwnd, QW_OWNER );
    HWND usId = WinQueryWindowUShort( hwnd, QWS_ID );

    WinPostMsg( hwndOwner, WM_CONTROL, MPFROM2SHORT( usId, notifyCode ), mp2 );
}
MRESULT APIENTRY wpDlg (
    HWND hwnd,
    MSG_TYPE msg,
    MPARAM mp1,
    MPARAM mp2)
{ /* wpDlg Start */
    MRESULT Result = 0;

    switch (msg)
    { /* switch (msg) START */
    case WM_INITDLG:
        { /* WM_INITDLG Start */
            HWND hwndMenu;
            ULONG id;

            /* load the menu, since currently it seems to be impossible
            ** to get the menu otherwise during startup of the dialog
            */
            id = WinQueryWindowUShort (hwnd, (ULONG) QWS_ID);
            hwndMenu = WinLoadMenu (hwnd, (HMODULE) 0, id);
        } /* WM_INITDLG End */
        break;

    case WM_COMMAND:
        { /* WM_COMMAND Start */
            switch (LOUSHORT(mp1))
            {
            case ID_MENU_1:
                {
                    WinAlarm (HWND_DESKTOP, (ULONG) WA_ERROR);
                    WinAlarm (HWND_DESKTOP, (ULONG) WA_NOTE);
                    WinAlarm (HWND_DESKTOP, (ULONG) WA_ERROR);
                    WinAlarm (HWND_DESKTOP, (ULONG) WA_NOTE);
                }
                break;

            case DID_OK:
                { /* do anything... */
                }
                break;

            default:
                Result = WinDefDlgProc ( hwnd, msg, mp1, mp2 );
                break;
            }
        } /* WM_COMMAND End */
        break;

    case WM_CLOSE:
    default:
        /* any other message will be handled here,
        ** also the button problem...
        */
        Result = WinDefDlgProc ( hwnd, msg, mp1, mp2 );
        break;
    } /* switch (msg) END */

    return (Result);
} /* wpDlg End */
extern MRESULT EXPENTRY ComboBox_Processor ( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) {

   static PWINDOWPROC DefaultProcessor = 0 ;

   switch ( msg ) {

      case WM_CREATE: {
         CLASSINFO ClassInfo ;
         WinQueryClassInfo ( WinQueryAnchorBlock(hwnd), WC_COMBOBOX, &ClassInfo ) ;
         DefaultProcessor = ClassInfo.pfnWindowProc ;
         MRESULT Result = DefaultProcessor ( hwnd, msg, mp1, mp2 ) ;
         HWND Entryfield = WinWindowFromID ( hwnd, CBID_EDIT ) ;
         ULONG Style = WinQueryWindowULong ( hwnd, QWL_STYLE ) ;
         if ( Style & CBS_DROPDOWNLIST ) {
            OldComboEntry_Processor1 = WinSubclassWindow ( Entryfield, ComboEntry_Processor1 ) ;
         } else {
            OldComboEntry_Processor2 = WinSubclassWindow ( Entryfield, ComboEntry_Processor2 ) ;
         } /* endif */
         return ( Result ) ; }

      case WM_CONTROL: {
         USHORT Id = WinQueryWindowUShort ( hwnd, QWS_ID ) ;
         SHORT Control = SHORT1FROMMP ( mp1 ) ;
         SHORT Message = SHORT2FROMMP ( mp1 ) ;
         switch ( Control ) {
            case CBID_EDIT: {
               switch ( Message ) {
                  case EN_SETFOCUS: {
                     Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,CBN_SETFOCUS), 0 ) ;
                     break; }
                  case EN_KILLFOCUS: {
                     Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,CBN_KILLFOCUS), 0 ) ;
                     break; }
               } /* endswitch */
               break; }
            case CBID_LIST: {
               switch ( Message ) {
                  case LN_SETFOCUS: {
                     Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,CBN_SETFOCUS), 0 ) ;
                     break; }
                  case LN_KILLFOCUS: {
                     Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,CBN_KILLFOCUS), 0 ) ;
                     break; }
               } /* endswitch */
               break; }
         } /* endswitch */
         break; }

      case WM_MEASUREITEM:
         return ( Sys_SendMessage( OWNER(hwnd), msg, mp1, mp2 ) ) ;

      case WM_DRAWITEM: 
         return ( Sys_SendMessage( OWNER(hwnd), msg, mp1, mp2 ) ) ;

   } /* endswitch */

   return ( DefaultProcessor ? DefaultProcessor ( hwnd, msg, mp1, mp2 ) : 0 ) ;
}
MRESULT hia_wmCreate(HWND hwnd,MPARAM mp1,MPARAM mp2)
{
HIA *hia = NULL;
HIABuf  *hiabuf = NULL;
HIANotifWnd *notifList = NULL;
ULONG notifListAllocSize = HIA_NOTIFLIST_DEFAULT_SIZE;
HWND    hwndOwner = WinQueryWindow(hwnd,QW_OWNER);
USHORT  Id      = WinQueryWindowUShort(hwnd,QWS_ID);
int i;

    if (DosAllocMem((PPVOID)&hiabuf,sizeof(HIABuf),fALLOC))
        return MRFROMLONG(TRUE);
#ifdef DEBUG
    assert(hiabuf!=NULL);
#endif
    HIABufClear(hiabuf);

    if (DosAllocMem((PPVOID)&notifList,sizeof(HIANotifWnd)*notifListAllocSize,fALLOC))
        return MRFROMLONG(TRUE);
#ifdef DEBUG
    assert(notifList!=NULL);
#endif
    for (i=0;i<notifListAllocSize;i++)
        {
        notifList[i].hwnd = NULLHANDLE;
        notifList[i].id = 0;
        }

    if (DosAllocMem((PPVOID)&hia,sizeof(HIA),fALLOC))
        return MRFROMLONG(TRUE);
#ifdef DEBUG
    assert(hia!=NULL);
#endif

    hia->hwndHIA = hwnd;
    hia->inbuf = hiabuf;
    hia->kbdtype = HAN_KBD_2;
    hia->hanmode = HCH_ENG;
    hia->insertmode = HAN_INSERT;
    hia->hcode = HCH_JSY;

    hia->isHanjaKey = hia_defaultHanjaKey;
    hia->isSpecialCharKey = hia_defaultSpecialCharKey;

    hia->notifListAllocSize = notifListAllocSize;
    hia->notifList = notifList;
    hia->notifList[0].hwnd = hwndOwner;
    hia->notifList[0].id = Id;
    hia->responseTo = &(hia->notifList[0]);
    hia->hwndHCHLB = NULLHANDLE;
    hia->fRunningHCHLB = FALSE;
    hia->scselIndex = 0;

    if (!WinSetWindowPtr(hwnd,WINWORD_INSTANCE,(PVOID)hia))
        return MRFROMLONG(TRUE);

    return 0L;
}
/*--------------------------------------------------
 * Constructs the object from window handle
 *--------------------------------------------------*/
PMWindow::PMWindow( HWND window_handle )

: win_handle ( window_handle ),
  win_wrapper( TRUE          ),

  win_default_handler(0)
{
  if( win_handle )
    win_id = WinQueryWindowUShort( win_handle, QWS_ID );
}
BOOL mwpLoad(HWND hWnd)
{
   ULONG          ulError = 0;
   MCI_LOAD_PARMS mciLoadParms;
   PSTRINGLIST    pEntry = (PSTRINGLIST)WinQueryWindowPtr(hWnd, QWP_CURRENTENTRY);
   USHORT         usDeviceID = WinQueryWindowUShort(hWnd, QWS_DEVICEID);
   BOOL           fSuccess = TRUE;

   WinSetPBValue(WinWindowFromID(hWnd, PB_PROGRESS), 0);

   memset((void*)&mciLoadParms, 0, sizeof(MCI_LOAD_PARMS));

   mciLoadParms.pszElementName = pEntry->pszString;
   ulError = mciSendCommand(usDeviceID, MCI_LOAD, MCI_WAIT | MCI_OPEN_ELEMENT | MCI_READONLY, (PVOID)&mciLoadParms, (USHORT)0);
   if(LOUSHORT(ulError) != MCIERR_SUCCESS)
      fSuccess = FALSE;

   if(fSuccess)
   {
      MCI_STATUS_PARMS   msp;

      memset((void*)&msp, 0, sizeof(msp));

      msp.ulItem = MCI_STATUS_LENGTH;

      ulError = mciSendCommand(usDeviceID, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, (PVOID)&msp, (USHORT)0);
      if(LOUSHORT(ulError) == MCIERR_SUCCESS)
      {
         WinSetPBLimits(WinWindowFromID(hWnd, PB_PROGRESS), 0, msp.ulReturn);
      }
   }

   if(fSuccess)
   {
      MCI_POSITION_PARMS mppPos;

      memset((void*)&mppPos, 0, sizeof(mppPos));

      mppPos.hwndCallback = hWnd;
      mppPos.ulUnits = MSECTOMM(500);
      ulError = mciSendCommand(usDeviceID, MCI_SET_POSITION_ADVISE, MCI_NOTIFY | MCI_SET_POSITION_ADVISE_ON, (PVOID)&mppPos, (USHORT)0);
      if(LOUSHORT(ulError) != MCIERR_SUCCESS)
         fSuccess = FALSE;
   }

   if(fSuccess)
   {
      PSZ   pszTitle = new char[128];
      MakeWndTitleFromPathName(pszTitle, pEntry->pszString);
      WinSetWindowText(WinQueryWindow(hWnd, QW_PARENT), pszTitle);
      delete pszTitle;
   }

   return fSuccess;
}
Exemple #11
0
 /* ##END User defined messages */
   default :
     HandleMessage(hwndFrame, hwndDlg, msg, mp1, mp2);
     return WinDefDlgProc(hwndDlg,msg,mp1,mp2);
   } /* end switch for main msg dispatch */
   return (MRESULT)FALSE;
} /* end dialog procedure */
HWND OpenO_CONFIG(HWND hwndOwner, PVOID pInfo)
{
   HWND hwndFrame;
   if (WinQueryWindowUShort(hwndOwner, QWS_ID) == FID_CLIENT)
      hwndOwner = WinQueryWindow(hwndOwner, QW_PARENT);
   hwndFrame =(HWND) WinLoadDlg(hwndOwner,
           hwndOwner,   
           O_CONFIGDlgProc, 
           0, ID_O_CONFIGFORM, 
           pInfo); 
   return hwndFrame;
}
 /* ##END User defined messages */
   default :
     HandleMessage(hwndFrame, hwndDlg, msg, mp1, mp2);
     return WinDefDlgProc(hwndDlg,msg,mp1,mp2);
   } /* end switch for main msg dispatch */
   return (MRESULT)FALSE;
} /* end dialog procedure */
HWND OpenSETTINGS(HWND hwndOwner, PVOID pInfo)
{
   HWND hwndFrame;
   if (WinQueryWindowUShort(hwndOwner, QWS_ID) == FID_CLIENT)
      hwndOwner = WinQueryWindow(hwndOwner, QW_PARENT);
   hwndFrame =(HWND) WinLoadDlg(HWND_DESKTOP,
           hwndOwner,   
           SETTINGSDlgProc, 
           0, ID_SETTINGSFORM, 
           pInfo); 
   WinShowWindow(hwndFrame, TRUE);
   return hwndFrame;
}
/* Return the ID of the selected radiobutton in a group. */
SHORT rb_selected(HWND hwnd, SHORT id)
{
  HWND cur = WinWindowFromID(hwnd, id);
  HWND first = cur;
  HWND prev = cur; // Work around for PM bug
  PMASSERT(cur);
  cur = WinEnumDlgItem(hwnd, cur, EDI_FIRSTGROUPITEM);
  do
  { if (WinSendMsg(cur, BM_QUERYCHECK, 0, 0))
      return WinQueryWindowUShort(cur, QWS_ID);
    prev = cur;
    cur = WinEnumDlgItem(hwnd, cur, EDI_NEXTGROUPITEM);
  } while (cur != first && cur != prev);
  return -1;
}
Exemple #14
0
/*
 *   Modified by Chris Wohlgemuth 2001 for use with CandyFolder
 */
BOOL winhAssertWarp4Notebook(HWND hwndDlg,
                    USHORT usIdThreshold,    // in: ID threshold
                    ULONG ulDownUnits)       // in: dialog units or 0
{
    BOOL brc = FALSE;
    POINTL ptl;
    HAB hab = WinQueryAnchorBlock(hwndDlg);
    BOOL    fIsVisible = WinIsWindowVisible(hwndDlg);
    if (ulDownUnits) {
        ptl.x = 0;
        ptl.y = ulDownUnits;
        WinMapDlgPoints(hwndDlg, &ptl, 1, TRUE);
    }

    WinEnableWindowUpdate(hwndDlg, FALSE);

    if (cwQueryOSRelease()>=40) {
        HENUM henum = WinBeginEnumWindows(hwndDlg);
        HWND hwndItem;
        while ((hwndItem = WinGetNextWindow(henum))!=NULLHANDLE) {
            USHORT usId = WinQueryWindowUShort(hwndItem, QWS_ID);

            if (usId <= usIdThreshold) {
                // pushbutton to change:
              WinSetWindowBits(hwndItem, QWL_STYLE,
                        BS_NOTEBOOKBUTTON, BS_NOTEBOOKBUTTON);
                brc = TRUE;
            } else
                // no pushbutton to change: move downwards
                // if desired
                if (ulDownUnits)
                {
                    SWP swp;

                    WinQueryWindowPos(hwndItem, &swp);
                    WinSetWindowPos(hwndItem, 0,
                        swp.x,
                        swp.y - ptl.y,
                        0, 0,
                        SWP_MOVE);
                }
        }
        WinEndEnumWindows(henum);
    }
    if (fIsVisible)
        WinShowWindow(hwndDlg, TRUE);
    return (brc);
}
BOOL mwpPlay(HWND hWnd)
{
   ULONG          ulError = 0;
   MCI_PLAY_PARMS mciPlayParms;
   USHORT         usDeviceID = WinQueryWindowUShort(hWnd, QWS_DEVICEID);
   BOOL           fSuccess = TRUE;

   memset((void*)&mciPlayParms, 0, sizeof(mciPlayParms));

   mciPlayParms.hwndCallback = hWnd;
   ulError = mciSendCommand(usDeviceID, MCI_PLAY, MCI_NOTIFY, (PVOID)&mciPlayParms, MMUP_PLAY);
   if(LOUSHORT(ulError) != MCIERR_SUCCESS)
      fSuccess = FALSE;

   return fSuccess;
}
MRESULT _System DrvEjectAllDlg( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 
{
    switch (msg) {

        case WM_INITDLG:
            DrvInitEjectAllDlg( hwnd, mp2);
            return (0);

        case WM_SAVEAPPLICATION:
            WinStoreWindowPos( CAMINI_APP, CAMINI_EJECTPOS, hwnd);
            return (0);

        case WM_SYSCOMMAND:
            if (SHORT1FROMMP( mp1) == SC_CLOSE)
                return (WinSendMsg( hwnd, WM_COMMAND, (MP)IDC_NO, 0));
            break;

        case WM_COMMAND:
            if (mp1 == (MP)IDC_YES) {
                WinEnableWindow( WinWindowFromID( hwnd, IDC_YES), FALSE);
                WinEnableWindow( WinWindowFromID( hwnd, IDC_NO), FALSE);
                LoadDlgItemString( hwnd, IDC_TEXT1, MSG_Ejecting);
                LoadDlgItemString( hwnd, IDC_TEXT4, MSG_ThisMayTake);
                DrvEjectAllDrives( hwnd);
            }
            WindowClosed( WinQueryWindowUShort( hwnd, QWS_ID));
            WinDestroyWindow( hwnd);
            return (0);

        case WM_FOCUSCHANGE:
            if (SHORT1FROMMP(mp2) && !WinIsWindowEnabled( hwnd)) {
                WinPostMsg( WinQueryWindow( hwnd, QW_OWNER),
                            CAMMSG_FOCUSCHANGE, 0, 0);
                return (0);
            }
            break;

        case WM_DESTROY:
            WinPostMsg( WinQueryWindow( hwnd, QW_OWNER), CAMMSG_EXIT,
                        (MP)TRUE, 0);
            break;

    }

    return (WinDefDlgProc( hwnd, msg, mp1, mp2));
}
static MRESULT EXPENTRY ComboEntry_Processor1 ( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) {

   switch ( msg ) {

      case WM_SETFOCUS: {
         USHORT Id = WinQueryWindowUShort ( hwnd, QWS_ID ) ;
         if ( mp2 ) {
            Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,EN_SETFOCUS), 0 ) ;
         } else {
            Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,EN_KILLFOCUS), 0 ) ;
         } /* endif */
         break; }

   } /* endswitch */

   return ( OldComboEntry_Processor1 ( hwnd, msg, mp1, mp2 ) ) ;
}
//************************************************************************************************
// The not so mighty ShutdownThread
//************************************************************************************************
void _Optlink ShutdownThread(void *pArg)
{
   HWND           hWnd = (HWND)pArg;
   AnchorBlock    ab;
   MessageQueue   mq(ab);

   ULONG            ulError = 0;
   MCI_STATUS_PARMS msp;
   MCI_GENERIC_PARMS mciGenericParms;
   USHORT           usDeviceID = WinQueryWindowUShort(hWnd, QWS_DEVICEID);

   //*********************************************************************************************
   // Set the lowest posible priority to make us systemfriendly
   //*********************************************************************************************
   DosSetPriority(PRTYS_THREAD, PRTYC_IDLETIME, PRTYD_MINIMUM, 0);


   //*********************************************************************************************
   // Store windowpositoin
   //*********************************************************************************************
   SWP   swp;
   WinQueryWindowPos(WinQueryWindow(hWnd, QW_PARENT), &swp);
   PrfWriteProfileData(HINI_USERPROFILE, "WavePlayer", "WindowPosition", (PVOID)&swp, sizeof(swp));

   memset((void*)&msp, 0, sizeof(msp));

   msp.ulItem = MCI_STATUS_MODE;
   ulError = mciSendCommand(usDeviceID, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, (PVOID)&msp, (USHORT)0);

   mciGenericParms.hwndCallback = NULL;

   if(msp.ulReturn == MCI_MODE_PLAY)
      mciSendCommand(usDeviceID, MCI_STOP, MCI_WAIT, (PVOID)&mciGenericParms, NULL);

   mciSendCommand(usDeviceID, MCI_CLOSE, MCI_WAIT, (PVOID)&mciGenericParms, (USHORT)0);

   plNuke(hWnd);

   WinPostMsg(hWnd, WM_QUIT, NULL, NULL);

   _endthread();
}
static void AttribClicked(HWND hwnd, PATTRIBSELECTDATA pWinData, SHORT Row, SHORT Col)
{
   ULONG ulMask;

   ulMask = (Row-1)*8 + (Col-1);
   ulMask = 1UL << ulMask;

   if (pWinData->ulAttribMask & ulMask)
   {
      pWinData->ulAttrib ^= ulMask;

      WinInvalidateRect(hwnd, NULL, TRUE);
   #if 0
      WinSendMsg(WinQueryWindow(hwnd, QW_OWNER), WM_CONTROL,
                 MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID),
                              ATTSN_ATTRIBCHANGED),
                 MPFROMLONG(pWinData->ulAttrib));
   #endif
   }
   return;
}
void        DrvInitEjectAllDlg( HWND hwnd, MPARAM mp2)

{
    SHORT       ndx;
    HWND        hList;
    ULONG       ctr;
    ULONG       cntDrives = 0;
    char        achDrives[CAM_MAXMSD+1];
    char        szText[256];

    cntDrives = DrvMapDrives( achDrives);
    if (cntDrives)
        cntDrives = DrvValidateDrives( achDrives, cntDrives);

    if (!cntDrives) {
        WindowClosed( WinQueryWindowUShort( hwnd, QWS_ID));
        WinDestroyWindow( hwnd);
        return;
    }

    LoadDlgStrings( hwnd, nlsEjectAllDlg);
    hList = WinWindowFromID( hwnd, IDC_CAMLIST);

    for (ctr = 0; ctr < CAM_MAXMSD && achDrives[ctr]; ctr++) {
        DrvGetDriveName( achDrives[ctr], szText);

        ndx = SHORT1FROMMR( WinSendMsg( hList, LM_INSERTITEM,
                                        (MP)LIT_END, (MP)szText));
        WinSendMsg( hList, LM_SETITEMHANDLE, MPFROM2SHORT( ndx, 0),
                    MPFROM2SHORT( achDrives[ctr], 0));
        WinSendMsg( hList, LM_SELECTITEM, MPFROM2SHORT( ndx, 0), (MP)TRUE);
    }

    ShowDialog( hwnd, CAMINI_EJECTPOS);

    if (CAMDRV_IS_ALWAYSEJECT)
        WinPostMsg( hwnd, WM_COMMAND, (MP)IDC_YES, 0);

    return;
}
 /* ##END User defined messages */
   default :
     HandleMessage(hwndFrame, hwndDlg, msg, mp1, mp2);
     return WinDefDlgProc(hwndDlg,msg,mp1,mp2);
   } /* end switch for main msg dispatch */
   return (MRESULT)FALSE;
} /* end dialog procedure */
HWND OpenVIEWMR(HWND hwndOwner, PVOID pInfo)
{
   HWND hwndFrame;
   HWND hwndClient;
   FRAMECDATA frameData;
   frameData.cb=sizeof(FRAMECDATA);
   frameData.flCreateFlags= FCF_NOBYTEALIGN | FCF_SIZEBORDER | FCF_TITLEBAR | FCF_SYSMENU | FCF_TASKLIST | FCF_MAXBUTTON | FCF_MINBUTTON | FCF_ICON ;
   frameData.hmodResources=0;
   frameData.idResources=ID_VIEWMRFORM;
   if (WinQueryWindowUShort(hwndOwner, QWS_ID) == FID_CLIENT)
      hwndOwner = WinQueryWindow(hwndOwner, QW_PARENT);
   hwndFrame=WinCreateWindow(HWND_DESKTOP, WC_FRAME, "", 0,0,0,0,0,hwndOwner,HWND_TOP,ID_VIEWMRFORM,&frameData,0);
   if (hwndFrame) {
      hwndClient =(HWND) WinLoadDlg(hwndFrame,
              hwndFrame,   
              VIEWMRDlgProc, 
              0, ID_VIEWMRFORM, 
              pInfo); 
      WinShowWindow(hwndFrame, TRUE);
   }
   return hwndFrame;
}
Exemple #22
0
MRESULT EXPENTRY DirDialogProc( HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
{
   switch ( msg ) {
      case WM_INITDLG:
         {
         SWP swpFileST;
         SWP swpDirST;
         SWP swpDirLB;
         SWP swpDriveST;
         SWP swpDriveCB;
         SWP swpDriveCBEF;
         SWP swpOK;
         SWP swpCancel;
         HWND hwndFileST;
         HWND hwndDirST;
         HWND hwndDirLB;
         HWND hwndDriveST;
         HWND hwndDriveCB;
         HWND hwndOK;
         HWND hwndCancel;
         HENUM henum;
         HWND hwndNext;
         ULONG ulCurY, ulCurX;
         LONG lScreenX, lScreenY, lDlgFrameX, lDlgFrameY, lTitleBarY;

         lScreenX = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
         lScreenY = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
         lDlgFrameX = WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME);
         lDlgFrameY = WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME);
         lTitleBarY = WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);

         hwndFileST = WinWindowFromID(hwndDlg, DID_FILENAME_TXT);
         hwndDirST = WinWindowFromID(hwndDlg, DID_DIRECTORY_TXT);
         hwndDirLB = WinWindowFromID(hwndDlg, DID_DIRECTORY_LB);
         hwndDriveST = WinWindowFromID(hwndDlg, DID_DRIVE_TXT);
         hwndDriveCB = WinWindowFromID(hwndDlg, DID_DRIVE_CB);
         hwndOK = WinWindowFromID(hwndDlg, DID_OK);
         hwndCancel = WinWindowFromID(hwndDlg, DID_CANCEL);
         
#define SPACING 10
         // Reposition drives combobox
         ulCurY = SPACING;
         ulCurX = SPACING + lDlgFrameX;
         WinQueryWindowPos(hwndOK, &swpOK);
         WinSetWindowPos(hwndOK, 0, ulCurX, ulCurY, 0, 0, SWP_MOVE);
         ulCurY += swpOK.cy + SPACING;
         WinQueryWindowPos(hwndCancel, &swpCancel);
         WinSetWindowPos(hwndCancel, 0, ulCurX+swpOK.cx+10, SPACING, 0, 0, SWP_MOVE);
         WinQueryWindowPos(hwndDirLB, &swpDirLB);
         WinSetWindowPos(hwndDirLB, 0, ulCurX, ulCurY, swpDirLB.cx, swpDirLB.cy, SWP_MOVE | SWP_SIZE);
         ulCurY += swpDirLB.cy + SPACING;
         WinQueryWindowPos(hwndDirST, &swpDirST);
         WinSetWindowPos(hwndDirST, 0, ulCurX, ulCurY, swpDirST.cx, swpDirST.cy, SWP_MOVE | SWP_SIZE);
         ulCurY += swpDirST.cy + SPACING;
         WinQueryWindowPos(hwndDriveCB, &swpDriveCB);
         WinQueryWindowPos(WinWindowFromID(hwndDriveCB, CBID_EDIT), &swpDriveCBEF);
         WinSetWindowPos(hwndDriveCB, 0, ulCurX, ulCurY-(swpDriveCB.cy-swpDriveCBEF.cy)+5,
                                         swpDirLB.cx,
                                         swpDriveCB.cy,
                                         SWP_SIZE | SWP_MOVE);
         ulCurY += swpDriveCBEF.cy + SPACING;
         WinQueryWindowPos(hwndDriveST, &swpDriveST);
         WinSetWindowPos(hwndDriveST, 0, ulCurX, ulCurY, swpDriveST.cx, swpDriveST.cy, SWP_MOVE | SWP_SIZE);
         ulCurY += swpDriveST.cy + SPACING;
         WinQueryWindowPos(hwndFileST, &swpFileST);
         WinSetWindowPos(hwndFileST, 0, ulCurX, ulCurY, swpFileST.cx, swpFileST.cy, SWP_MOVE | SWP_SIZE);
         ulCurY += swpFileST.cy + SPACING;

         // Hide unused stuff
         henum = WinBeginEnumWindows(hwndDlg);
         while ((hwndNext = WinGetNextWindow(henum)) != NULLHANDLE)
         {
           USHORT usID = WinQueryWindowUShort(hwndNext, QWS_ID);
           if (usID != DID_FILENAME_TXT &&
               usID != DID_DIRECTORY_TXT &&
               usID != DID_DIRECTORY_LB &&
               usID != DID_DRIVE_TXT &&
               usID != DID_DRIVE_CB &&
               usID != DID_OK &&
               usID != DID_CANCEL &&
               usID != FID_TITLEBAR &&
               usID != FID_SYSMENU &&
               usID != FID_MINMAX) 
           {
             WinShowWindow(hwndNext, FALSE);
           }
         }

         WinSetWindowPos(hwndDlg,
                         HWND_TOP,
                         (lScreenX/2)-((swpDirLB.cx+2*SPACING+2*lDlgFrameX)/2),
                         (lScreenY/2)-((ulCurY+2*lDlgFrameY+lTitleBarY)/2),
                         swpDirLB.cx+2*SPACING+2*lDlgFrameX,
                         ulCurY+2*lDlgFrameY+lTitleBarY,
                         SWP_MOVE | SWP_SIZE);
         }
         break;
      case WM_CONTROL:
         {
         PFILEDLG pfiledlg;
         pfiledlg = (PFILEDLG)WinQueryWindowPtr(hwndDlg, QWL_USER);

         HPS           hps;
         SWP           swp;
         HWND          hwndST;
         RECTL         rectlString = {0,0,1000,1000};
         char          *ptr = NULL;
         int           iHalfLen;
         int           iLength;
         CHAR          szString[CCHMAXPATH];

         hwndST = WinWindowFromID(hwndDlg, DID_FILENAME_TXT);
       
         strcpy(szString, pfiledlg->szFullFile);
         iLength = strlen(pfiledlg->szFullFile);
         /* If we are not just a drive */
         if (iLength > 3) {
           if (szString[iLength-1] == '\\') {
             szString[iLength-1] = '\0';
             iLength--;
           }
         }
       
         hps = WinGetPS(hwndST);
         WinQueryWindowPos(hwndST, &swp);
       
         WinDrawText(hps, iLength, szString,
                          &rectlString, 0, 0, 
                          DT_BOTTOM | DT_QUERYEXTENT | DT_TEXTATTRS);
         while(rectlString.xRight > swp.cx)
         {
           iHalfLen = iLength / 2;
           if(iHalfLen == 2)
             break;
       
           ptr = szString + iHalfLen;
           memmove(ptr - 1, ptr, strlen(ptr) + 1);
           szString[iHalfLen - 2] = '.';
           szString[iHalfLen - 1] = '.';
           szString[iHalfLen]     = '.';
           iLength = strlen(szString);
           rectlString.xLeft = rectlString.yBottom = 0;
           rectlString.xRight = rectlString.yTop = 1000;
           WinDrawText(hps, iLength, szString,
                       &rectlString, 0, 0, 
                       DT_BOTTOM | DT_QUERYEXTENT | DT_TEXTATTRS);
         }
       
         WinReleasePS(hps);
         WinSetWindowText(hwndST, szString);
         }
         break;
   }      
   return WinDefFileDlgProc(hwndDlg, msg, mp1, mp2);
}
Exemple #23
0
/*----------------------------------------------------------------------*/
void DMLBCheckTargetLocation(HWND SrcHwnd, DMLBData *InstData, SHORT X, SHORT Y)
/*----------------------------------------------------------------------*/
/* X,Y is in SrcHwnd window coordinates.                                */
/* Given an Y,Y coordinate of the pointer, determine if the pointer is  */
/* over a listbox that will accept a drop.  If it is, we save the       */
/* handle of the listbox and set the PrevLocation to POINT_INSIDE in    */
/* the instance data.  Otherwise, we see if the position is near the    */
/* top/bottom edge of the last good target listbox we had.  If so, set  */
/* the PrevLocation to POINT_NORTH/SOUTH as appropriate.  Finally, if   */
/* none of the above, just set the PrevLocation to POINT_OUTSIDE.       */
/*----------------------------------------------------------------------*/
{
RECTL Rect;
POINTL ScreenPoint;
HWND  OverHwnd;
char  OverClass[10];

  InstData->PrevLocation = POINT_OUTSIDE; // Assume this until we know otherwise

  /* See if window under the pointer is a listbox.             */
  ScreenPoint.x = X;
  ScreenPoint.y = Y;
  WinMapWindowPoints(SrcHwnd, HWND_DESKTOP, &ScreenPoint, 1L);
  OverHwnd = WinWindowFromPoint(HWND_DESKTOP, &ScreenPoint, TRUE);
  WinQueryClassName(OverHwnd, sizeof(OverClass), OverClass);

  if (!strcmp(OverClass, LISTBOX_CLASS_STRING)) {
    /* Yes, it is a listbox -- see if it will accept our drop */
    MRESULT Answer;

    /* If this is part of an MCLB, the MCLB is really the target */
    WinQueryClassName(WinQueryWindow(OverHwnd, QW_OWNER), sizeof(OverClass), OverClass);
    if (!strcmp(OverClass, "MCLBCls"))
      OverHwnd = WinQueryWindow(OverHwnd, QW_OWNER);

    Answer = WinSendMsg(WinQueryWindow(OverHwnd, QW_OWNER),
                        WM_CONTROL,
                        MPFROM2SHORT(WinQueryWindowUShort(OverHwnd, QWS_ID), LN_DMLB_QRYDROP),
                        MPFROMHWND(SrcHwnd));
    if ((BOOL)SHORT1FROMMR(Answer)) {
      /* Yes, it will accept the drop */
      InstData->TargetHwnd = OverHwnd;                 // Note new target
   // if (SrcHwnd == OverHwnd)
   //   InstData->TargetDropMode = DROPMODE_MOVE;      // Force MOVE for same-listbox drops
   // else
        InstData->TargetDropMode = SHORT2FROMMR(Answer); // Copy, Move, or Delete
      InstData->PrevLocation = POINT_INSIDE;           // We are inside the listbox now
      return;
    }
    /* It will not accept a drop, proceed as point outside */
    return;
  }

  /* Not a listbox class window.  See if pointer is near north/south */
  /* edge of last good target listbox.  ("Near" is defined as the    */
  /* height of a menu bar).                                          */

  WinQueryWindowRect(InstData->TargetHwnd, &Rect);
  /* Translate rectangle to screen coordinates */
  WinMapWindowPoints(InstData->TargetHwnd, HWND_DESKTOP, (POINTL *)&Rect, 2L);

  if ((ScreenPoint.x >= Rect.xLeft) && (ScreenPoint.x <= Rect.xRight)) {
    if ((ScreenPoint.y < Rect.yTop + WinQuerySysValue(HWND_DESKTOP, SV_CYMENU)) &&
        (ScreenPoint.y > Rect.yBottom - WinQuerySysValue(HWND_DESKTOP, SV_CYMENU))) {
       if (ScreenPoint.y > Rect.yTop)
         InstData->PrevLocation = POINT_NORTH;
       else if (ScreenPoint.y < Rect.yBottom)
         InstData->PrevLocation = POINT_SOUTH;
       return;
    } // Within a menu-size distance of north/south edge
  } // Within the horizontal boundries of the listbox

  /* Pointer is outside the range of interest */
  return;
}
MRESULT EXPENTRY newProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{

  switch (msg)
    {      
    case WM_CREATE:
      {
        PCREATESTRUCT pCreate=PVOIDFROMMP(mp2);

        /* Initialize the slider data */
        WinSetWindowUShort(hwnd, SLIDERARMWITH,20);
        WinSetWindowUShort(hwnd, SLIDERARMHEIGHT,10);
        /* Dimensions of slider. The slider active area is smaller than the window to
           allow drawing of active state. */
        WinSetWindowULong(hwnd, SLIDERCX,pCreate->cx-4);
        WinSetWindowULong(hwnd, SLIDERCY,pCreate->cy-4);
        WinSetWindowULong(hwnd, SLIDERX,2);
        WinSetWindowULong(hwnd, SLIDERY,2);
        WinSetWindowULong(hwnd, SLIDERARMPOS, 0);
        WinSetWindowULong(hwnd, SLDRAGGING,FALSE);
        return (MRESULT)0;
      }
    case WM_SIZE:
      WinSetWindowULong(hwnd, SLIDERCX, SHORT1FROMMP(mp2)-4);
      WinSetWindowULong(hwnd, SLIDERCY, SHORT2FROMMP(mp2)-4);
      WinInvalidateRect(hwnd, NULLHANDLE,TRUE);
      return (MRESULT)0;
    case WM_BUTTON1DOWN:
      {
        SHORT x=SHORT1FROMMP( mp1);
        SHORT y=SHORT2FROMMP( mp1);
        LONG  lPos=WinQueryWindowULong(hwnd, SLIDERARMPOS);
        USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWITH);

        if(x<lPos+usWidth && y<WinQueryWindowUShort(hwnd, SLIDERY)+WinQueryWindowUShort(hwnd, SLIDERCY)
           && y>WinQueryWindowUShort(hwnd, SLIDERY)) {
          WinSetWindowUShort(hwnd, PTRPOSINSLARM, x-lPos);
        }
        WinSetFocus(HWND_DESKTOP, hwnd);
      break;
      }
    case WM_FOCUSCHANGE:
      {
        HPS hps;
        RECTL rcl;
        POINTL ptl;

        if(SHORT1FROMMP(mp2)) {
          hps=WinGetPS(hwnd);
          WinQueryWindowRect(hwnd, &rcl);        
          GpiSetLineType(hps, LINETYPE_DOT);
          ptl.x=rcl.xLeft;
          ptl.y=rcl.yBottom;
          GpiMove(hps,&ptl);
          ptl.x=rcl.xRight-1;
          GpiLine(hps,&ptl);
          ptl.y=rcl.yTop-1;
          GpiLine(hps,&ptl);
          ptl.x=rcl.xLeft;
          GpiLine(hps,&ptl);
          ptl.y=rcl.yBottom;
          GpiLine(hps,&ptl);
          WinReleasePS(hps);
        }
        else {
          WinInvalidateRect(hwnd, NULLHANDLE,TRUE);
        }

        break;
      }
    case WM_CHAR:
      if(WinQueryFocus(HWND_DESKTOP)==hwnd) {
        /* We have the focus */
        if((SHORT1FROMMP(mp1) & (KC_VIRTUALKEY))==(KC_VIRTUALKEY)) {
          LONG  lPos=WinQueryWindowULong(hwnd, SLIDERARMPOS);
          USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWITH);
          ULONG ulCx=WinQueryWindowULong(hwnd, SLIDERCX);
#if 0
          FILE* file;
          file=fopen("d:\\md.log","a");
          fprintf(file,"0x%x 0x%x \n",SHORT1FROMMP(mp1),SHORT2FROMMP(mp1) );
          fclose(file);
#endif
          /*(KC_KEYUP|KC_PREVDOWN|KC_VIRTUALKEY)*/
          switch(SHORT2FROMMP(mp2))
            {
            case VK_RIGHT:

              if(SHORT1FROMMP(mp1) & (KC_KEYUP|KC_PREVDOWN)) {
                lPos+=2;
                if(lPos>ulCx-usWidth)
                  lPos=ulCx-usWidth;
                else {
                  WinPostMsg( hwnd,
                              SLM_SETSLIDERINFO,
                              MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_RANGEVALUE),
                              MPFROMLONG( (LONG) lPos ));
                  if(SHORT1FROMMP(mp1) & KC_LONEKEY)
                    /* Post SLN_CHANGE notification */
                    WinPostMsg( WinQueryWindow(hwnd, QW_PARENT),WM_CONTROL,
                                MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), SLN_CHANGE),
                                MPFROMLONG(lPos));
                  else
                    /* Post SLN_SLIDERTRACK notification */
                    WinPostMsg(WinQueryWindow(hwnd, QW_PARENT),WM_CONTROL,
                               MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), SLN_SLIDERTRACK),
                               MPFROMLONG(lPos));
                  
                }
                WinSetWindowULong(hwnd, SLIDERARMPOS, lPos);
              }
              return (MRESULT)TRUE;
            case VK_LEFT:
              if(SHORT1FROMMP(mp1) & (KC_KEYUP|KC_PREVDOWN)) {
                lPos-=2;
                if(lPos<0) {
                  lPos=0;
                }
                else {
                  WinPostMsg( hwnd,
                              SLM_SETSLIDERINFO,
                              MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_RANGEVALUE),
                              MPFROMLONG( (LONG) lPos ));
                  /* Post SLN_CHANGE notification */
                  WinPostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_CONTROL,
                             MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), SLN_CHANGE),
                   MPFROMLONG(WinQueryWindowULong(hwnd, SLIDERARMPOS)));

                }
                WinSetWindowULong(hwnd, SLIDERARMPOS, lPos);
              }
              return (MRESULT)TRUE;
            default:
              break;
            }
        }
      }
      break;
    case WM_BUTTON1MOTIONSTART:
      {
        SHORT x=SHORT1FROMMP( mp1);
        SHORT y=SHORT2FROMMP( mp1);
        LONG  lPos=WinQueryWindowULong(hwnd, SLIDERARMPOS);
        USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWITH);

        if(x<lPos+usWidth && y<WinQueryWindowUShort(hwnd, SLIDERY)+WinQueryWindowUShort(hwnd, SLIDERCY)
           && y>WinQueryWindowUShort(hwnd, SLIDERY)) {
          WinSetWindowULong(hwnd, SLDRAGGING, TRUE);
          WinSetCapture(HWND_DESKTOP, hwnd);
        }
        break;
      }
    case WM_BUTTON1MOTIONEND:
      if(WinQueryWindowULong(hwnd, SLDRAGGING)) {
        WinSetWindowULong(hwnd, SLDRAGGING,FALSE);
        WinSetCapture(HWND_DESKTOP, NULLHANDLE);
        /* Post SLN_CHANGE notification */
        WinPostMsg(WinQueryWindow(hwnd, QW_PARENT),WM_CONTROL, MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), SLN_CHANGE),
                   MPFROMLONG(WinQueryWindowULong(hwnd, SLIDERARMPOS)));
      }
      break;
    case SLM_SETSLIDERINFO:
      switch(SHORT1FROMMP(mp1))
        {
          case SMA_SLIDERARMPOSITION:
            /*  SMA_RANGEVALUE only for now !! */
            if(SHORT2FROMMP(mp1)==SMA_RANGEVALUE) {
              WinSetWindowULong(hwnd, SLIDERARMPOS, LONGFROMMP(mp2));
              WinInvalidateRect(hwnd, NULLHANDLE,TRUE);
              return (MRESULT)0;
            }
            break;
        default:
          break;
        }
      break;
    case WM_MOUSEMOVE:
      if(WinQueryWindowULong(hwnd, SLDRAGGING)) {
        HPS hps;
        RECTL rcl, rcl2, rcl3;
        LONG lTemp;
        SHORT x=SHORT1FROMMP(mp1);
        LONG  lPos=WinQueryWindowULong(hwnd, SLIDERARMPOS);
        USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWITH);
       
        lTemp=lPos;
     
        rcl.xLeft=WinQueryWindowULong(hwnd, SLIDERX);
        rcl.yBottom=WinQueryWindowULong(hwnd, SLIDERY);
        rcl.xRight=rcl.xLeft+WinQueryWindowULong(hwnd, SLIDERCX);
        rcl.yTop=rcl.yBottom+WinQueryWindowULong(hwnd, SLIDERCY);

        rcl2=rcl3=rcl;
        rcl.xLeft=x-WinQueryWindowUShort(hwnd, PTRPOSINSLARM);
        if(rcl.xLeft<rcl2.xLeft)/* Make sure we stop at the left border */
          rcl.xLeft=rcl2.xLeft;

        rcl.xRight=rcl.xLeft+usWidth;
        if(rcl.xRight>rcl2.xRight)
          {/* Make sure we stop at the right border */
            rcl.xRight=rcl2.xRight;
            rcl.xLeft=rcl.xRight-usWidth;
          }
        lPos=rcl.xLeft-WinQueryWindowULong(hwnd, SLIDERX);/* Save position zero based */
        WinSetWindowULong(hwnd, SLIDERARMPOS, lPos);
        if(lPos!=lTemp) {
          BOOL rc;

          hps=WinGetPS(hwnd);
          /* Paint Background not necessary here */

          /* Shaft */
          /* Left part */
          rcl3.xRight=rcl.xLeft;
          rc=FALSE;
          if(USERSLIDER) {
            OWNERITEM oi={0};
            oi.hwnd=hwnd;
            oi.hps=hps;
            oi.fsState=SLS_OWNERDRAW;/* More to come */
            oi.rclItem=rcl3;
            oi.idItem=SDA_SLIDERSHAFT;
            rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                                MPFROMP(&oi) );
          }
          if(!rc)
            WinFillRect(hps, &rcl3, CLR_GREEN);

          /* Right part */
          rcl3.xRight=rcl2.xRight;
          rcl3.xLeft=rcl.xRight;
          rc=FALSE;
          if(USERSLIDER) {
            OWNERITEM oi={0};
            oi.hwnd=hwnd;
            oi.hps=hps;
            oi.fsState=SLS_OWNERDRAW;/* More to come */
            oi.rclItem=rcl3;
            oi.idItem=SDA_SLIDERSHAFT;
            rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                                MPFROMP(&oi) );
          }
          if(!rc)
            WinFillRect(hps, &rcl3, CLR_WHITE);

          /* Paint Slider */
          rc=FALSE;
          if(USERSLIDER) {
            OWNERITEM oi={0};
            oi.hwnd=hwnd;
            oi.hps=hps;
            oi.fsState=SLS_OWNERDRAW;/* More to come */
            oi.rclItem=rcl;
            oi.idItem=SDA_SLIDERARM;
            rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                                MPFROMP(&oi) );
          }
          if(!rc)
            {
              WinFillRect(hps,&rcl, CLR_BLUE);
              WinDrawBorder(hps, &rcl, 2, 2, 0, 0 ,0x0400);
            }

          WinReleasePS(hps);

          /* Post SLN_SLIDERTRACK notification */
          WinPostMsg(WinQueryWindow(hwnd, QW_PARENT),WM_CONTROL, MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), SLN_SLIDERTRACK),
                     MPFROMLONG(lPos));
        }
      }
      break;
    case WM_PAINT:
      {
        HPS hps, hps2;
        RECTL rcl, rcl2, rcl3;
        POINTL ptl;
        LONG  lPos=WinQueryWindowULong(hwnd, SLIDERARMPOS);
        USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWITH);
        BOOL rc;

        WinQueryWindowRect(hwnd, &rcl);

        /* Shaft */
        rcl2.xLeft=WinQueryWindowULong(hwnd, SLIDERX);
        rcl2.yBottom=WinQueryWindowULong(hwnd, SLIDERY);
        rcl2.xRight=rcl2.xLeft+WinQueryWindowULong(hwnd, SLIDERCX)-1;
        rcl2.yTop=rcl2.yBottom+WinQueryWindowULong(hwnd, SLIDERCY)-1;

        /* Background */
        hps2=WinGetPS(hwnd);
        GpiExcludeClipRectangle(hps2,&rcl2);
        WinFillRect(hps2, &rcl, CLR_PALEGRAY);
        WinReleasePS(hps2);
        rcl2.yTop+=1;
        rcl2.xRight+=1;

        hps=WinBeginPaint(hwnd, NULLHANDLE, NULLHANDLE);
        /* Focus */
        if(WinQueryFocus(HWND_DESKTOP)==hwnd) {
          GpiSetLineType(hps, LINETYPE_DOT);
          ptl.x=rcl.xLeft;
          ptl.y=rcl.yBottom;
          GpiMove(hps,&ptl);
          ptl.x=rcl.xRight-1;
          GpiLine(hps,&ptl);
          ptl.y=rcl.yTop-1;
          GpiLine(hps,&ptl);
          ptl.x=rcl.xLeft;
          GpiLine(hps,&ptl);
          ptl.y=rcl.yBottom;
          GpiLine(hps,&ptl);
        }

        rcl3=rcl=rcl2;

        /* Arm pos */        
        rcl2.xLeft+=lPos;
        /* Arm size */        
        rcl2.xRight=rcl2.xLeft+usWidth;
        
        /* Shaft */
        /* Left part */
        rcl3.xRight=rcl2.xLeft;
        rc=FALSE;
        if(USERSLIDER) {
          OWNERITEM oi={0};
          oi.hwnd=hwnd;
          oi.hps=hps;
          oi.fsState=SLS_OWNERDRAW;/* More to come */
          oi.rclItem=rcl3;
          oi.idItem=SDA_SLIDERSHAFT;
          rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                    MPFROMP(&oi) );
        }
        if(!rc)
          WinFillRect(hps, &rcl3, CLR_GREEN);

        /* Right part */
        rcl3.xRight=rcl.xRight;
        rcl3.xLeft=rcl2.xRight;
        rc=FALSE;
        if(USERSLIDER) {
          OWNERITEM oi={0};
          oi.hwnd=hwnd;
          oi.hps=hps;
          oi.fsState=SLS_OWNERDRAW;/* More to come */
          oi.rclItem=rcl3;
          oi.idItem=SDA_SLIDERSHAFT;
          rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                              MPFROMP(&oi) );
        }
        if(!rc)
          WinFillRect(hps, &rcl3, CLR_WHITE);

        rc=FALSE;
        if(USERSLIDER) {
          OWNERITEM oi={0};
          oi.hwnd=hwnd;
          oi.hps=hps;
          oi.fsState=SLS_OWNERDRAW;/* More to come */
          oi.rclItem=rcl2;
          oi.idItem=SDA_SLIDERARM;
          rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                              MPFROMP(&oi) );
        }
        if(!rc)
          {
            WinFillRect(hps,&rcl2, CLR_BLUE);        
            WinDrawBorder(hps, &rcl2, 2, 2, 0, 0 ,0x0400);
          }

        WinEndPaint(hps);
        return (MRESULT)0;
      }
      break;
    default:
      break;
    }

  return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
Exemple #25
0
MRESULT EXPENTRY tButProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
  HWND hwndFly = WinQueryWindowULong( hwnd, QWL_USER );

  switch( msg )
  {
    case WM_MOUSEMOVE:
    {
      if( !hwndFly && useBubbles )
        WinStartTimer( 0, hwnd, 1 /* unused id */, 500 );
      return ( *oldButProc )( hwnd, msg, mp1, mp2 );
    }
    break;

    case WM_TIMER:
    {
      RGB rgb;
      HPS hps;
      HAB hab;
      RECTL rectl;
      ULONG breite, hoehe;
      POINTL p;
      char str[200];

      if( hwndFly )
        break;

      hab = WinQueryAnchorBlock( hwnd );

      WinLoadString( hab, NULLHANDLE, WinQueryWindowUShort( hwnd, QWS_ID ),
                     sizeof( str ), str );

      hwndFly = WinCreateWindow( HWND_DESKTOP, WC_STATIC, str,
                                 SS_TEXT | DT_VCENTER | DT_CENTER,
                                 0, 0, 0, 0, hwnd, HWND_TOP, 0, 0, NULL );

      rgb.bBlue  = 0;
      rgb.bGreen = 254;
      rgb.bRed   = 254;
      WinSetPresParam( hwndFly, PP_BACKGROUNDCOLOR, sizeof( RGB ), &rgb );

      rgb.bBlue  = 0;
      rgb.bGreen = 0;
      rgb.bRed   = 0;
      WinSetPresParam( hwndFly, PP_FOREGROUNDCOLOR, sizeof( RGB ), &rgb );

      WinSetPresParam( hwndFly, PP_FONTNAMESIZE, sizeof( DefCntrFont ),
                       DefCntrFont );

      queryDimensions( hwndFly, str, &breite, &hoehe );

      WinQueryPointerPos( HWND_DESKTOP, &p );
      p.y -= WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR );
      p.y -= hoehe/2;
      p.x += 5;

      WinSetWindowPos( hwndFly, HWND_TOP, p.x, p.y, breite+4, hoehe+2,
                       SWP_SHOW | SWP_MOVE | SWP_SIZE );

      WinSetWindowULong( hwnd, QWL_USER, (ULONG) hwndFly );
    }
    break;

    case UM_FLYOVER_BEGIN:
      useBubbles = 1;
      break;

    case UM_FLYOVER_END:
      WinStopTimer( 0, hwnd, 1 /* unused id */ );
      if( hwndFly )
        WinDestroyWindow( hwndFly );
      WinSetWindowULong( hwnd, QWL_USER, 0 );
      break;

    default:
      return ( *oldButProc )( hwnd, msg, mp1, mp2 );
  }

  return FALSE;
}
Exemple #26
0
//Called before the default wnd procedure if you wish to provide additional
//  functionality.  (i.e. modify what happens with mouse clicks, drag/drop, etc...
BOOL CBZPluginWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2,
                        PVOID pData, PFNWP pfnOrigWndProc, MRESULT *rc)
{
  USHORT      mId;
  PLUGINSHARE *pPluginData = (PLUGINSHARE *)pData;
  


  switch (msg)
    {
    case WM_PAINT:
        {
          PLUGINSHARE *pCBZData = (PLUGINSHARE *)pData;

            BOOL    bActive = FALSE;
            PSPAINT psP;
 
            mId = WinQueryWindowUShort(hwnd, QWS_ID);

            //paint the MinMax menu!
            if (mId == FID_MINMAX)
            {
              HPS hps;
              RECTL rcl;
         
              hps = WinBeginPaint(hwnd, NULLHANDLE,&rcl);


              if(WinSendMsg(hwnd,MM_QUERYITEMRECT,MPFROM2SHORT(SC_CLOSE,FALSE),&rcl))
                {
                  if(pPluginData->hbmActiveClose==NULLHANDLE)
                    if (!CreateImages(pPluginData))
                      return FALSE;
                  // rcl.yBottom-=1;    
                  memset(&psP,0,sizeof(psP));
                  psP.hwnd=hwnd;
                  psP.hps=hps;
                  psP.hpsWin=hps;
                  psP.rectlWindow=rcl;
                  psP.rectlUpdate=rcl;
                  
                  DrawImage(&psP, pPluginData->hbmActiveClose, 0, pPluginData);              
                }

                if(WinSendMsg(hwnd,MM_QUERYITEMRECT,MPFROM2SHORT(SC_MINIMIZE,FALSE),&rcl))
                {
                    //draw MinimizeButton

                  if(pPluginData->hbmActiveMinimize==NULLHANDLE)
                    if (!CreateImages(pPluginData))
                      return FALSE;
                  memset(&psP,0,sizeof(psP));
                  psP.hwnd=hwnd;
                  psP.hps=hps;
                  psP.hpsWin=hps;
                  psP.rectlWindow=rcl;
                  psP.rectlUpdate=rcl;
                  
                  DrawImage(&psP, pPluginData->hbmActiveMinimize, 0, pPluginData);
                }

                if(WinSendMsg(hwnd,MM_QUERYITEMRECT,MPFROM2SHORT(SC_MAXIMIZE,FALSE),&rcl))
                {
                    //draw MaximizeButton
                  if(pPluginData->hbmActiveMaximize==NULLHANDLE)
                    if (!CreateImages(pPluginData))
                      return FALSE;
                  //  rcl.yBottom-=1;    
                  memset(&psP,0,sizeof(psP));
                  psP.hwnd=hwnd;
                  psP.hps=hps;
                  psP.hpsWin=hps;
                  psP.rectlWindow=rcl;
                  psP.rectlUpdate=rcl;
                  
                  DrawImage(&psP, pPluginData->hbmActiveMaximize, 0, pPluginData);
                }

                if(WinSendMsg(hwnd,MM_QUERYITEMRECT,MPFROM2SHORT(SC_RESTORE,FALSE),&rcl))
                {
                    //draw RestoreButton
                  if(pPluginData->hbmActiveRestore==NULLHANDLE)
                    if (!CreateImages(pPluginData))
                      return FALSE;
                  //  rcl.yBottom-=1;    
                  memset(&psP,0,sizeof(psP));
                  psP.hwnd=hwnd;
                  psP.hps=hps;
                  psP.hpsWin=hps;
                  psP.rectlWindow=rcl;
                  psP.rectlUpdate=rcl;
         
                  DrawImage(&psP, pPluginData->hbmActiveRestore, 0, pPluginData);

                }

                if(WinSendMsg(hwnd,MM_QUERYITEMRECT,MPFROM2SHORT(SC_HIDE,FALSE),&rcl))
                {
                    //draw HideButton
                  if(pPluginData->hbmActiveHide==NULLHANDLE)
                    if (!CreateImages(pPluginData))
                      return FALSE;
                  // rcl.yBottom-=1;    
                  memset(&psP,0,sizeof(psP));
                  psP.hwnd=hwnd;
                  psP.hps=hps;
                  psP.hpsWin=hps;
                  psP.rectlWindow=rcl;
                  psP.rectlUpdate=rcl;
         
                  DrawImage(&psP, pPluginData->hbmActiveHide, 0, pPluginData);
                }
                WinEndPaint(hps);
                return TRUE;              
            
            }
        }

      return FALSE;
    case MM_INSERTITEM:
      {
        PMENUITEM pmi;
        MENUITEM mi;

        pmi=(PMENUITEM) PVOIDFROMMP(mp1);
        
        *rc = pfnOrigWndProc(hwnd, msg, mp1, mp2);
        
        if (pmi->id == SC_RESTORE)
          {
            if (pPluginData->hbmActiveRestore != NULLHANDLE) {
              pmi->afStyle|=MIS_OWNERDRAW;
              WinSendMsg(hwnd,MM_SETITEM,MPFROM2SHORT(0,FALSE),pmi);
            }
          }
        else if (pmi->id == SC_MAXIMIZE)
          {
            if (pPluginData->hbmActiveMaximize != NULLHANDLE) {
              pmi->afStyle|=MIS_OWNERDRAW;
              WinSendMsg(hwnd,MM_SETITEM,MPFROM2SHORT(0,FALSE),pmi);
            }
          }
        else if (pmi->id == SC_HIDE)
          {
            if (pPluginData->hbmActiveHide != NULLHANDLE) {
              pmi->afStyle|=MIS_OWNERDRAW;
              WinSendMsg(hwnd,MM_SETITEM,MPFROM2SHORT(0,FALSE),pmi);
            }
          }
        else if (pmi->id == SC_MINIMIZE)
          {
            if (pPluginData->hbmActiveMinimize != NULLHANDLE) {
              pmi->afStyle|=MIS_OWNERDRAW;
              WinSendMsg(hwnd,MM_SETITEM,MPFROM2SHORT(0,FALSE),pmi);
            }
          }
        else if (pmi->id == SC_CLOSE)
          {
            if (pPluginData->hbmActiveClose != NULLHANDLE) {
              pmi->afStyle|=MIS_OWNERDRAW;
              WinSendMsg(hwnd,MM_SETITEM,MPFROM2SHORT(0,FALSE),pmi);
            }
          }        
        return TRUE;
      }
      break;
    default:
      break;
    }

  return FALSE; //false indicates that we haven't processed the message!
}
MRESULT EXPENTRY MainWndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
   BOOL    fHandled = TRUE;
   MRESULT mReturn = 0;

   switch(msg)
   {
      case WM_CREATE:
         return (MRESULT)mwpCreate(hWnd, mp1);

      case WM_PAINT:
         mwpPaint(hWnd);
         break;

      case WM_SIZE:
         mwpSize(hWnd);
         break;

      case WM_CONTROL:
         switch(SHORT1FROMMP(mp1))
         {
            case SLRD_VOLUME:
               if((SHORT2FROMMP(mp1) == SLN_CHANGE) || (SHORT2FROMMP(mp1) == SLN_SLIDERTRACK))
               {
                  USHORT   usDeviceID = WinQueryWindowUShort(hWnd, QWS_DEVICEID);
                  ULONG    ulLevel = (ULONG)WinSendMsg(WinWindowFromID(hWnd, SLRD_VOLUME), SLM_QUERYSLIDERINFO, MPFROMLONG(MAKELONG(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE)), NULL);

                  ULONG          ulError = 0;
                  MCI_SET_PARMS  msp;
                  const ULONG    flParam1 = MCI_WAIT | MCI_SET_AUDIO | MCI_SET_VOLUME;

                  msp.ulLevel = ulLevel;
                  msp.ulAudio = MCI_SET_AUDIO_ALL;

                  mciSendCommand(usDeviceID, MCI_SET, flParam1, (PVOID)&msp, 0);
               }
               break;

            default:
               fHandled = FALSE;
               break;
         }
         break;

      case WM_CLOSE:
         _beginthread(ShutdownThread, NULL, 16384, (void*)hWnd);
         break;

      case MM_MCIPOSITIONCHANGE:
         WinSetPBValue(WinWindowFromID(hWnd, PB_PROGRESS), LONGFROMMP(mp2));
         break;

      case MM_MCINOTIFY:
         mmMCINotify(hWnd, mp1, mp2);
         break;

      case WMU_LOAD:
         mReturn = (MRESULT)mwpLoad(hWnd);
         break;

      case WMU_PLAY:
         mwpPlay(hWnd);
         break;

      default:
         fHandled = FALSE;
   }
   if(!fHandled)
      mReturn = WinDefWindowProc(hWnd, msg, mp1, mp2);

   return mReturn;
}
Exemple #28
0
/*----------------------------------------------------------------------*/
MRESULT EXPENTRY DMLBSubclassListboxProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
/*----------------------------------------------------------------------*/
/* This window procedure is used to subclass a standard PM listbox      */
/* control.  This procedure will intercept certain mouse events on the  */
/* listbox to implement direct-manipulation functions.                  */
/*----------------------------------------------------------------------*/
{
SHORT    Item;          /* Listbox item number                          */
DMLBData  *InstData;     /* This instance-specific data (per listbox)    */

   /* The lisbox window pointer is to our instance data. */

   InstData = WinQueryWindowPtr(hwnd, QWL_USER);
     
   switch (msg) {
      /* Since this is just a subclass setup after the listbox window */
      /* is created, we never get a WM_CREATE message here.           */

      case WM_DESTROY:
           /* The listbox window is being destroyed.  Cleanup any     */
           /* resources we have allocated in this subclass.           */
           if (InstData->DragMIcon != NULLHANDLE) {
             WinDestroyPointer(InstData->DragMIcon);
             WinDestroyPointer(InstData->DragCIcon);
             WinDestroyPointer(InstData->NorthIcon);
             WinDestroyPointer(InstData->SouthIcon);
             WinDestroyPointer(InstData->DragNoDrp);
             WinDestroyPointer(InstData->DeletIcon);
             InstData->DragMIcon = NULLHANDLE;
           }
           /* Cleanup other resources */
           if (InstData->Dragging) {
             WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,DRAG_TIMERID);
           }
           /* Release instance data */
           free(InstData);
           WinSetWindowPtr(hwnd, 0L, NULL);
           break;

      case WM_TIMER:
           /* We get timer messages during dragging to implement */
           /* auto-scrolling of listbox when pointer is placed   */
           /* north or south of the listbox while dragging.      */

           if (!InstData->Dragging)  /* Ignore if not dragging   */
             break;

           if (SHORT1FROMMP(mp1)==DRAG_TIMERID) {
             switch (InstData->PrevLocation) { // Last known location of the pointer
               case POINT_INSIDE:
               case POINT_OUTSIDE:
                 /* Do nothing */
                 break;

               case POINT_NORTH:
                 /* Scroll up one item */
                 Item = (SHORT)WinSendMsg(InstData->TargetHwnd, LM_QUERYTOPINDEX,  0L, 0L);
                 if ((Item != LIT_NONE) && (Item != 0))
                    WinPostMsg(InstData->TargetHwnd, LM_SETTOPINDEX, MPFROMSHORT(Item-1), 0L);
                 break;

               case POINT_SOUTH:
                 /* Scroll down one item */
                 Item = (SHORT)WinSendMsg(InstData->TargetHwnd, LM_QUERYTOPINDEX,  0L, 0L);
                 if (Item != LIT_NONE)
                    WinPostMsg(InstData->TargetHwnd, LM_SETTOPINDEX, MPFROMSHORT(Item+1), 0L);
                 break;
             } /* switch on PrevLocation */
             return 0;
           }
           break;

      case WM_CONTEXTMENU: {
           SHORT CursorIndx, Max;

           /* User requested context menu... notify our owner.          */

           /* First find out what item the pointer is over.             */
           Max = (SHORT)WinSendMsg( hwnd, LM_QUERYITEMCOUNT, 0L, 0L );
           CursorIndx = DMLBLocateListboxItem(hwnd, hwnd, SHORT2FROMMP(mp1), LLI_UNDER);
           if ((Max == 0) || (CursorIndx+1 > Max))
             CursorIndx = LIT_NONE;

           /* Tell our owner about it */
           return WinSendMsg(WinQueryWindow(hwnd, QW_OWNER), WM_CONTROL,
                      MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), LN_DMLB_CONTEXT),
                      MPFROMSHORT(CursorIndx));
           }
 
      case WM_MOUSEMOVE:
           /* Monitor the position of the mouse relative to the listbox */
           /* so we can set the pointer icon correctly and note the     */
           /* position for use during WM_TIMER processing.              */

           if (!InstData->Dragging)   /* Ignore if not dragging */
             break;

           DMLBCheckTargetLocation(hwnd, InstData, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1));

           /* Set pointer icon appropriate for location */
           if (InstData->DragMIcon == NULLHANDLE) {
             // Load all the pointers (one time only)
             InstData->DragMIcon= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRAGMOVE);
             InstData->DragCIcon= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRAGCOPY);
             InstData->DragNoDrp= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRAGNONE);
             InstData->NorthIcon= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRGNORTH);
             InstData->SouthIcon= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRGSOUTH);
             InstData->DeletIcon= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRGDEL);
           }
           switch (InstData->PrevLocation) {
             case POINT_INSIDE:
               switch (InstData->TargetDropMode) {
               case DROPMODE_MOVE:
                 WinSetPointer(HWND_DESKTOP, InstData->DragMIcon); // Use MOVE pointer 
                 break;
               case DROPMODE_COPY:
                 WinSetPointer(HWND_DESKTOP, InstData->DragCIcon); // Use COPY pointer
                 break;
               case DROPMODE_DELETE:
                 WinSetPointer(HWND_DESKTOP, InstData->DeletIcon); // Use DELETE pointer
                 break;
               }
               break;
             case POINT_OUTSIDE:
               WinSetPointer(HWND_DESKTOP, InstData->DragNoDrp);   // No-drop pointer
               break;
             case POINT_NORTH:
               WinSetPointer(HWND_DESKTOP, InstData->NorthIcon);   // Scroll-up pointer
               break;
             case POINT_SOUTH:
               WinSetPointer(HWND_DESKTOP, InstData->SouthIcon);   // Scroll-down poineter
               break;
           }
 
           return (MRESULT)TRUE;  /* Note we processed the message */

      case WM_BEGINDRAG:
           {
           SHORT  Max;
           SHORT i, CursorIndx, hit;

           /* User started dragging with the pointer on our window */

           Max = (SHORT)WinSendMsg( hwnd, LM_QUERYITEMCOUNT, 0L, 0L );

           /* If we are currently dragging, cancel it (should not happen) */
 
           if ( InstData->Dragging ) {
             InstData->Dragging = FALSE;
             WinSetCapture( HWND_DESKTOP, NULLHANDLE );
             return (MRESULT)FALSE;
           }

           /* Get index of item under the mouse pointer and check */
           /* for reasonable numeric bounds.                      */
 
           CursorIndx = DMLBLocateListboxItem(hwnd, hwnd, SHORT2FROMMP(mp1), LLI_UNDER);
           if ((Max == 0) || (CursorIndx+1 > Max)) {
             DosBeep( 440L, 50L );  // Don't allow drag if not on a listbox item
             return (MRESULT)FALSE;
           }

           /* Since we currently support dragging only a single item, */
           /* de-select all items and just select the one under the   */
           /* pointer.  To support multiple-drag we would probably    */
           /* need to notify the owner so they could set the selection*/
           /* status of all items to be dragged (which may or may not */
           /* include the item under the pointer).                    */

           WinSendMsg(hwnd, LM_SELECTITEM, MPFROMSHORT(LIT_NONE), MPVOID);
           WinSendMsg(hwnd, LM_SELECTITEM, MPFROMSHORT(CursorIndx), MPFROMSHORT(TRUE));

           /* Note we are now dragging and capture the pointer. */
 
           InstData->Dragging = TRUE;
           WinSetCapture( HWND_DESKTOP, hwnd );
           InstData->PrevLocation = POINT_INSIDE;
           WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,DRAG_TIMERID, WinQuerySysValue(HWND_DESKTOP, SV_SCROLLRATE));
           return (MRESULT)TRUE;
           break;
           }
 
      case WM_ENDDRAG:
            {
            SHORT DropIndx, CurrIndx;
            SHORT SourceMax, TargetMax;      /* Num of items in source/target listbox */
            char  *CopyText;                 /* Text to be copied/moved */
            USHORT CopyTextLen;              /* Length of text */
            void   *CopyHand;                /* Handle of item to be copied/moved */
            BOOL  SameList = FALSE;          /* Source and target are same listbox */
 
            if (!InstData->Dragging)         /* Ignore if we are not dragging */
              return (MRESULT)FALSE;
 
            /* Clear dragging indicators and release pointer */

            InstData->Dragging = FALSE;
            WinSetCapture( HWND_DESKTOP, NULLHANDLE );
            WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,DRAG_TIMERID);

            /* See if what is under the pointer will accept the drop */
            DMLBCheckTargetLocation(hwnd, InstData, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1));
            if (InstData->PrevLocation != POINT_INSIDE)
              return (MRESULT)TRUE;  /* Ignore drop outside a good listbox */

            if (hwnd == InstData->TargetHwnd)  // Source and target are same listbox
              SameList = TRUE;

            SourceMax = (SHORT)WinSendMsg(hwnd, LM_QUERYITEMCOUNT, 0L, 0L ) -1;
            TargetMax = (SHORT)WinSendMsg(InstData->TargetHwnd, LM_QUERYITEMCOUNT, 0L, 0L ) -1;

            /* Get drop point and original selected point */

            DropIndx = DMLBLocateListboxItem(InstData->TargetHwnd, hwnd, SHORT2FROMMP(mp1), LLI_INSERTPOINT);
            CurrIndx = (SHORT)WinSendMsg(hwnd, LM_QUERYSELECTION, MPFROMSHORT(LIT_FIRST), 0L);

            /* Prevent move onto same item as source, in same listbox           */
            /* being careful of DropIndx > SourceMax when drop after last item. */
            if ((InstData->TargetDropMode==DROPMODE_MOVE) &&
                (SameList) &&
                ((min(DropIndx,SourceMax) == CurrIndx) || (DropIndx == CurrIndx+1))) {
              DosBeep( 700L, 50L );  /* Don't drop before or after original */
              return (MRESULT)TRUE;
            }

            /* Make a copy of original to insert */

            CopyTextLen = (SHORT)WinSendMsg(hwnd,LM_QUERYITEMTEXTLENGTH,MPFROMSHORT(CurrIndx), 0L) + 1;
            CopyText = malloc(CopyTextLen);
            WinSendMsg(hwnd, LM_QUERYITEMTEXT, MPFROM2SHORT(CurrIndx, CopyTextLen), MPFROMP(CopyText));
            CopyHand = WinSendMsg(hwnd, LM_QUERYITEMHANDLE, MPFROMSHORT(CurrIndx), 0L);

            /* Insert before insertion point, or at end of list */
            if (DropIndx > TargetMax)
              DropIndx = LIT_END;

            /* Disable update during insert/delete for smoother visual and */
            /* prevent ownerdraw from occuring before new handles are set. */

            WinEnableWindowUpdate(hwnd, FALSE);
            WinEnableWindowUpdate(InstData->TargetHwnd, FALSE);
            
            /* Insert into target list */
            if (InstData->TargetDropMode != DROPMODE_DELETE) {
              DropIndx = (SHORT)WinSendMsg(InstData->TargetHwnd, LM_INSERTITEM, MPFROMSHORT(DropIndx), MPFROMP(CopyText));
              WinSendMsg(InstData->TargetHwnd, LM_SETITEMHANDLE, MPFROMSHORT(DropIndx), MPFROMP(CopyHand));
            }
            free(CopyText);

            /* Tell owner of originating listbox what we are doing.  We must notify */
            /* the owner before we delete items because they may keep dynamic data  */
            /* in the item handles that has to be freed.  The item in question is   */
            /* the currently selected item in the listbox.                          */

            switch (InstData->TargetDropMode) {
              case DROPMODE_MOVE:
                 if (!SameList)
                   WinSendMsg(WinQueryWindow(hwnd, QW_OWNER), WM_CONTROL,
                           MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), LN_DMLB_DELETE_MOVE),
                           MPFROMHWND(InstData->TargetHwnd));
                 break;
              case DROPMODE_DELETE:
                 WinSendMsg(WinQueryWindow(hwnd, QW_OWNER), WM_CONTROL,
                           MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), LN_DMLB_DELETE),
                           MPFROMHWND(InstData->TargetHwnd));
                 break;
            }

            /* If this is a move, delete original.  If it is in the same  */
            /* listbox as target, get new index since it may have         */
            /* changed due to inserted copy.                              */

            if ((InstData->TargetDropMode == DROPMODE_MOVE) || (InstData->TargetDropMode == DROPMODE_DELETE)) {
              CurrIndx = (SHORT)WinSendMsg(hwnd, LM_QUERYSELECTION, MPFROMSHORT(LIT_FIRST), 0L);
              WinSendMsg(hwnd, LM_DELETEITEM, MPFROMSHORT(CurrIndx), 0L);
            }

            /* Select the newly inserted item.  If the old copy was             */
            /* above it in the same list, then the item number has changed by 1 */

            if ((DropIndx > CurrIndx) && (SameList) && (InstData->TargetDropMode==DROPMODE_MOVE))
              DropIndx--;
            if (InstData->TargetDropMode != DROPMODE_DELETE) {
              WinSendMsg(InstData->TargetHwnd, LM_SELECTITEM, MPFROMSHORT(LIT_NONE), MPFROMSHORT(FALSE));
              WinSendMsg(InstData->TargetHwnd, LM_SELECTITEM, MPFROMSHORT(DropIndx), MPFROMSHORT(TRUE));
            }

            WinEnableWindowUpdate(hwnd, TRUE);
            WinEnableWindowUpdate(InstData->TargetHwnd, TRUE);

            /* Notify target of inserted items if necessary */

            switch (InstData->TargetDropMode) {
              case DROPMODE_MOVE:
                if (SameList)
                   WinSendMsg(WinQueryWindow(InstData->TargetHwnd, QW_OWNER), WM_CONTROL,
                         MPFROM2SHORT(WinQueryWindowUShort(InstData->TargetHwnd, QWS_ID), LN_DMLB_REORDERED),
                         MPFROMHWND(hwnd));
                else
                   WinSendMsg(WinQueryWindow(InstData->TargetHwnd, QW_OWNER), WM_CONTROL,
                         MPFROM2SHORT(WinQueryWindowUShort(InstData->TargetHwnd, QWS_ID), LN_DMLB_INSERT_MOVE),
                         MPFROMHWND(hwnd));
                break;
              case DROPMODE_COPY:
                WinSendMsg(WinQueryWindow(InstData->TargetHwnd, QW_OWNER), WM_CONTROL,
                         MPFROM2SHORT(WinQueryWindowUShort(InstData->TargetHwnd, QWS_ID), LN_DMLB_INSERT_COPY),
                         MPFROMHWND(hwnd));
                break;
            }

            return (MRESULT)TRUE;
            }
 
      }
 
   /* Call previous window procedure to process this message */
   return ( (*(InstData->OldProcAddr)) ( hwnd, msg, mp1, mp2 )  );
   }
static MRESULT EXPENTRY launchPadWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
{
  WPFolder* thisPtr;
  launchPad * lp;
  LPObject *lpo;
  static USHORT id=0;//Initialisation new in V1.00a 

  switch(msg)
    {
#if 0
    case DM_ENDCONVERSATION:
    case DM_DRAGFILECOMPLETE:
    case DM_DROPNOTIFY:
    case DM_FILERENDERED:
    case DM_RENDERCOMPLETE:

break;
      return (MRESULT)FALSE;
    case WM_ENDDRAG:

      break;
      return (MRESULT)TRUE;
#endif
    case WM_PAINT:
      {
      RECTL rcl;
      launchPad * lp;

      HPS hps=WinBeginPaint(hwnd,NULLHANDLE, &rcl);
      WinFillRect(hps, &rcl, SYSCLR_DIALOGBACKGROUND);
      lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER);
      if(lp) {
        if(lp->lpQueryNumObjects()==0) {
          WinQueryWindowRect(hwnd,&rcl);
          WinDrawBorder(hps,&rcl,1,1,SYSCLR_WINDOWFRAME,SYSCLR_DIALOGBACKGROUND, DB_STANDARD);
        }
      }
      WinEndPaint(hps);
      return (MRESULT) 0;
      }
    case DM_DRAGOVER:
      return handleDragOver(hwnd, mp1, mp2);
    case DM_DROP:
      {
        ULONG ulCount;
        ULONG ulNumberOfObjects;
        PDRAGITEM pDragItem;
        SOMClass *folderClass;
        WPObject * wpObject;
        PDRAGINFO pDragInfo;
       
        TRY_LOUD(LP_FRAMEDROP) { 
          /* A new object dropped on the launchpad */
          pDragInfo=(PDRAGINFO)mp1;
          if(DrgAccessDraginfo(pDragInfo)) {
            /* Get number of items */
            ulNumberOfObjects = DrgQueryDragitemCount( pDragInfo);           
            if(ulNumberOfObjects>1){
              /* Free the draginfo */
              DrgDeleteDraginfoStrHandles(pDragInfo);
              DrgFreeDraginfo(pDragInfo);
            }
            else { 
              ulCount=0;
              
              pDragItem=DrgQueryDragitemPtr( pDragInfo, ulCount);
              wpObject=(WPObject*)OBJECT_FROM_PREC(DrgQueryDragitemPtr( pDragInfo, ulCount)->ulItemID);
              lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER);
              if(lp) {
                if(somIsObj(wpObject)) {
  
                  POINTL ptl;
                  int numB;
                  SWP swp;
                  
                  WinQueryWindowPos(hwnd,&swp);
                  ptl.x=pDragInfo->xDrop;
                  ptl.y=pDragInfo->yDrop;
                  /* Pos in window coords */
                  WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
                  numB=(ptl.x-xButtonOffset)/(swp.cy+xButtonDelta);
                  numB=((ptl.x-numB*swp.cy) > swp.cy/2 ? numB+1: numB);

                  /* Do a link */
                  lp->lpAddButton(wpObject, numB);
                  handleDragLeave(hwnd, mp1, mp2);
                }
              }
              DrgDeleteDraginfoStrHandles(pDragInfo);
              DrgFreeDraginfo(pDragInfo);
            }
          }
          handleDragLeave(hwnd, mp1, mp2);
        }
        CATCH(LP_FRAMEDROP)
          {
          } END_CATCH;
          
          break;
      }
    case DM_DRAGLEAVE:
      return handleDragLeave(hwnd, mp1, mp2);
      break;
    case WM_COMMAND:
      if(SHORT1FROMMP(mp2)==CMDSRC_PUSHBUTTON) {
        /* It's a push button */
        lpo=(LPObject*)WinQueryWindowULong(WinWindowFromID(hwnd,SHORT1FROMMP(mp1)),QWL_USER);
        if(lpo) {
          if(somIsObj(lpo->wpObject))
            lpo->wpObject->wpViewObject(NULLHANDLE, OPEN_DEFAULT,0);
        }
      }
      return (MRESULT)FALSE;
      /***********************************************/
      /* Stuff for fly over help                     */ 
    case WM_MOUSEMOVE:
      launchPad * lp;

      lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER);
      if(lp) {
        if(lp->lpQueryNumObjects()!=0) {
          break;
        }
      }
      
#if 0
      tempID=WinQueryWindowUShort(hwnd,QWS_ID);/*  get the id of the window under the pointer  */  			
      if(id!=tempID) {	// New Button?	
        WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,tempID,(ULONG)iTBFlyOverDelay); // New timer for delay
        id=tempID;  // Save ID 
      }
      else {
        if(!hwndBubbleWindow)
          WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,tempID,(ULONG)iTBFlyOverDelay); // New timer for delay	
      }
#endif
      if(!hwndBubbleWindow)
        WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, 2,(ULONG)iTBFlyOverDelay); // New timer for delay	

      break;
    case WM_DESTROY:
      WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,1);//Stop timer if running
      if(hwndBubbleWindow)
        WinDestroyWindow(hwndBubbleWindow);/*  close the bubblewindow  */
      hwndBubbleWindow=0;
      /* Stop delay timer if running */
      WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd, 2);			
      break;

    case WM_NEWBUBBLE:
      ULONG bubbleEnabled;
      HWND hwndStore;
      POINTL ptl;
      RECTL  rclWork;
      LONG  ulWinTextLen;
      POINTL aptlPoints[TXTBOX_COUNT];
      LONG   deltaX,deltaY;
      HPS  hps;
      RECTL   rcl;
  
      /*  we have to build a new information window  */
      if(hwndBubbleWindow){// if(){...} new in V1.00a 
        WinDestroyWindow(hwndBubbleWindow);/*  close the bubblewindow  */
        hwndBubbleWindow=NULL;
      }
      // Query the pointer position
      WinQueryPointerPos(HWND_DESKTOP,&ptl);
      WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1);
      WinQueryWindowRect(hwnd,&rclWork);				
      if(!hwndBubbleWindow 
         && WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl)
         && bTBFlyOverEnabled) {
        
        static HWND hwndBubbleClient;
        ULONG style=FCF_BORDER|FCF_NOBYTEALIGN;
        char winText[255];
        
        /* Get window text for size calculating */
            lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER);
        if(lp) {
          strncpy(winText, lp->lpQueryFlyOverText(), sizeof(winText));
          winText[sizeof(winText)-1]=0;
        }

        ulWinTextLen=(LONG)strlen(winText); // Query text length
        
        /* Delete 'Returns' in object title */
        char *pBuchst;
        char *pRest;
        pRest=winText;
        while((pBuchst=strchr(pRest,13))!=NULL) {
          *pBuchst=' ';
          pBuchst++;
          if(*pBuchst==10)
            *pBuchst=' ';
          pRest=pBuchst;
        }
        
        /* Create help window */
        hwndBubbleWindow=WinCreateStdWindow(HWND_DESKTOP,
                                            0,
                                            &style,
                                            WC_STATIC,
                                            "",
                                            SS_TEXT|DT_CENTER|DT_VCENTER,
                                            NULLHANDLE,
                                            400,
                                            &hwndBubbleClient);

        hwndShadow=WinCreateWindow(HWND_DESKTOP,
                                   WC_STATIC,
                                   "",
                                   SS_TEXT|DT_CENTER|DT_VCENTER,
                                   0, 0,
                                   0, 0,
                                   hwndBubbleWindow,
                                   hwndBubbleWindow,
                                   401,
                                   NULLHANDLE,
                                   NULLHANDLE);
        oldProc=WinSubclassWindow(hwndShadow, shadowProc);

        // Set the font for the help
        WinSetPresParam(hwndBubbleClient,PP_FONTNAMESIZE,
                        sizeof(chrTBFlyFontName),
                        chrTBFlyFontName);
        /* Calculate text size in pixel */
        hps=WinBeginPaint(hwndBubbleClient,(HPS)NULL,(PRECTL)NULL);
        GpiQueryTextBox(hps,ulWinTextLen,winText,TXTBOX_COUNT,aptlPoints);
        WinEndPaint(hps);
        
        /* Set colors */
        WinSetPresParam(hwndBubbleClient,
                        PP_BACKGROUNDCOLOR,sizeof(rgbTBFlyBackground) ,
                        &rgbTBFlyBackground );
        WinSetPresParam(hwndBubbleClient,
                        PP_FOREGROUNDCOLOR,sizeof(rgbTBFlyForeground) ,
                        &rgbTBFlyForeground );
        
        /* Calculate bubble positon and show bubble */
        WinQueryPointerPos(HWND_DESKTOP,&ptl);//Query pointer position in the desktop window
        WinQueryWindowRect(HWND_DESKTOP,&rcl);//Query desktop size
        aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+7+xVal+ptl.x 
          > rcl.xRight 
          ? deltaX=-aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x-xVal-xVal-7 
	      : deltaX=0 ;
        
        aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2+yVal+ptl.y 
          > rcl.yTop 
          ? deltaY=-aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y-2*yVal-7
	      : deltaY=0 ;		
        WinSetWindowPos(hwndBubbleWindow,
                        HWND_TOP,
                        ptl.x+xVal+deltaX,ptl.y+yVal+deltaY,  
                        aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+8,
                        aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2,
                        SWP_ZORDER|SWP_SIZE|SWP_MOVE|SWP_SHOW);

        WinSetWindowPos(hwndShadow,
                        hwndBubbleWindow,
                        ptl.x+xVal+deltaX+5
                        ,ptl.y+yVal+deltaY-5,  
                        aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+8,
                        aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2,
                        SWP_ZORDER|SWP_SIZE|SWP_MOVE|SWP_SHOW);
        
        /* Set bubble text */
        WinSetWindowText(hwndBubbleClient,winText);
        WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,1,35); 
      } // end if(!hwndBubbleWindow)
      break;
    case WM_TIMER:
      switch (SHORT1FROMMP(mp1))
        {
        case 1: //Intervall timer
          {
            POINTL ptl;
            RECTL  rclWork;

            /* Test pointer position */
            WinQueryPointerPos(HWND_DESKTOP, &ptl);
            WinMapWindowPoints(HWND_DESKTOP, hwnd,&ptl, 1);
            WinQueryWindowRect(hwnd, &rclWork);
            if(!WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl))
              {	// Window has changed				 
                WinStopTimer(WinQueryAnchorBlock(hwnd), hwnd, 1);  // stop the running timer
                if(hwndBubbleWindow) 
                  WinDestroyWindow(hwndBubbleWindow);/*  close the bubblewindow  */
                hwndBubbleWindow=0;
                id=0;
              }			 			
          break;
          }
        case 2:// delay over
          {//our own timer.
            POINTL ptl;
            RECTL  rclWork;

            WinStopTimer(WinQueryAnchorBlock(hwnd), hwnd, 2);//Stop the delay timer
            /* Check the pointer position */
            WinQueryPointerPos(HWND_DESKTOP,&ptl);
            WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1);
            WinQueryWindowRect(hwnd,&rclWork);
            if(WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl))
              WinPostMsg(hwnd,WM_NEWBUBBLE,NULL,NULL);//Request a help window
            return (MRESULT)FALSE;
          }
        default:
          break;
        }
      break;
    default:
      break;    
    }
  return pfnwpOldLPProc(hwnd, msg, mp1, mp2);
}
Exemple #30
0
/*----------------------------------------------------------------------*/
SHORT DMLBLocateListboxItem( HWND hwnd, HWND RelHwnd, SHORT Y, SHORT Option )
/*----------------------------------------------------------------------*/
/* Parameters:                                                          */
/*   hwnd         Listbox of interest                                   */
/*   RelHwnd      Window to which Y is relative to                      */
/*   Y            Y position of the pointer                             */
/*   Option       LLI_UNDER to return index of item under pointer,      */
/*                LLI_INSERTPOINT to index of item nearest insert point */
/*----------------------------------------------------------------------*/
/* Given a Y window coordinate, this function will calculate the item   */
/* number of the listbox item at that position.  The LLI_UNDER option   */
/* will return the item directly under the pointer.  The LLI_INSERTPOINT*/
/* option will return the item number *before* which an insertion should*/
/* be made (drop zones are calculated as the half-way points through    */
/* each item).                                                          */
/*----------------------------------------------------------------------*/
{
   RECTL   Rect;
   POINTL  Points[2];
   HPS     hps;
   LONG    VertSize;
   SHORT   ItemNum;
   char    ClassName[10];

   /* Map coordinate from window it is relative to, to win of interst*/
   Points[0].x = 0;
   Points[0].y = Y;
   WinMapWindowPoints(RelHwnd, hwnd, &(Points[0]), 1L);
   Y = Points[0].y;

   /* If this is actually a MultiColumn ListBox, we must find the    */
   /* real listbox which is the first column and use it for our      */
   /* location calculations.  Since we only care about the Y         */
   /* coordinate we only need to look at the 1st column of the MCLB. */

   WinQueryClassName(hwnd, sizeof(ClassName), ClassName);
   if (!strcmp("MCLBCls", ClassName))
     hwnd = WinWindowFromID(hwnd, 1);   /* Get handle of 1st column's listbox */

   /* If this is an OWNERDRAW listbox, ask owner how big items are.  */

   VertSize = 0;
   if (WinQueryWindowULong(hwnd, QWL_STYLE) & LS_OWNERDRAW)
     VertSize = SHORT1FROMMR(                               // Take returned Height
                WinSendMsg(WinQueryWindow(hwnd, QW_OWNER),  // Query owner of listbox
                   WM_MEASUREITEM,                          // Ask owner the size
                   MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),  // Listbox ID
                   MPFROMSHORT(0)));                        // First item

   if (VertSize == 0) {
     /* For a normal listbox, items are the size of the font.  To */
     /* determine the size we get the bounding box of a space.    */
     hps = WinGetPS(hwnd);
     GpiQueryTextBox(hps, 1L, " ", 2, Points);
     VertSize = Points[TXTBOX_TOPLEFT].y - Points[TXTBOX_BOTTOMLEFT].y;
     WinReleasePS(hps);
   }

   WinQueryWindowRect(hwnd, &Rect);
   Rect.yTop = Rect.yTop-2;         /* Listbox frame is 2 pixels */

   /* Calculate item number of item under the pointer */
   ItemNum = (SHORT)WinSendMsg(hwnd, LM_QUERYTOPINDEX, 0L, 0L)
             + ((Rect.yTop-Y)/VertSize);

   /* Return item under pointer, or insertion point */

   switch (Option) {
     case LLI_UNDER:
       return ItemNum;
     case LLI_INSERTPOINT:
       if (((Rect.yTop-Y) % VertSize) <= (VertSize / 2))
         return ItemNum;
       return ItemNum+1;  /* Note: May exceed num of items in list */
   }
}