473,698 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SystemParameter sInfo Failing in VB.net "Slide Open Combo Boxes"

1 New Member
Could not figure out on how to reply to the last article with the same name. When I logged out it asked me to login and when I logged in there was no "post your reply" option, perhaps there is functional bug on this website, anyhow.

I had a similar problem where getting the value was okay but saving the value did not work, so I hope my solution helps, if someone else has a similar issue of understanding how to declare and use api functions.

[FYI: I was designing a user drawn combobox and the "Slide Open Combo Boxes" windows setting was effecting the display of the drop down portion of combo box. I got no text in the header portion and if my DataSource was only a few rows it showed no data at all and the height of the combo was only a few pixels !!?? My workaround was to toggle this windows setting value off then on again in the DropDown and DropDownClosed events respectively:
Expand|Select|Wrap|Line Numbers
  1. <DllImport("user32.dll", EntryPoint:="SystemParametersInfoA", SetLastError:=True, _
  2.                CharSet:=CharSet.Ansi, ExactSpelling:=True, _
  3.                CallingConvention:=CallingConvention.StdCall)> _
  4.     Private Function SystemParametersInfoGet(ByVal uiAction As SPI_INDEX, ByVal uiParam As UInteger, _
  5.                                           ByRef lpenabled As Boolean, ByVal fWinIni As UInteger) As Boolean
  6.     End Function
  7.     <DllImport("user32.dll", EntryPoint:="SystemParametersInfoA", SetLastError:=True, _
  8.                CharSet:=CharSet.Ansi, ExactSpelling:=True, _
  9.                CallingConvention:=CallingConvention.StdCall)> _
  10.     Private Function SystemParametersInfoSet(ByVal uiAction As SPI_INDEX, ByVal uiParam As UInteger, _
  11.                                           ByVal lpenabled As Boolean, ByVal fWinIni As UInteger) As Boolean
  12.     End Function
  13.  
  14.     Public Function SlideOpenComboBoxes(ByVal TurnOn As Boolean) As Boolean
  15.         Dim fResult As Boolean
  16.         Dim spValue As UInteger
  17.         Dim originalMaskOn As Boolean
  18.  
  19.         fResult = SystemParametersInfoGet(SPI_INDEX.SPI_GETCOMBOBOXANIMATION, 0, originalMaskOn, SPFIPersistance_INDEX.SPFI_NONE)
  20.         Dim oWin32Ex As New Win32Exception()
  21.         If fResult Then
  22.             If TurnOn <> originalMaskOn Then
  23.                 fResult = SystemParametersInfoSet(SPI_INDEX.SPI_SETCOMBOBOXANIMATION, 0, TurnOn, SPFIPersistance_INDEX.SPFI_NONE)
  24.                 oWin32Ex = New Win32Exception()
  25.             End If
  26.         End If
  27.         If Not fResult Then
  28.             Throw oWin32Ex
  29.         End If
  30.         Return originalMaskOn
  31.     End Function
  32. End Module
I noticed 2 difference in the code snippets provided from the previous article compared to my solution above:
  1. The first was the order of calling the parameters. I passed the variable I want to get or set into the call to the api as the third parameter. The previous article had Return = SystemParameter sInfo(SPI_SETSC REENSAVEACTIVE, lActiveFlag, 0, 0), so maybe the order is incorrect if I am not mistaken.
  2. The other difference is I have two references to the api declaration, one for getting and the other for setting. The difference is use of ByVal (for setting) versus ByRef (for Getting) for the third parameter.
My solution was purely a trial an error effort I came to after googling and reading enough articles. I wish there was some documentation of the do's and dont's of API calling.

Without giving you my entire code base, if anyone else has experience owner drawing issues where this setting effected your code I would like to hear about your short comings and thus your work arounds and solutions to your issues.
Jul 27 '11 #1
0 4017

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4649
by: Loreen | last post by:
I have been going through user groups and forums for the past 3 hours trying to figure out how to add "all" to my combo boxes. I've got two unbound comboboxes. Once only has one field "FiscalYear" and the other had two "DonationTypeID" and "DonationType". Both comboboxes have Table/Query as the control RowSourceType and I setup the RowSource through the query wizard interface. Using the instructions I found at...
1
2244
by: Niranjan | last post by:
I have a relatively straight forward report. The query that populates data for this report is complicated. The report opens without any problem and I can print it as well. However, If I have another form open (has about 12 combo boxes) and then I run the report, it appears on the screen, no problem. When I print the report, I get 'Cant open any more databases' error. I am using OpenQuery method to run some queries before opening the...
1
2946
by: Jeff_F | last post by:
Hi all. Question in two parts. I'm looking to add two combo boxes. The first will contain regions and the second will contain employee names which correspond to the region selected in the first combo box. What is the most efficent way to go about this type of layout - in terms of code and populating the combo box??? thx.
15
2966
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting it. Simple database: I want to have a user enter Supply Orders (just for tracking purposes) by Item. The user may also enter a new item - "new" is a combination of Item, PartNumber and Vendor - they could have the
3
1905
by: Joanne | last post by:
I have searched through previous threads regarding this error. I went back through all my code to make sure I closed and set to nothing all open db's and rs's. However, I still have one computer getting this error. This problem does not occur with any other users - some of whom use the database continuously. The user logs in, then goes to the Add Invoice form - it's a fairly simple form, single table recordset with a subform based on...
3
3639
Zwoker
by: Zwoker | last post by:
Hi Everyone, I have a query that uses criteria from combo boxes in the form that runs it. When I had only discrete values in the combo boxes that matched the data that was being queried, the result was great. I was getting only the records that I wanted. As soon as I added "ALL" to the form's combo item lists I ran into trouble. Firstly how do I make the query realise that I want every record, not just those that match the literal...
1
5133
by: vincehallam | last post by:
Hi newby here sorry if this sounds bread and butter stuff. Using MS Access 2003 On a Form I want two Combo boxes which are getting their data from a table. The Combo boxes are A "Price 1" & B "If Bank Holiday Price Two". Is it possible to have "Price 1" visible as default but then if I tick a check box to have "If Bank Holiday Price Two" pop up and the values in B be used when clicked instead of "A". Hope this makes sense ? Regards...
4
3111
by: mistyblu | last post by:
I wrote an Access97 application using VBA for a company many moons ago and they have approximately 20 users. All has been hunky dory for a long time but suddenly they have a combo box error on 3 of the pc's. The identical application works fine on the other 17 pc's. The O/S is Windows XP Pro service pack 2. There are several combo boxes on a form which allow the user to find records based on the values selected. When the user types a...
3
13096
scubak1w1
by: scubak1w1 | last post by:
Hello, Did a search here, manuals and Googled, etc generally, so apologies if I did not find the answer to my issue - that is, I try and 'self help' as mush as I can... I adjusted my postgresql.conf file to set as on 'explain_pretty_print' Now in pgAdmin (1.10.0) when I right-click a database in the 'usual' way, Maintenance, any of the tasks, its starts OK, but I get a dialogue box up every (seeming) operation that the Maintenance is...
20
2972
by: Daniel Yantis | last post by:
Combo Box 1 Displays a query/list with 2 columns: SELECT Classes.CLASS_DESC, Judges.Judge, * FROM Classes; Combo Box 2 Displays a query/list: SELECT Judges.Judge FROM Judges; I want Combo Box 2 to change based on Combo Box 1 answer. Combo Box 2 will still be editable but its default will be based on Combo Box 1. Example: I have 250 Classes and 6 Judges. The number of juges will change from time to time and can be as many as 30....
0
8601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9021
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7716
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2327
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.