LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with Windows API calls to create scrollbars.

I am trying to develop a scrollbar control that allows me to take control of both the horizontal and vertical scrollbars for control of the front panel window. The native LabVIEW front panel scrollbars don't allow turning them on individually and they also include extra scrolling ranges in the upper, lower, left and right areas that can be annoying to a user.

There is a problem with LabVIEW 7 and the MS Forms ActiveX scrollbar which prevents it from being a solution. The MS Forms ActiveX scrollbar will work when it is initially created, but when the window is closed and re-opened, it fails to work. It must have something to do with the native LabVIEW code that creates the front panel window. There is c
urrently a "Corrective Action Request" on this issue.

I have also attempted to use the ActiveX flat scrollbar, but it does not operate like a real scrollbar. When you are scrolling, it does not report the value of the scroll until you have released the mouse. It also doesn't allow you to use the arrows or page up/page down functions of a scrollbar.

I have attached a couple of vi's that create a window scrollbar "child window" through the windows 'user32.dll' functions. One vi creates a scrollbar control, and the other vi creates a vertical scrollbar. They "kind of" work, but I am not having success returning the "ScrollBarInfo" structure from the GetScrollBarInfo function in the user32.dll. This information is vital to being able to use the arrows and the page up/page down function.

I'm hoping that someone that is better acquainted with the Windows API can figure out what I am missing in my sample vi's. In the sample vi's that I have attached, I haven't implemented the sc
rolling capability yet, but I do have the basic functionality of the scrollbars being monitored.

Any help would be greatly appreciated.
0 Kudos
Message 1 of 7
(3,688 Views)
jsthomas,

According to the Call DLL.vi shipping example that comes with LabVIEW 7 Express (I wrote that one), it will be much better to use a cluster in LabVIEW with some embedded clusters to get the memory to work out right. With the array, LabVIEW sends an additional 4 bytes of data for the array length that is getting passed and that is why the function is not working. I have modified your VI and it should work fine for you know. Refer to that shipping example for more information on what I have done. You should be able to modify the rest of your code upon inspection.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
Message 2 of 7
(3,688 Views)
Thanks Randy.

I'm glad to get the info about using clusters with the dll calls. I wish I had looked more closely at the LabVIEW examples. They really provide some great information

I still can't get the dll to return the scrollbar button information, though.
0 Kudos
Message 3 of 7
(3,688 Views)
Which part of the cluster is giving you the wrong data? Are you getting any errors, or just bad data?

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 4 of 7
(3,688 Views)
If I understand the Microsoft documentation correctly, I should get button and page up/page down info from the rgstate array in the SCROLLBARINFO cluster. I do get some values when the slider is at min and max positions, but usually the array is all zero's.

There are no errors returned by "get last error."
0 Kudos
Message 5 of 7
(3,688 Views)
I am not sure what that would mean. Have you done a google.com search and found out anything?

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 6 of 7
(3,688 Views)
I've been using information from msdn.microsoft.com:

"http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/scrollbars/scrollbarreference/scrollbarfunctions/getscrollbarinfo.asp"

I'm not really proficient programming in the Windows API, so I could be way off on this one...
0 Kudos
Message 7 of 7
(3,688 Views)