当前位置: 首页>>代码示例>>C++>>正文


C++ GetHwnd函数代码示例

本文整理汇总了C++中GetHwnd函数的典型用法代码示例。如果您正苦于以下问题:C++ GetHwnd函数的具体用法?C++ GetHwnd怎么用?C++ GetHwnd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetHwnd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetLabel

void wxCheckBox::SetLabel( const wxString& rsLabel )
{
    wxString  sLabel=::wxPMTextToLabel(rsLabel);
    ::WinSetWindowText(GetHwnd(), (PSZ)sLabel.c_str());
} // end of wxCheckBox::SetLabel
开发者ID:EdgarTx,项目名称:wx,代码行数:5,代码来源:checkbox.cpp

示例2: SetName

bool wxGauge::Create( wxWindowOS2* pParent,
                      wxWindowID vId,
                      int nRange,
                      const wxPoint& rPos,
                      const wxSize& rSize,
                      long lStyle,
                      const wxValidator& rValidator,
                      const wxString& rsName )
{
    int nX       = rPos.x;
    int nY       = rPos.y;
    int nWidth   = rSize.x;
    int nHeight  = rSize.y;
    long lMsStyle = 0L;
    SWP vSwp;

    SetName(rsName);
#if wxUSE_VALIDATORS
    SetValidator(rValidator);
#endif
    if (pParent)
        pParent->AddChild(this);
    m_backgroundColour.Set(wxString(wxT("LIGHT GREY")));
    m_foregroundColour.Set(wxString(wxT("NAVY")));

    m_nRangeMax   = nRange;
    m_nGaugePos   = 0;
    m_windowStyle = lStyle;

    if (vId == wxID_ANY)
        m_windowId = (int)NewControlId();
    else
        m_windowId = vId;

    if (m_windowStyle & wxCLIP_SIBLINGS )
        lMsStyle |= WS_CLIPSIBLINGS;

    //
    // OS/2 will use an edit control for this, since there is not a native gauge
    // Other choices include using an armless slider but they are more difficult
    // to control and manipulate
    //

    lMsStyle = WS_VISIBLE | ES_MARGIN | ES_LEFT | ES_READONLY;
    if (m_windowStyle & wxCLIP_SIBLINGS)
        lMsStyle |= WS_CLIPSIBLINGS;

    m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
                                        ,WC_ENTRYFIELD            // Window class
                                        ,(PSZ)NULL                // Initial Text
                                        ,(ULONG)lMsStyle          // Style flags
                                        ,0L, 0L, 0L, 0L           // Origin -- 0 size
                                        ,(HWND)GetHwndOf(pParent) // owner window handle (same as parent
                                        ,HWND_TOP                 // initial z position
                                        ,(HMENU)m_windowId        // Window identifier
                                        ,NULL                     // Slider control data
                                        ,NULL                     // no Presentation parameters
                                      );

    wxAssociateWinWithHandle( m_hWnd
                              ,(wxWindowOS2*)this
                            );
    ::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this);
    fnWndProcGauge = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxGaugeWndProc);
    ::WinQueryWindowPos(m_hWnd, &vSwp);
    SetXComp(vSwp.x);
    SetYComp(vSwp.y);
    wxFont*                          pTextFont = new wxFont( 10
            ,wxMODERN
            ,wxNORMAL
            ,wxNORMAL
                                                           );
    SetFont(*pTextFont);
    if (nWidth == -1L)
        nWidth = 50L;
    if (nHeight == -1L)
        nHeight = 28L;
    SetSize( nX
             ,nY
             ,nWidth
             ,nHeight
           );
    m_nWidth  = nWidth;     // Save for GetBestSize
    m_nHeight = nHeight;
    ::WinShowWindow((HWND)GetHWND(), TRUE);
    delete pTextFont;
    return true;
} // end of wxGauge::Create
开发者ID:ExperimentationBox,项目名称:Edenite,代码行数:88,代码来源:gauge.cpp

示例3: Raise

void wxFrame::Raise()
{
    ::SetForegroundWindow(GetHwnd());
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:4,代码来源:frame.cpp

示例4: GetIcon

// ---------------------------------------------------------------------------
// our private (non virtual) message handlers
// ---------------------------------------------------------------------------
bool wxFrame::HandlePaint()
{
    RECTL vRect;

    if (::WinQueryUpdateRect(GetHWND(), &vRect))
    {
        if (m_bIconized)
        {
            //
            // Icons in PM are the same as "pointers"
            //
            const wxIcon&           vIcon = GetIcon();
            HPOINTER                hIcon;

            if (vIcon.IsOk())
                hIcon = (HPOINTER)::WinSendMsg(m_hFrame, WM_QUERYICON, 0L, 0L);
            else
                hIcon = (HPOINTER)m_hDefaultIcon;

            //
            // Hold a pointer to the dc so long as the OnPaint() message
            // is being processed
            //
            RECTL                   vRect2;
            HPS                     hPs = ::WinBeginPaint(GetHwnd(), NULLHANDLE, &vRect2);

            //
            // Erase background before painting or we get white background
            //
            OS2DefWindowProc(WM_ERASEBACKGROUND, (MPARAM)hPs, (MPARAM)&vRect2);

            if (hIcon)
            {
                RECTL                           vRect3;

                ::WinQueryWindowRect(GetHwnd(), &vRect3);

                static const int    nIconWidth = 32;
                static const int    nIconHeight = 32;
                int                 nIconX = (int)((vRect3.xRight - nIconWidth)/2);
                int                 nIconY = (int)((vRect3.yBottom + nIconHeight)/2);

                ::WinDrawPointer(hPs, nIconX, nIconY, hIcon, DP_NORMAL);
            }
            ::WinEndPaint(hPs);
        }
        else
        {
            if (!wxWindow::HandlePaint())
            {
                HPS                     hPS;
                RECTL                   vRect;

                hPS = ::WinBeginPaint( GetHwnd()
                                      ,NULLHANDLE
                                      ,&vRect
                                     );
                if(hPS)
                {
                    ::GpiCreateLogColorTable( hPS
                                             ,0L
                                             ,LCOLF_CONSECRGB
                                             ,0L
                                             ,(LONG)wxTheColourDatabase->m_nSize
                                             ,(PLONG)wxTheColourDatabase->m_palTable
                                            );
                    ::GpiCreateLogColorTable( hPS
                                             ,0L
                                             ,LCOLF_RGB
                                             ,0L
                                             ,0L
                                             ,NULL
                                            );

                    ::WinFillRect( hPS
                                  ,&vRect
                                  ,GetBackgroundColour().GetPixel()
                                 );
                    ::WinEndPaint(hPS);
                }
            }
        }
    }

    return true;
} // end of wxFrame::HandlePaint
开发者ID:chromylei,项目名称:third_party,代码行数:89,代码来源:frame.cpp

示例5:

wxGLCanvas::~wxGLCanvas()
{
    ::ReleaseDC(GetHwnd(), m_hDC);
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:4,代码来源:glcanvas.cpp

示例6: MAKELPARAM

// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
// style.
void wxNotebook::SetTabSize(const wxSize& sz)
{
    ::SendMessage(GetHwnd(), TCM_SETITEMSIZE, 0, MAKELPARAM(sz.x, sz.y));
}
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:6,代码来源:notebook.cpp

示例7: Refresh

void wxNotebook::OnSize(wxSizeEvent& event)
{
    if ( GetPageCount() == 0 )
    {
        // Prevents droppings on resize, but does cause some flicker
        // when there are no pages.
        Refresh();
        event.Skip();
        return;
    }
#ifndef __WXWINCE__
    else
    {
        // Without this, we can sometimes get droppings at the edges
        // of a notebook, for example a notebook in a splitter window.
        // This needs to be reconciled with the RefreshRect calls
        // at the end of this function, which weren't enough to prevent
        // the droppings.

        wxSize sz = GetClientSize();

        // Refresh right side
        wxRect rect(sz.x-4, 0, 4, sz.y);
        RefreshRect(rect);

        // Refresh bottom side
        rect = wxRect(0, sz.y-4, sz.x, 4);
        RefreshRect(rect);

        // Refresh left side
        rect = wxRect(0, 0, 4, sz.y);
        RefreshRect(rect);
    }
#endif // !__WXWINCE__

    // fit all the notebook pages to the tab control's display area

    RECT rc;
    rc.left = rc.top = 0;
    GetSize((int *)&rc.right, (int *)&rc.bottom);

    // save the total size, we'll use it below
    int widthNbook = rc.right - rc.left,
        heightNbook = rc.bottom - rc.top;

    // there seems to be a bug in the implementation of TabCtrl_AdjustRect(): it
    // returns completely false values for multiline tab controls after the tabs
    // are added but before getting the first WM_SIZE (off by ~50 pixels, see
    //
    // http://sf.net/tracker/index.php?func=detail&aid=645323&group_id=9863&atid=109863
    //
    // and the only work around I could find was this ugly hack... without it
    // simply toggling the "multiline" checkbox in the notebook sample resulted
    // in a noticeable page displacement
    if ( HasFlag(wxNB_MULTILINE) )
    {
        // avoid an infinite recursion: we get another notification too!
        static bool s_isInOnSize = false;

        if ( !s_isInOnSize )
        {
            s_isInOnSize = true;
            SendMessage(GetHwnd(), WM_SIZE, SIZE_RESTORED,
                    MAKELPARAM(rc.right, rc.bottom));
            s_isInOnSize = false;
        }

        // The best size depends on the number of rows of tabs, which can
        // change when the notepad is resized.
        InvalidateBestSize();
    }

#if wxUSE_UXTHEME
    // background bitmap size has changed, update the brush using it too
    UpdateBgBrush();
#endif // wxUSE_UXTHEME

    TabCtrl_AdjustRect(GetHwnd(), false, &rc);

    int width = rc.right - rc.left,
        height = rc.bottom - rc.top;
    size_t nCount = m_pages.Count();
    for ( size_t nPage = 0; nPage < nCount; nPage++ ) {
        wxNotebookPage *pPage = m_pages[nPage];
        pPage->SetSize(rc.left, rc.top, width, height);
    }


    // unless we had already repainted everything, we now need to refresh
    if ( !HasFlag(wxFULL_REPAINT_ON_RESIZE) )
    {
        // invalidate areas not covered by pages
        RefreshRect(wxRect(0, 0, widthNbook, rc.top), false);
        RefreshRect(wxRect(0, rc.top, rc.left, height), false);
        RefreshRect(wxRect(0, rc.bottom, widthNbook, heightNbook - rc.bottom),
                    false);
        RefreshRect(wxRect(rc.right, rc.top, widthNbook - rc.right, height),
                    false);
    }

//.........这里部分代码省略.........
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:101,代码来源:notebook.cpp

示例8: GetCount

void wxChoice::DoSetSize(int x, int y,
                         int width, int height,
                         int sizeFlags)
{
    int heightOrig = height;

    // the height which we must pass to Windows should be the total height of
    // the control including the drop down list while the height given to us
    // is, of course, just the height of the permanently visible part of it
    if ( height != wxDefaultCoord )
    {
        // don't make the drop down list too tall, arbitrarily limit it to 40
        // items max and also don't leave it empty
        size_t nItems = GetCount();
        if ( !nItems )
            nItems = 9;
        else if ( nItems > 24 )
            nItems = 24;

        // add space for the drop down list
        const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0);
        height += hItem*(nItems + 1);
    }
    else
    {
        // We cannot pass wxDefaultCoord as height to wxControl. wxControl uses
        // wxGetWindowRect() to determine the current height of the combobox,
        // and then again sets the combobox's height to that value. Unfortunately,
        // wxGetWindowRect doesn't include the dropdown list's height (at least
        // on Win2K), so this would result in a combobox with dropdown height of
        // 1 pixel. We have to determine the default height ourselves and call
        // wxControl with that value instead.
        int w, h;
        RECT r;
        DoGetSize(&w, &h);
        if (::SendMessage(GetHwnd(), CB_GETDROPPEDCONTROLRECT, 0, (LPARAM) &r) != 0)
        {
            height = h + r.bottom - r.top;
        }
    }

    wxControl::DoSetSize(x, y, width, height, sizeFlags);

    // If we're storing a pending size, make sure we store
    // the original size for reporting back to the app.
    if (m_pendingSize != wxDefaultSize)
        m_pendingSize = wxSize(width, heightOrig);

    // This solution works on XP, but causes choice/combobox lists to be
    // too short on W2K and earlier.
#if 0
    int widthCurrent, heightCurrent;
    DoGetSize(&widthCurrent, &heightCurrent);

    // the height which we must pass to Windows should be the total height of
    // the control including the drop down list while the height given to us
    // is, of course, just the height of the permanently visible part of it
    if ( height != wxDefaultCoord && height != heightCurrent )
    {
        // don't make the drop down list too tall, arbitrarily limit it to 40
        // items max and also don't leave it empty
        unsigned int nItems = GetCount();
        if ( !nItems )
            nItems = 9;
        else if ( nItems > 24 )
            nItems = 24;

        // add space for the drop down list
        const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0);
        height += hItem*(nItems + 1);
    }
    else // keep the same height as now
    {
        // normally wxWindow::DoSetSize() checks if we set the same size as the
        // window already has and does nothing in this case, but for us the
        // check fails as the size we pass to it includes the dropdown while
        // the size returned by our GetSize() does not, so test if the size
        // didn't really change ourselves here
        if ( width == wxDefaultCoord || width == widthCurrent )
        {
            // size doesn't change, what about position?
            int xCurrent, yCurrent;
            DoGetPosition(&xCurrent, &yCurrent);
            const bool defMeansUnchanged = !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE);
            if ( ((x == wxDefaultCoord && defMeansUnchanged) || x == xCurrent)
                    &&
                 ((y == wxDefaultCoord && defMeansUnchanged) || y == yCurrent) )
            {
                // nothing changes, nothing to do
                return;
            }
        }

        // We cannot pass wxDefaultCoord as height to wxControl. wxControl uses
        // wxGetWindowRect() to determine the current height of the combobox,
        // and then again sets the combobox's height to that value. Unfortunately,
        // wxGetWindowRect doesn't include the dropdown list's height (at least
        // on Win2K), so this would result in a combobox with dropdown height of
        // 1 pixel. We have to determine the default height ourselves and call
        // wxControl with that value instead.
//.........这里部分代码省略.........
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:101,代码来源:choice.cpp

示例9: return

void *wxListBox::DoGetItemClientData(unsigned int n) const
{
    return (void *)SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0);
}
开发者ID:mark711,项目名称:Cafu,代码行数:4,代码来源:listbox.cpp

示例10: SendMessage

void wxChoice::SetSelection(int n)
{
    SendMessage(GetHwnd(), CB_SETCURSEL, n, 0);
}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:4,代码来源:choice.cpp

示例11: return

unsigned int wxChoice::GetCount() const
{
    return (unsigned int)SendMessage(GetHwnd(), CB_GETCOUNT, 0, 0);
}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:4,代码来源:choice.cpp

示例12: NewControlId

bool wxSpinButton::Create(
  wxWindow*                         pParent
, wxWindowID                        vId
, const wxPoint&                    rPos
, const wxSize&                     rSize
, long                              lStyle
, const wxString&                   rsName
)
{
    int                             nX      = rPos.x;
    int                             nY      = rPos.y;
    int                             nWidth  = rSize.x;
    int                             nHeight = rSize.y;
    SWP                             vSwp;

    m_min = 0;
    m_max = 100;
    if (vId == -1)
        m_windowId = NewControlId();
    else
        m_windowId = vId;
    m_backgroundColour = pParent->GetBackgroundColour();
    m_foregroundColour = pParent->GetForegroundColour();
    SetName(rsName);
    SetParent(pParent);
    m_windowStyle      = lStyle;

    //
    // Get the right size for the control
    //
    if (nWidth <= 0 || nHeight <= 0 )
    {
        wxSize                      vSize = DoGetBestSize();

        if (nWidth <= 0 )
            nWidth = vSize.x;
        if (nHeight <= 0 )
            nHeight = vSize.y;
    }
    if (nX < 0 )
        nX = 0;
    if (nY < 0 )
        nY = 0;

    long                            lSstyle = 0L;

    lSstyle = WS_VISIBLE      |
              WS_TABSTOP      |
              SPBS_MASTER     | // We use only single field spin buttons
              SPBS_NUMERICONLY; // We default to numeric data

    if (m_windowStyle & wxCLIP_SIBLINGS )
        lSstyle |= WS_CLIPSIBLINGS;

    m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent)
                                       ,WC_SPINBUTTON
                                       ,(PSZ)NULL
                                       ,lSstyle
                                       ,0L, 0L, 0L, 0L
                                       ,GetWinHwnd(pParent)
                                       ,HWND_TOP
                                       ,(HMENU)vId
                                       ,NULL
                                       ,NULL
                                      );
    if (m_hWnd == 0)
    {
        return FALSE;
    }
    SetRange(m_min, m_max);
    if(pParent)
        pParent->AddChild((wxSpinButton *)this);

    ::WinQueryWindowPos(m_hWnd, &vSwp);
    SetXComp(vSwp.x);
    SetYComp(vSwp.y-5); // compensate for the associated TextControl border

    SetFont(*wxSMALL_FONT);
    //
    // For OS/2 we want to hide the text portion so we can substitute an
    // independent text ctrl in its place.
    // Therefore we must override any user given width with our best guess.
    //
    SetSize( nX - GetXComp()
            ,nY - GetYComp()
            ,nWidth
            ,nHeight
           );
    wxAssociateWinWithHandle( m_hWnd
                             ,(wxWindowOS2*)this
                            );
#if 0
    // FIXME:
    // Apparently, this does not work, as it crashes in setvalue/setrange calls
    // What's it supposed to do anyway?
    ::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this);
    fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc);
#endif
    return TRUE;
} // end of wxSpinButton::Create
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:100,代码来源:spinbutt.cpp

示例13: MPFROMLONG

void wxSpinButton::SetValue(
  int                               nValue
)
{
    ::WinSendMsg(GetHwnd(), SPBM_SETCURRENTVALUE, MPFROMLONG(nValue), MPARAM(0));
} // end of wxSpinButton::SetValue
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:6,代码来源:spinbutt.cpp

示例14: TabCtrl_GetRowCount

int wxNotebook::GetRowCount() const
{
    return TabCtrl_GetRowCount(GetHwnd());
}
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:4,代码来源:notebook.cpp

示例15: SendChildMessage

void CMemoryView::InfoProc(ePipeline& Info)
{
    SendChildMessage(GetHwnd(),INFO_PROC,(int64)&Info,0);
}
开发者ID:GMIS,项目名称:GMIS,代码行数:4,代码来源:MemoryView.cpp


注:本文中的GetHwnd函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。