Jump to content

Aitor Solar

Members
  • Posts

    259
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Aitor Solar

  1. I think this is new:

    * Create a tab control

    * Put any two or more objects inside (let's say two boolean indicators, for example)

    * Group them

    * Ungroup

    * Surprise! The objects are moved down (now they are invisible and a ghost image of the old locations remains, if you refresh the image you will find the objects' new location)

    Reported to NI.

    Saludos,

    Aitor

  2. Paraphrasing a posting by Rolf years ago....

    "Self- modifying code is a very bad idea." :nono:

    Not necessarily the same VI, but between them. Here the .ctl is in fact working as a external variable, in a very simple manner. Maybe this works between different runtimes too, all accessing the same type definition. Well, OK, probably not :rolleyes: .

    Saludos,

    Aitor

  3. The original buffer holding the constant is being updated instead of copied.

    Yes, that's true. And I think the problem is located in the queue creation. If you just rewire it or wire another copy of the enum constant, the problem solves. So I suspect that first constant set to "key id" is corrupt and, from that point, LV loses a valid reference to the object and what the heck it is.

    In fact, if we knew how to reproduce this, it would be really interesting to change constants in run time ;)

    Saludos,

    Aitor

  4. the values of a variant are pointers to memory segments, and the variant data conversion simply gets the pointer, and tries to fit the bits and bytes found at that address into the specified labview datatype. when the vi is closes (e.g.) the data, which belog to another application are deleted. And it seems, it is a a real "call by reference", when you use an indicator to see the values

    Yeah, that seems correct. If OLE variants are just pointers, it's logical that closing the VI would free the memory zone. But I'm still surprised it fails trying to get the variant through the VI Server. Maybe the first application reserves that memory zone and, because of that, the second application can't read it. Or maybe just the VI server can't retrieve the pointer, the same way the flattening can't get anything.

    I have created a real simple dll to get the OLE variant type, and a VI to understand that type or composed type (array of whatever, for example), cast it and convert it to a usual variant, like a new "to variant" function. In fact, LabVIEW has to do something very similar in the background: if you connect the OLE variant to an indicator and select the "show type" option, you get it... but I haven't found any method to get that info programmatically. Anyway, this works great so far, though I would hope an easier solution :rolleyes: .

    Saludos,

    Aitor

  5. Thanks Aitor for your reply.

    As I am a bit of a beginner, can you give me more information about how to build a ActiveX server to connect with the MCR???? And can I then use Labview without Matlab. ;)

    As Todd says, you can use the Matlab script node (but be careful with the running threads, as it tends to take control of the UIThread). The script node uses Matlab, so you must have Matlab installed in every PC you want to run your application.

    BUT if you build your application like a Matlab ActiveX server, you just need the MCR in the machine, not Matlab, and it's distributable. It's still a bit heavy, about 100Mb if I remember correctly.

    You'll need to compile your matlab class with the Matlab's COM Builder (as I said, I'm no Matlab expert, so everybody feel free to correct me.). This shoud create an .exe file. Execute it, it creates a dll and registers it. Go to LabVIEW and create an ActiveX object, now you should see your new class in the list of available ActiveX servers. Select the creatable object you need, instantiate it and use it through the properties and methods (all of these is in the ActiveX palette in LV).

    Saludos,

    Aitor

  6. I didn't check, but it came to me right now: Would it work if you flatten-to-string your ole-variant and read it with the second app? What does the flattened variant contain (whole data, only a pointer, ...)?

    No, it doesn't work. In fact, if I apply a "flatten to string" to the OLE Variant and (inmediately after) an "unflatten from string", I don't recover the original, the variant value is lost. The flattened string looks just "\00\00\00\00...". The only function that works is "variant to data", anything else can't get the variant type and value. :headbang:

    I've tried to convert OLE variant to LabVIEW variant, using the "to variant" function, but the outcome it's still the same OLE variant :wacko: .

    I don't know what to do. I can only see the possibility of converting the OLE Variants to their respective types and then to LV variants. The problem is:

    1) That is redundant, because if I want to get a generic variant in the first program, is to convert it in the second. This way it would be: [get OLEvariant] -> [convert to type] -> [convert to LV variant] -> [get from 2nd program] -> [convert to type] :thumbdown:

    2) It seems there's no easy way of knowing what type is an OLE variant, and the conversion isn't one-way. For example, an int variant can be converted to an int, to a double or to a string (I suppose it just takes the pointer and tries to adapt the memory to the data type given).

    :throwpc:

    Saludos,

    Aitor

  7. Hi all,

    I know this question was already ask more than one time. But my problem is: I want to use the a in matlab created dll. The m. file in matlab is a set of differential equations. I have already implemented this dll with a libary node, but actually nothing is happening. - And I think the problem is that there are no values are coming from the dll or can go into the dll.

    If already found out that people advise to write a wrapper file. :headbang: Is it really necessary to created a wrapper file ? If yes, how do I create such a wrapper file? Or where can I find out how do this. Especially because I have no ideas about C/C++.

    I really hope somebody can give some specific answers. :( It would be really important.

    nice greetings,

    keysk

    I'm not a Matlab expert, but AFAIK, the easiest way of using Matlab from LabVIEW is to build an ActiveX server to connect with the MCR (Matlab Runtime). That way the dll would be just for Matlab internal use (and because of that will only have the ActiveX method for registering and so) and instead of them you should use the methods the automation provides (i.e.: the methods you have created for that class).

    Sorry if I have something wrong, I use Matlab-LabVIEW almost every day but only on the LabVIEW side :oops:.

    Saludos,

    Aitor

    but

  8. Now I feel puzzled. I'm obtaining an OLE variant from an ActiveX method. That variant is (for example) an integer, so if I convert it to I32 with the "Variant to data" function all works fine. And if I connect this OLE Variant wire to a variant indicator, the indicator shows the data: "OLE Variant, Variant Type -> VTR_8, Value -> 60.000E+0".

    But now I need to get that OLE Variant from another LabVIEW application, using the VI Server and the "Get control value [variant]" method to retrieve the variant indicator value. Well, it doesn't work. All I get is an empty variant, even if I'm still seeing the correct variant value in the first application's front panel. All other kind of values (for example LV variants) are retrieved correctly :blink: .

    Maybe this sounds too convoluted. There is a more simple (and really surprising) way to see it. I create a constant from this OLE Variant (you can see it in the first image attached). All seems OK. Now I just close the VI with this constant and reopen it. And, miraculously, the variant constant has lost it's value and type (the second image) :wacko: .

    Does anybody know what's wrong here?

    Saludos,

    Aitor

    post-1450-1136895040.jpg?width=400

    post-1450-1136895076.jpg?width=400

  9. The easiest way would be to post a return or esc key press to the keyboard queue.

    Thanks, sir. That's a good and simple idea I didn't think of. :headbang:

    Try to use this to control the dialog in your case.Use the "Simple Error Handler.vi" and set the "Type of dialog" to 0("no dialog").This maybe helpful.See the attachment.

    Yes, but then I would need all the VIs follow this protocol. Something out of my hand here.

    Thanks, people

    Aitor

  10. Hi Entropy:

    You can use "function->time & dialog->one button dialog/two button dialog/three button dialog",or use the MS's API.

    William

    Well, the program shouldn't have dialogs, because it's a remote panel application. But sometimes, one pops-up (you can't control all the embedded dialogs, particularly when some VIs come from another programming team, or sometimes caused by Matlab incompabilities). So I need to detect when a dialog launches and close it. And this I have no idea. I can quit LabVIEW, but just close that specific Windows dialog... :nono:

    Saludos,

    Aitor

  11. For example, i want to control VSA by GPIB,so pass the GPIB address and center freqenecy. At other time,i want control my AWG, so pass a different type parameters.That's why i use variant as a sub vi's parameter.

    Why not to use a polymorphic VI, then?

    Saludos,

    Aitor

  12. Yes, it's easily done looking the descriptors. Time ago, I prepared an evolutioned version of the OpenG method, so if the variant is an array or a cluster, it says what kind of contents has (so the answer is "array of I32" instead just "array", or "array of clusters of string, boolean, refnum", etc).

    I hope you'll find it useful. Keep in mind is just a VI I did for a particular purpose in a project, it's not really hard-validated. Just works for usual tasks.

    Saludos,

    Aitor

    Download File:post-1450-1129539061.llb

  13. I need to launch the Context Help Window in a remote panel. The problem is, the run-time menu element for Show Context Help is not exported to a remote panel.

    The CTRL+H shortcut still works fine, but I want to launch it programmatically, and the "Control Help Window" function launches the window in the server machine, not in the client (the same about using user32.dll and emulate the key pressing). Has anybody an idea for this?

    Saludos,

    Aitor

  14. What sorts of front panel objects are you using?  In my limited work with remote front panels, I got the impression that objects with heavy amounts of internal data (such as charts, graphs, array controls/indicators) have all their internal data copied over to the remote client, not just what's visible (or decimated for display).  Not sure if this is true, but thought it might give you something to look for...

    Well, I use big graphs and that could explain part of the problem. But I have tried creating a empty VI just with the same front panel objects (i.e.: nothing in the block diagram), and the load of the remote panel is much lighter (about 1/8 of KB), so part of the code is being loaded. But what? The event structure doesn't seem too heavy. Maybe the property nodes? I don't know :wacko:

    Saludos,

    Aitor

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.