• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetHWnd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetTarget

void
AwtChoice::VerifyState()
{
    if ( AwtToolkit::GetInstance().VerifyComponents() == FALSE ) {
        return;
    }

    if ( m_callbacksEnabled == FALSE ) {
        // Component is not fully setup yet.
        return;
    }

    AwtComponent::VerifyState();

    // Compare number of items.

    JNIEnv *env;
    if ( JVM->AttachCurrentThread( (void **)&env, 0 ) != 0 ) {
        return;
    }
    jobject target = GetTarget();

    int nTargetItems = env->CallIntMethod( target,
                                           WCachedIDs.java_awt_Choice_getItemCountMID );
    int nPeerItems = (int)::SendMessage( GetHWnd(), CB_GETCOUNT, 0, 0 );
    ASSERT( nTargetItems == nPeerItems );

    // Compare selection
    int targetIndex = env->CallIntMethod( target,
                                          WCachedIDs.java_awt_Choice_getSelectedIndexMID );
    ASSERT( !env->ExceptionCheck() );
    int peerCurSel = (int)::SendMessage( GetHWnd(), CB_GETCURSEL, 0, 0 );
    ASSERT( targetIndex == peerCurSel );
    return;
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:35,代码来源:PPCChoicePeer.cpp


示例2: GetTarget

void AwtCheckbox::VerifyState()
{
    if (AwtToolkit::GetInstance().VerifyComponents() == FALSE) {
        return;
    }

    if (m_callbacksEnabled == FALSE) {
        // Component is not fully setup yet.
        return;
    }

    AwtComponent::VerifyState();

    // prehaps we don't need this?
    //jobject hTarget = GetTarget();
    //jobject target = unhand(hTarget);
    jobject target = GetTarget();

    // Check button style
    DWORD style = ::GetWindowLong(GetHWnd(), GWL_STYLE);
    ASSERT(style & BS_OWNERDRAW);

    // Check label
    int len = ::GetWindowTextLength(GetHWnd());
    TCHAR* peerStr = new TCHAR[len+1];
    GetText(peerStr, len+1);
/* FIXME */
#ifndef UNICODE
    //ASSERT(strcmp(peerStr, JavaStringBuffer(target->label)) == 0);
#else
    //ASSERT(wcscmp(peerStr, JavaStringBuffer(target->label)) == 0);
#endif /* UNICODE */
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:33,代码来源:PPCCheckboxPeer.cpp


示例3: GetPeer

// This function goes through all strings in the list to find the width,
// in pixels, of the longest string in the list.
void AwtList::UpdateMaxItemWidth()
{
    m_nMaxWidth = 0;

    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
    if (env->EnsureLocalCapacity(2) < 0)
        return;

    HDC hDC = ::GetDC(GetHWnd());

    jobject self = GetPeer(env);
    DASSERT(self);

    /* target is java.awt.List */
    jobject target = env->GetObjectField(self, AwtObject::targetID);
    jobject font = GET_FONT(target, self);

    int nCount = GetCount();
    for ( int i=0; i < nCount; i++ )
    {
        jstring jstr = GetItemString( env, target, i );
        SIZE size = AwtFont::getMFStringSize( hDC, font, jstr );
        if ( size.cx > m_nMaxWidth )
            m_nMaxWidth = size.cx;
        env->DeleteLocalRef( jstr );
    }

    // free up the shared DC and release local refs
    ::ReleaseDC(GetHWnd(), hDC);
    env->DeleteLocalRef( target );
    env->DeleteLocalRef( font );

    // Now adjust the horizontal scrollbar extent
    AdjustHorizontalScrollbar();
}
开发者ID:Gustfh,项目名称:jdk8u-dev-jdk,代码行数:37,代码来源:awt_List.cpp


示例4: HandleEvent

MsgRouting AwtCanvas::HandleEvent(MSG *msg, BOOL synthetic)
{
    if (msg->message == WM_LBUTTONDOWN || msg->message == WM_LBUTTONDBLCLK) {
        /*
         * Fix for BugTraq ID 4041703: keyDown not being invoked.
         * Give the focus to a Canvas or Panel if it doesn't have heavyweight
         * subcomponents so that they will behave the same way as on Solaris
         * providing a possibility of giving keyboard focus to an empty Applet.
         * Since ScrollPane doesn't receive focus on mouse press on Solaris,
         * HandleEvent() is overriden there to do nothing with focus.
         */
        if (AwtComponent::sm_focusOwner != GetHWnd() &&
            ::GetWindow(GetHWnd(), GW_CHILD) == NULL)
        {
            JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
            jobject target = GetTarget(env);
            env->CallStaticVoidMethod
                (AwtKeyboardFocusManager::keyboardFocusManagerCls,
                 AwtKeyboardFocusManager::heavyweightButtonDownMID,
                 target, ((jlong)msg->time) & 0xFFFFFFFF);
            env->DeleteLocalRef(target);
            AwtSetFocus();
        }
    }
    return AwtComponent::HandleEvent(msg, synthetic);
}
开发者ID:AllenWeb,项目名称:openjdk-1,代码行数:26,代码来源:awt_Canvas.cpp


示例5: DASSERT

void AwtChoice::SetFont(AwtFont* font)
{
    AwtComponent::SetFont(font);

    //Get the text metrics and change the height of each item.
    HDC hDC = ::GetDC(GetHWnd());
    DASSERT(hDC != NULL);
    TEXTMETRIC tm;
        
    HANDLE hFont = font->GetHFont();
    VERIFY(::SelectObject(hDC, hFont) != NULL);
    VERIFY(::GetTextMetrics(hDC, &tm));
    long h = tm.tmHeight + tm.tmExternalLeading;
    VERIFY(::ReleaseDC(GetHWnd(), hDC) != 0);

    int nCount = (int)::SendMessage(GetHWnd(), CB_GETCOUNT, 0, 0);
    for(int i = 0; i < nCount; ++i) {
        VERIFY(::SendMessage(GetHWnd(), CB_SETITEMHEIGHT, i, MAKELPARAM(h, 0)) != CB_ERR);
    }
    //Change the height of the Edit Box.
    VERIFY(::SendMessage(GetHWnd(), CB_SETITEMHEIGHT, (UINT)-1,
                         MAKELPARAM(h, 0)) != CB_ERR);

    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
    jobject target = GetTarget(env);
    jint height = env->GetIntField(target, AwtComponent::heightID);

    Reshape(env->GetIntField(target, AwtComponent::xID),
            env->GetIntField(target, AwtComponent::yID),
            env->GetIntField(target, AwtComponent::widthID), 
            h);

    env->DeleteLocalRef(target);
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:34,代码来源:awt_Choice.cpp


示例6: SetInsets

void AwtScrollPane::SetInsets(JNIEnv *env)
{
    RECT outside;
    RECT inside;
    ::GetWindowRect(GetHWnd(), &outside);
    ::GetClientRect(GetHWnd(), &inside);
    ::MapWindowPoints(GetHWnd(), 0, (LPPOINT)&inside, 2);

    if (env->EnsureLocalCapacity(1) < 0) {
        return;
    }
    jobject insets =
      (env)->GetObjectField(GetPeer(env), AwtPanel::insets_ID);

    DASSERT(!safe_ExceptionOccurred(env));

    if (insets != NULL && (inside.top-outside.top) != 0) {
        (env)->SetIntField(insets, AwtInsets::topID, inside.top - outside.top);
        (env)->SetIntField(insets, AwtInsets::leftID, inside.left - outside.left);
        (env)->SetIntField(insets, AwtInsets::bottomID, outside.bottom - inside.bottom);
        (env)->SetIntField(insets, AwtInsets::rightID, outside.right - inside.right);
    }

    env->DeleteLocalRef(insets);
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:25,代码来源:awt_ScrollPane.cpp


示例7: GetDropDownHeight

// calculate height of drop-down list part of the combobox
// to show all the items up to a maximum of eight
int AwtChoice::GetDropDownHeight()
{
    int itemHeight =(int)::SendMessage(GetHWnd(), CB_GETITEMHEIGHT, (UINT)0,0);
    int numItemsToShow = (int)::SendMessage(GetHWnd(), CB_GETCOUNT, 0,0);
    numItemsToShow = numItemsToShow > 8 ? 8 : numItemsToShow;
    // drop-down height snaps to nearest line, so add a
    // fudge factor of 1/2 line to ensure last line shows
    return itemHeight*numItemsToShow + itemHeight/2;
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:11,代码来源:awt_Choice.cpp


示例8: GetTotalHeight

// Recalculate and set the drop-down height for the Choice.
void AwtChoice::ResetDropDownHeight()
{
    RECT    rcWindow;

    ::GetWindowRect(GetHWnd(), &rcWindow);
    // resize the drop down to accomodate added/removed items
    int	    totalHeight = GetTotalHeight();
    ::SetWindowPos(GetHWnd(), NULL,
		    0, 0, rcWindow.right - rcWindow.left, totalHeight,
		    SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:12,代码来源:awt_Choice.cpp


示例9: DirectInput8Create

void Input::Initalize()
{
	if( pInput == NULL ) {
		HRESULT hr = DirectInput8Create(
			GetHInstace(),
			DIRECTINPUT_VERSION,
			IID_IDirectInput8,
			( LPVOID* )&pInput,
			NULL );

		if( FAILED( hr ) ) {
			CautionMessage( _T( "errorz" ), _T( "DirectInputの初期化に失敗しました" ) );
			return;
		}

		hr = pInput->CreateDevice(
			GUID_SysKeyboard,
			&pKeyDevice,
			NULL );

		if( FAILED( hr ) ) {
			CautionMessage( _T( "errorz" ), _T( "DirectInputDeviceの初期化に失敗しました" ) );
			return;
		}

		pKeyDevice->SetDataFormat( &c_dfDIKeyboard );
		pKeyDevice->SetCooperativeLevel( GetHWnd(),
			DISCL_FOREGROUND | DISCL_NONEXCLUSIVE );

		ZeroMemory( keydata, sizeof( BYTE ) * 256 );
		ZeroMemory( lastkeydata, sizeof( BYTE ) * 256 );

		enumdata ed;
		ed.pInput = pInput;
		ed.ppPadDevice = &pPadDevice;

		pInput->EnumDevices(
			DI8DEVCLASS_GAMECTRL,
			EnumJoyPad,
			&ed,
			DIEDFL_ATTACHEDONLY );

		if( pPadDevice ) {

			pPadDevice->EnumObjects( EnumObject, pPadDevice, DIDFT_AXIS );

			pPadDevice->SetCooperativeLevel( GetHWnd(),
				DISCL_FOREGROUND | DISCL_NONEXCLUSIVE );

			hr = pPadDevice->SetDataFormat( &c_dfDIJoystick2 );
			if( FAILED( hr ) ) { RELEASE( pPadDevice ); }
		}
	}
}
开发者ID:RYUSAchan,项目名称:3TimesIcecream,代码行数:54,代码来源:Input.cpp


示例10: HandleEvent

MsgRouting
AwtScrollbar::HandleEvent(MSG *msg, BOOL synthetic)
{
    if (msg->message == WM_LBUTTONDOWN || msg->message == WM_LBUTTONDBLCLK) {
        if (IsFocusable() && AwtComponent::sm_focusOwner != GetHWnd()) {
            JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
            jobject target = GetTarget(env);
            env->CallStaticVoidMethod
                (AwtKeyboardFocusManager::keyboardFocusManagerCls,
                 AwtKeyboardFocusManager::heavyweightButtonDownMID,
                 target, ((jlong)msg->time) & 0xFFFFFFFF);
            env->DeleteLocalRef(target);
            AwtSetFocus();
        }
	// Left button press was already routed to default window
	// procedure in the WmMouseDown above.  Propagating synthetic
	// press seems like a bad idea as internal message loop
	// doesn't know how to unwrap synthetic release.
	delete msg;
	return mrConsume;
    }
    else {
	return AwtComponent::HandleEvent(msg, synthetic);
    }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:25,代码来源:awt_Scrollbar.cpp


示例11: DTRACE_PRINTLN4

void AwtScrollPane::SetScrollInfo(int orient, int max, int page, 
                                  BOOL disableNoScroll)
{
    DTRACE_PRINTLN4("AwtScrollPane::SetScrollInfo %d, %d, %d, %d", orient, max, page, disableNoScroll);
    SCROLLINFO si;
    int posBefore;
    int posAfter;
    
    posBefore = GetScrollPos(orient);
    si.cbSize = sizeof(SCROLLINFO);
    si.nMin = 0;
    si.nMax = max;
    si.fMask = SIF_RANGE;
    if (disableNoScroll) {
        si.fMask |= SIF_DISABLENOSCROLL;
    }
    if (page > 0) {
        si.fMask |= SIF_PAGE;
        si.nPage = page;
    }
    ::SetScrollInfo(GetHWnd(), orient, &si, TRUE);
    // scroll position may have changed when thumb is at the end of the bar
    // and the page size changes
    posAfter = GetScrollPos(orient);
    if (posBefore != posAfter) {
	PostScrollEvent(orient, SB_THUMBPOSITION, posAfter);
    }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:28,代码来源:awt_ScrollPane.cpp


示例12: SetWindowText

	void SPWindow::SetTitle( SPString title )
	{
		modificationLock.Lock();
		SetWindowText(GetHWnd(), title.c_str());
		this->title = title;
		modificationLock.Unlock();
	}
开发者ID:denjones,项目名称:spengine,代码行数:7,代码来源:SPWindow.cpp


示例13: GetTarget

void AwtChoice::Reshape(int x, int y, int w, int h)
{
    // Choice component height is fixed (when rolled up)
    // so vertically center the choice in it's bounding box
    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
    jobject target = GetTarget(env);
    jobject parent = env->GetObjectField(target, AwtComponent::parentID);
    RECT rc;

    int fieldHeight = GetFieldHeight();
    if ((parent != NULL && env->GetObjectField(parent, AwtContainer::layoutMgrID) != NULL) &&
        fieldHeight > 0 && fieldHeight < h) {
        y += (h - fieldHeight) / 2;
    }

    int totalHeight = GetTotalHeight();
    AwtComponent::Reshape(x, y, w, totalHeight);

    /* Bug 4255631 Solaris: Size returned by Choice.getSize() does not match
     * actual size
     * Fix: Set the Choice to its actual size in the component.
     */
    ::GetClientRect(GetHWnd(), &rc);
    env->SetIntField(target, AwtComponent::widthID,  (jint)rc.right);
    env->SetIntField(target, AwtComponent::heightID, (jint)rc.bottom);

    env->DeleteLocalRef(target);
    env->DeleteLocalRef(parent);
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:29,代码来源:awt_Choice.cpp


示例14: DASSERT

/* Set a suitable font to IME against the component font. */
void AwtTextComponent::SetFont(AwtFont* font)
{
    DASSERT(font != NULL);
    if (font->GetAscent() < 0) {
        AwtFont::SetupAscent(font);
    }

    int index = font->GetInputHFontIndex();
    if (index < 0)
        /* In this case, user cannot get any suitable font for input. */
        index = 0;

    //im --- changed for over the spot composing
    m_hFont = font->GetHFont(index);
    SendMessage(WM_SETFONT, (WPARAM)m_hFont, MAKELPARAM(FALSE, 0));
    SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN,
                MAKELPARAM(1, 1));

    /*
     * WM_SETFONT reverts foreground color to the default for
     * rich edit controls. So we have to restore it manually.
     */
    SetColor(GetColor());
    VERIFY(::InvalidateRect(GetHWnd(), NULL, TRUE));
    //im --- end

}
开发者ID:sakeinntojiu,项目名称:openjdk8-jdk,代码行数:28,代码来源:awt_TextComponent.cpp


示例15: ReleaseDragCapture

/* Fix for Bug 4509045: should release capture only if it is set by SetDragCapture */
void AwtChoice::ReleaseDragCapture(UINT flags)
{
    if ((::GetCapture() == GetHWnd()) && ((flags & ALL_MK_BUTTONS) == 0) && mouseCapture) {
        ::ReleaseCapture();
        mouseCapture = FALSE;
    }
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:8,代码来源:awt_Choice.cpp


示例16: SendMessage

void AwtTextField::EditSetSel(CHARRANGE &cr) {
    SendMessage(EM_EXSETSEL, 0, reinterpret_cast<LPARAM>(&cr));

    // 6417581: force expected drawing
    if (IS_WINVISTA && cr.cpMin == cr.cpMax) {
        ::InvalidateRect(GetHWnd(), NULL, TRUE);
    }

}
开发者ID:ihaolin,项目名称:build-your-jdk7,代码行数:9,代码来源:awt_TextField.cpp


示例17: WindowProc

LRESULT AwtTextField::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
    if (message == WM_UNDO || message == EM_UNDO || message == EM_CANUNDO) {
        if (GetWindowLong(GetHWnd(), GWL_STYLE) & ES_READONLY) {
            return FALSE;
        }
    }
    return AwtTextComponent::WindowProc(message, wParam, lParam);
}
开发者ID:ihaolin,项目名称:build-your-jdk7,代码行数:9,代码来源:awt_TextField.cpp


示例18: ZeroMemory

int AwtScrollPane::GetScrollPos(int orient)
{
    SCROLLINFO si;
    ZeroMemory(&si, sizeof(si));
    si.cbSize = sizeof(si);
    si.fMask = SIF_POS;
    ::GetScrollInfo(GetHWnd(), orient, &si);
    return si.nPos;
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:9,代码来源:awt_ScrollPane.cpp


示例19: JNU_CallMethodByName

void AwtScrollPane::VerifyState()
{
    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
    if (env->EnsureLocalCapacity(3) < 0) {
        return;
    }

    if (AwtToolkit::GetInstance().VerifyComponents() == FALSE) {
        return;
    }

    if (m_callbacksEnabled == FALSE) {
        /* Component is not fully setup yet. */
        return;
    }

    AwtComponent::VerifyState();

    jobject target = AwtObject::GetTarget(env);
    jobject child = JNU_CallMethodByName(env, NULL, GetPeer(env),
                                         "getScrollSchild",
                                         "()Ljava/awt/Component;").l;

    DASSERT(!safe_ExceptionOccurred(env));

    if (child != NULL) {
        jobject childPeer =
            (env)->GetObjectField(child, AwtComponent::peerID);
        PDATA pData;
        JNI_CHECK_PEER_RETURN(childPeer);
        AwtComponent* awtChild = (AwtComponent *)pData;

        /* Verify child window is positioned correctly. */
        RECT rect, childRect;
        ::GetClientRect(GetHWnd(), &rect);
        ::MapWindowPoints(GetHWnd(), 0, (LPPOINT)&rect, 2);
        ::GetWindowRect(awtChild->GetHWnd(), &childRect);
        DASSERT(childRect.left <= rect.left && childRect.top <= rect.top);

        env->DeleteLocalRef(childPeer);
    }
    env->DeleteLocalRef(target);
    env->DeleteLocalRef(child);
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:44,代码来源:awt_ScrollPane.cpp


示例20: ZeroMemory

void AwtScrollPane::SetScrollPos(int orient, int pos) 
{
    SCROLLINFO si;
     
    ZeroMemory(&si, sizeof(si));
    si.fMask = SIF_POS;
    si.cbSize = sizeof(si);
    si.nPos = pos;
    ::SetScrollInfo(GetHWnd(), orient, &si, TRUE);
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:10,代码来源:awt_ScrollPane.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetHandle函数代码示例发布时间:2022-05-30
下一篇:
C++ GetHWND函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap