Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 788177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:19:12+00:00 2026-05-14T21:19:12+00:00

I know that HideSelection property is missing in CF. But i still need to

  • 0

I know that “HideSelection” property is missing in CF.
But i still need to handle situation when an item is selected that it remains selected (greyed) even when the control looses focus.

I have tried using this peace of code, but with no success. I get an exception in GetFocus() method and i dont know what im doing wrong.

Any help is much appreciated !

[DllImport("User32.dll")]
    static extern IntPtr GetFocus();
    [DllImport("User32.dll")]
    static extern Int32 GetWindowLong(IntPtr hwnd, Int32 integer1);
    [DllImport("User32.dll")]
    static extern IntPtr SetWindowLong(IntPtr hwnd, Int32 integer1, int integer2);

    private bool doneOnce;
    protected override void OnGotFocus(System.EventArgs e)
    {
        base.OnGotFocus(e);
        if (this.itemsTreeView != null)
        {
            this.itemsTreeView.Focus();
            if (doneOnce == false)
            {
                doneOnce = true;
                IntPtr hWnd = GetFocus();
                Int32 lS = GetWindowLong(hWnd, -16);
                lS = lS | 0x20;
                SetWindowLong(hWnd, -16, lS);
            }
        }
    }

I have put this code in my “code behind” view that holds TreeView control.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:19:13+00:00Added an answer on May 14, 2026 at 9:19 pm

    Windows CE uses coredll.dll instead of user32.dll.

    Some functions are equal on both platforms, while some are not implemented for Compact Framework. I usually check http://www.pinvoke.net for the declares.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that WSS 2.0 is obsolete, but it is still being used, and
I know that Visual Studio 11 is still in beta, but I want to
I know that != is not equal, but what does it mean when you
I know that an invalid pointer leads to undefined behaviour but how does free
I know that this Question is repeated but I can't find the answer in
I know that design patterns is generally something that's connected to OO programming, but
I know that there are more than a dozen questions about this. But I
I know that ads colors can be set up in account settings, but I
I know that there's something fishy about the malloc part, but I'm having trouble
I know that Apple's terms for apps disallows downloading and executing code, but there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.