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


C++ GetHWnd函数代码示例

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


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


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