Go to Post Who says engineers can't be poets? - Wayne TenBrink [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-11-2010, 09:33
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Computer playing Bejeweled Blitz project

The clf (Call Library Function) node needs the name and/or path to the library and the function call info to be configured. I believe the example or tutorial retrieves the computer name, and would work fine as a template for your usage. If you are calling the function more than once, it is a good idea to make a subVI wrapper, since the configuration and appearance other ways get annoying.
It is possible to use GDI calls to get the window handle for other apps, and to use bitable to copy a portion of their window into your own, and then to implement GetPixel() or something similar. Possible, but certainly easy. Using a camera to capture the screen will likely have issues with aliasing, lighting, and calibration. Not a cakewalk, but good practice if you want to use the camera on the robot.

Greg McKaskle
Reply With Quote
  #2   Spotlight this post!  
Unread 07-11-2010, 17:29
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
Re: Computer playing Bejeweled Blitz project

Wow, that helps a whole bunch more, thanks! That function is one of what I'm looking for. I even poked around, found user32.dll, configured the node, and it worked! Screenshots of configuration attached. It certainly helped to know a little bit about C-like functions for the parameters tab.
I looked at msdn before but couldn't find anything...thanks for the link. I looked at the other cursor functions but there wasn't one to click the mouse/cursor, so maybe the user will have to do that quickly when prompted to.

Thanks Greg for the tip about the GDI and GetPixel calls, I'll look them up on msdn. Yes, I've looked at that example you were talking about and some other ones too, but they were still a little over my head.


So let me get this straight for my sake and anyone else's who might look at this and not know--the Call Library Function Node basically calls/uses a function in a library that you specify. A .dll file is a compressed library with many functions that can be used universally with many systems/programs. And user32.dll is a library that has many/all of the Windows API functions, which can be used by other programs to interact with windows. Aren't they written in a unique programming language that is very similar to C/Java/most text-based languages?

EDIT: well now that I think about it, of course there wouldn't really be a function to "click" the mouse; you're the one that's clicking it and the software is sensing that. But maybe if there was a function to send a universal "click signal" to all of Windows, or all the programs waiting for a click, or the general windows mouse driver, etc.
Attached Thumbnails
Click image for larger version

Name:	Configuration_Call_Library_Function.png
Views:	20
Size:	41.1 KB
ID:	9406  Click image for larger version

Name:	2_Configure_Call_Library_Function.png
Views:	15
Size:	39.6 KB
ID:	9407  
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW

Last edited by RoboMaster : 07-11-2010 at 18:23.
Reply With Quote
  #3   Spotlight this post!  
Unread 07-11-2010, 23:36
Fletch1373's Avatar
Fletch1373 Fletch1373 is offline
Registered User
AKA: Fletch
FRC #3181 (Panthers)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2004
Location: Rochester, NY
Posts: 251
Fletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud ofFletch1373 has much to be proud of
Re: Computer playing Bejeweled Blitz project

Quote:
Originally Posted by RoboMaster View Post
I looked at msdn before but couldn't find anything...thanks for the link. I looked at the other cursor functions but there wasn't one to click the mouse/cursor, so maybe the user will have to do that quickly when prompted to.
There actually is a function listed on MSDN, called 'mouse_event()'


Note that this function has been superseded(and included by me for reference purposes). You should be using the second function I found, called 'SendInput()'

Both are housed in 'User32.dll' so you're fine there.


I'm not much of a LabView guy, so I'm not sure how easy it would be to implement either of these API calls, but I hope I could help either way.
__________________
Student:
<04: FRC0213> <05-08: FRC1373>
Mentor:
<09-10: FRC0809> <11-12: FRC3555> <12-14: FRC0073> <15-??: FRC3181>
Volunteer:
<FTAA> <CSA> <Defense Coordinator> <Scorekeeper> <Robot Inspector> <Official Scorer>
2016 Tour:
CTWAT [DefCoord] > Pittsburgh[Mentor/DefCoord] > TVR[FTAA] > FLR[CSA] > NE DCMP[CSA] > CMP[CSA]
Reply With Quote
  #4   Spotlight this post!  
Unread 08-11-2010, 19:28
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Computer playing Bejeweled Blitz project

Quote:
So let me get this straight for my sake and anyone else's who might look at this and not know--the Call Library Function Node basically calls/uses a function in a library that you specify. A .dll file is a compressed library with many functions that can be used universally with many systems/programs. And user32.dll is a library that has many/all of the Windows API functions, which can be used by other programs to interact with windows. Aren't they written in a unique programming language that is very similar to C/Java/most text-based languages?
You seem to have it pretty straight. Libraries are a general concept found on most operating systems. They are a collection of functions that do useful things, and are hopefully documented and grouped according to their functionality. What are they written in? It depends. On the original Mac and Lisa, they were in Pascal and some assembly. C was the language developed for developing unix, and not surprisingly, most of the libraries for linux are still written in C. I believe the NeXT was built around Objective C, BeOS may have had some amount of C++. There were OSes built around Lisp, and of course before C, most OSes were written in Assembly or even lower level.

In reality, the language the functions are written in isn't important, but the calling conventions are. Notice the dialog for clf asks you the calling conventions? That is because Windows actually has several conventions. These conventions specify how a calling function passes parameters to the called function and retrieves results. This is done differently on different computer architectures and on different OSes.

Given the information you gave LV about the parameters, it takes the wire information and pushes the parameters onto the stack according to the stdcall conventions, executes the call instruction with the address to your function in the library, then retrieves the results and does any stack or register cleanup as specified by the convention. As long as the conventions are followed, any language can reuse code from any other. To flip roles, you can build a DLL from LV so that it can be called from any program capable of calling into a Windows library.

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 08-11-2010, 21:07
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: Computer playing Bejeweled Blitz project

Quote:
Originally Posted by Greg McKaskle View Post
To flip roles, you can build a DLL from LV so that it can be called from any program capable of calling into a Windows library.
e
Would an application that uses such a dll require the labview runtime engine to run?
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!

Last edited by biojae : 09-11-2010 at 00:09.
Reply With Quote
  #6   Spotlight this post!  
Unread 09-11-2010, 08:01
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Computer playing Bejeweled Blitz project

Yes it would. Technically, we could statically build in all the things it would need for execution and make each one stand-alone, but it isn't that big a request. It would also help if the datadlow scheduling engine were already on the OS.

Greg McKaskle
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Computer Science or Computer Engineering? KRibordy College & University Education 14 09-10-2009 01:56
saving project as a new project windell747 NI LabVIEW 3 01-02-2009 04:41
Music Playing Problem on Computer John Gutmann Chit-Chat 9 31-07-2007 17:04
pic: Kaizen Blitz Presents... The Blitz Box 2006 Ian Curtis Robot Showcase 0 24-02-2006 16:47
The Blitz is a GO!! Erin Rapacki Off-Season Events 6 06-06-2003 19:31


All times are GMT -5. The time now is 21:18.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi