Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2007

Tip: Looking for answers? Try searching our database.

SystemParametersInfo call hanging.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Flyte - 15 Jan 2007 21:01 GMT
Due to the nature of our application, it is necessary to set a system
setting that increases the size of the scrollbars when the application
is the "active" one. When it is not, the system setting is reverted so
that the scrollbars appear in their normal size.

To achieve this, I am overriding the WndProc method and checking if the
message received is WM_ACTIVATEAPP, (this is the message received when
the application gets focus). Upon receipt, I make a call a call to the
user32.dll call SystemParametersInfo to make a change to the scrollbar
size.

This seems to work just fine, but when my application receives a
SystemEvent.PowerModeChanged or SystemEvent.DisplaySettings event, my
call to SystemParametersInfo (called via the WndProc override) seems to
hang... and I can't figure out why.

Does anyone have any ideas on why the call to SystemParametersInfo
would hang? It requires the user to kill the application.

Thanks,
Flyte - 15 Jan 2007 21:20 GMT
Sorry for the double post - not sure what happened there.

Anyways, here is my WndProc method:

     protected override void WndProc(ref Message m)
     {
           if (m.Msg == WM_ACTIVATEAPP)
           {
              if (m.WParam == IntPtr.Zero)
              {
                 ToggleNonClientAreaControls(false);
              }
              else
              {
                 ToggleNonClientAreaControls(true);
              }
           }
        }
        base.WndProc(ref m);
     }

And here is how I call SetSystemParamsInfo

      if (isTouchScreen)
        {
           result =
              SystemParametersInfo(SPI_SETNONCLIENTMETRICS,

m_touchScreenNonClientMetrics.cbSize,
                                   ref m_touchScreenNonClientMetrics,
                                   0);
        }

        else
        {
           result =
              SystemParametersInfo(SPI_SETNONCLIENTMETRICS,
                                   m_standardNonClientMetrics.cbSize,
                                   ref m_standardNonClientMetrics,
                                   0);
        }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.