LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to refresh the text which is display by windows API function 'findwindow' 'getdc' 'textout'!

i use the windows api function to dynamelly display text on the frontpanel ,it successed ,but when you move the scrollbar to the left ,right ,top ,bottom,the text will be disappear!! i think it is a very difficulteed problem .in my around ,no one can do! who can help me!
Download All
0 Kudos
Message 1 of 5
(3,730 Views)

Very cool!

It looks like you are using the same functions that LV uses to refresh the screen. Thos functions only let you update within the window you specify. This is why your updates stop at teh edge of the window.

Normally LV will watch the scroll bar position and re-paint the screen to reflect an scroll bar postion changes. Since you are by-passing LV, you can not rely on LV to refresh your screen when the scroll bars move.

At this point I can offer two suggestions.

1) Continue with the approach you started and start adding all of the code required to watch the scroll bars and re-paint as indicated.

or

2) Look into the LV Picture control. Based on what you have done using dll calls I would guess that you could probably figure how to do the
same thing using a picture control. The Picture (being a LV native object) is fully supported by LV so the scrolling work is already done and working. The picture control will let you draw lines, insert text, etc. Take a look at the "Robot Arm" example. It should get you started.

Finally, the Picture control is pure "G" so it should be platform independent.

Otherwise let me commend you on your example. You say no one else where you are can do what you have done. After looking at your example, I am not suprised. There are few people in the world that can do what you have done.

Great work!

Ben


Ben Rayner
Certified LabVIEW Developer
www.DSAutomation.com

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 5
(3,730 Views)
Ben Rayner:
thank you ,i am happy you can understand my idea,my english is bad,i will try again,think you! welcome you to beijing,china!
0 Kudos
Message 3 of 5
(3,730 Views)
That's common for new window programmers.

In window programming, you create your own window and you can draw whatever you want onto it. You'll be triggered by OS whenever your newly created window need a redraw ("refresh"). Then you simply do the draw again.

When you move the scrollbar, or your window is overed by another window, etc., you have to redraw.

Now if you want to draw on an exist window, that's complicated. Window doesn't encourage you do that. Every application has its own memory space. To catch redraw event on another window, you have to "invade" into the memory space of another widnow. That's certainly not for new window programmers. If you want to learn window programming, you should get book, such as Charles Petzold's book. That will be a
good start.

Or you can simply redraw the text in every 200 ms.

Good luck.

George Zou
http://gtoolbox.yeah.net
George Zou
0 Kudos
Message 4 of 5
(3,730 Views)
I echo the above posts. That is an interesting VI. First I would suggest trying to do the whole application in LabVIEW. But if you must use the Windows API here is an idea I thought of.

You can remove the scrollbars, using VI Properties. You can then make your own "scroll bars" using a slide control for example. Then using events you know when the user is trying to scroll, because they are changing your "scroll bar" controls.

So every time the user �scrolls� you can refresh your strings, using the VI you already have. Then you can use VI server properties to change the Front Panels �Origin�.

Evan
National Instruments
0 Kudos
Message 5 of 5
(3,730 Views)