Ignore:
Timestamp:
Oct 10, 1999, 10:59:41 AM (26 years ago)
Author:
sandervl
Message:

Dialog, style + window handle translation bugfixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/windlg.cpp

    r1118 r1240  
    1 /* $Id: windlg.cpp,v 1.3 1999-10-04 09:56:03 sandervl Exp $ */
     1/* $Id: windlg.cpp,v 1.4 1999-10-10 08:59:41 sandervl Exp $ */
    22/*
    33 * Win32 dialog apis for OS/2
     
    1919#include <string.h>
    2020#include <stdlib.h>
     21#include <limits.h>
     22#include <errno.h>
    2123#include "win32wbase.h"
    2224#include "win32dlg.h"
     
    316318//******************************************************************************
    317319//******************************************************************************
    318 UINT WIN32API GetDlgItemInt( HWND arg1, int arg2, PBOOL arg3, BOOL  arg4)
    319 {
    320 #ifdef DEBUG
    321     WriteLog("USER32:  GetDlgItemInt\n");
    322 #endif
    323     return O32_GetDlgItemInt(arg1, arg2, arg3, arg4);
    324 }
    325 //******************************************************************************
    326 //******************************************************************************
    327 HWND WIN32API GetNextDlgGroupItem( HWND arg1, HWND arg2, BOOL  arg3)
    328 {
    329 #ifdef DEBUG
    330     WriteLog("USER32:  GetNextDlgGroupItem\n");
    331 #endif
    332     return O32_GetNextDlgGroupItem(arg1, arg2, arg3);
     320UINT WIN32API GetDlgItemInt(HWND hwnd, INT id, BOOL *translated, BOOL fSigned)
     321{
     322  char str[30];
     323  char * endptr;
     324  long result = 0;
     325
     326    dprintf(("USER32:  GetDlgItemInt\n"));
     327    if (translated) *translated = FALSE;
     328
     329    if (!SendDlgItemMessageA(hwnd, id, WM_GETTEXT, sizeof(str), (LPARAM)str))
     330        return 0;
     331
     332    if (fSigned)
     333    {
     334        result = strtol( str, &endptr, 10 );
     335        if (!endptr || (endptr == str))  /* Conversion was unsuccessful */
     336            return 0;
     337        if (((result == LONG_MIN) || (result == LONG_MAX)) && (errno==ERANGE))
     338            return 0;
     339    }
     340    else
     341    {
     342        result = strtoul( str, &endptr, 10 );
     343        if (!endptr || (endptr == str))  /* Conversion was unsuccessful */
     344            return 0;
     345        if ((result == ULONG_MAX) && (errno == ERANGE)) return 0;
     346    }
     347    if (translated) *translated = TRUE;
     348    return (UINT)result;
     349}
     350//******************************************************************************
     351//******************************************************************************
     352HWND WIN32API GetNextDlgGroupItem( HWND hwnd, HWND hwndCtrl, BOOL fPrevious)
     353{
     354  Win32Dialog *dialog;
     355
     356    dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
     357    if(!dialog || !dialog->IsDialog()) {
     358        dprintf(("GetNextDlgGroupItem, window %x not found", hwnd));
     359        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     360        return 0;
     361    }
     362    dprintf(("USER32:  GetNextDlgGroupItem\n"));
     363    return dialog->getNextDlgGroupItem(hwndCtrl, fPrevious);
    333364}
    334365/***********************************************************************
Note: See TracChangeset for help on using the changeset viewer.