Win32 API & DLL calls

Is possible to call in java directly the Win32 API or using a DLL?

I dont believe you can do it directly but I think you can call a VBSCRIPT that can call WIN32 API directly

Similar Messages

  • LabVIEW call Win32 API DLL function from third party

    Hi everyone,
    I'm trying to build a LabVIEW 2010 interface on 32-bit Window XP system to configurate and communicate to an Anglient laser head through its USB expansion box. I contacted the vendor and they shared a win32 API with some dll files. I started with a function called "A55292Find", but the CLF node always pop up error 1097.I checked the MSDN to get the corresponding LabVIEW data type for CLF.
    My question is: Do I need to initialize those arguments? (How can I know the values of them if initialization is needed?)
    Could anyone help me figure out what's the problem?
    Here is what I have from API documents about this function:
    The A55292Find function returns lists of handles and board types for all the 55292 USB
    Expansion Modules connected to the system.
    A55292RC __cdecl A55292Find(
    HANDLE hBoxes[], // List of handles for the boxes found. (as Unsigned 32-bit integer numeric)
    BOARDTYPE PortABrdType[], // List of board types for slot A boards (as Unsigned 16-bit integer numeric)
    BOARDTYPE PortBBrdType[], // List of board types for slot B boards (as Unsigned 16-bit integer numeric)
    WORD *spMaxBoxes); // dimension for all of the passed arrays. (as Unsigned 16-bit integer array data pointer)
    // (function return type as Unsigned 32-bit integer numeric)
    Parameters
    HBoxes[] Array that will receive the list of HANDLES for all the 55292 boxes connected.
    PortABrdType[] An array that will receive Slot ‘A’ board type information for each 55292 box.
    PortBBrdType[] An array that will receive Slot ‘B’ board type information for each 55292 box.
    spMxBoxes Passes the maximum number of values that can be held in hBoxes, PortABrdType, and PortBBoardType arrays to the A55292Find routine and returns the actual number of boxes found
    The return value will be one of the following A55292RC return codes:
    Value Meaning
    A55292_NO_ERROR No error
    A55292_TIMEOUT Timeout accessing a shared memory
    Remarks
    This routine must be called to obtain handles and board type information used in calling all the other routines. If there are significantly more array elements than boxes, the routine will take longer to complete.
    These are the definitions: 
    typedef DWORD A55292RC; enum{A55292_NO_ERROR, A55292_HANDLE_ERROR,...}
    typeder WORD BOARDTYPE; enum{A55292_PCAL_BOARD, A55292_NO_BOARD, ...}
    Thanks a lot,
    Kang
    Solved!
    Go to Solution.
    Attachments:
    call A55292Find.vi ‏10 KB

    nkang11 wrote:
    Hi Mr. Kalbermatter,
    As you told me, I should try to use the defined enumeration words as control and indicator.
    For the previous CLF node, it successfully returned the hardware configuration (I have only connected a board at slot A):
    But I really want to see a string return as "A55292_PCAL_BOARD" which is defined by "typedef WORD BOARDTYPE; enumeration {...}; Does that mean I need to change the data type or do something like "converter"? Or initialize the array first, then convert it to string type?
    Right now, I'm trying to open the laser card by using "A55292PcalOpen(HANDLE hDev, SLOTSELECT SlotSelector);" function which requires to use the enumeration constants from " typedef WORD SLOTSELECT; enum {A55292_PORT_A, A55292_PORT_B};" but I'm confused to shot an constant control to a new CLF node.
    Since almost all of the arguments in dll function are typedefined as WORD, short and struct et al, I hope you could give me some hints on it.
    Thank you very much sincerely!
    Kang
    Depending on the actual C implementation you can simply create a LabVIEW enum with the according item names or use a ring control instead. Teh enum requires the numeric values of the items to be in consecutive order without any gaps in between. This is a given if the C definition never assigns a specific number to the item. If the C enum is not consecutive you need to go with a ring control instead.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Calling a Single Threaded Win32 API/DLL

    I am working on calling a single threaded Win32 API (in a vendor's dll).
    Since this dll is single threaded in windows, when I call this in my Java program do I need to make sure that I do not have multiple threads calling this API.
    Any thoughts will be appreciated.
    Thanks

    It shouldn't matter as long as you make sure that multiple threads aren't calling functions in that DLL at the same time. You can ensure this by either synchronizing your methods in Java or writing a multithreaded stub DLL that synchronizes calls to the single-threaded DLL for you.

  • Win32 API calling by Code Interface Node

    Hi all,
    I wish to call a Win32 API function by using the code interface node.
    However, I don't know the data types in LabVIEW corresponding to the "HANDLE
    *" in Visual C++.
    Here's the function I wish to call:
    BOOL bOpenDriver (HANDLE * phDeviceHandle, PCHAR devname) {
    *phDeviceHandle = CreateFile(devname,
    GENERIC_WRITE,
    FILE_SHARE_WRITE,
    NULL,
    OPEN_EXISTING,
    0,
    NULL);
    if (*phDeviceHandle == INVALID_HANDLE_VALUE) {
    return (FALSE);
    } else {
    return (TRUE);
    Thank you in advance.
    JJ

    If this is really a Windows API function, then the handle can most likely be treated as an I32.
    Note that you can't actually do anything with the handle other than passing it to other functions.
    If you search this site for "LabVIEW" and "DLL" you should find some resources about working with DLLs and Win32 API DLLs.
    Try to take over the world!

  • Error message win32 API error2 when calling ShellExecuteErW from AgWorkspace.shellExecute

    after the command Exporting I get the message: Internal failure: win32 API error2 calling ShellExecuteErW from AgWorkspace.shellExecute. System is only exporting Thumnails.
    System is windows8, 64bit Lightroom 5.2 (newest version)

    At the bottom of the import dialog is a popup marked Post-processing.  It's probably currently empty.  Set it to Do Nothing and try the export again.

  • I am receiving this error message when trying to export pictures: 'Unable to Export": An internal error has occured: Win32 API error 2 ( "The system cannot find the file specified.") when calling ShellExecuteExW from AgWorkspace.shellExecute.// I have a H

    I am receiving this error message when trying to export pictures: 'Unable to Export": An internal error has occured: Win32 API error 2 ( "The system cannot find the file specified.") when calling ShellExecuteExW from AgWorkspace.shellExecute.// I have a HP ENVY Phoenix, fully loaded, 1 1/2 years old.

    Nevermind I fixed it. Thank you.

  • Win32 API user32.dll SendInput function help

    I'm looking for and example that uses the Win32 API user32.dll SentInput function.

    Hi, you find the required information in the MSDN online:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_api_reference.asp
    and more specific the "SendInput" at:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/sendinput.asp
    Regards,
    Mattias Ericsson
    Endevo (www.endevo.se)
    Gothenburg, Sweden

  • Calling win32 api's from java

    Can someone tell's me how to call win32 api's from jdk1.4 ...
    Like in Delphi for example how to open cd-rom door...

    See this
    http://forum.java.sun.com/thread.jsp?forum=52&thread=94146

  • Calling win32 api in Forms

    Hi,
    Is it possible to invoke win32 api in Forms ? If so, from where can i get some samples ?
    Thanx in Advance.
    Regards,
    Saravanan A

    Hi,
    Is this available for 10g also...because in oracle website(http://www.oracle.com/technology/software/products/forms/index.html) D2KWUTIL library is available only for Form 6i
    Thanx in Advance.
    Regards,
    Saravanan A

  • Kill RT task frontpanel RED-X versus WIN32-API

    I have a LabVIEW task compiled to EXE which is downloaded to a remote processor; the front panel remains open locally.
    I want to kill that task and re-download it. This works the way I want if I use the local mouse to click the RED-X kill box on the upper right corner of the local front panel for the remote task... The panel disappears AND the remote task stops executing.
    The problem is that when I use the WIN32-API to try and kill the local front panel for the remote task I never get the remote task killed. Some  WIN32-API calls such as sending EndTask via USER32.DLL to the local panel's window ID cause the local panel to close but the remote task keeps running and is not aborted. Sending a WM_Close to the local panel's window ID involves the operator because it produces a LabVIEW dialog asking me whether I "want to close all RT tasks or not"
    What message do I send to the window, or what system call do I envoke to get the same result as that simple local mouse click on the RED-X kill box on the upper right corner of the local front panel for the remote task?
    Thanks, Jerry

    Hello.
    Normally a Real-Time task does not require a front panel so closing the Front Panel that you have opened remotely does not necessarily cause the VI to stop running, it merely disconnects the front panel connection to the VI.
    In order to achieve the same resul, you can use an Invoke Node to close another VI.
    To do this you will need to
    follow the steps outlined below.
    Open a blank VI and place an Open VI Reference on the block diagram.
    Create
    a control to the "VI Path" input of the Open VI Reference. On the front
    panel you will need to browse to the VI you want stopped.
    Wire an Invoke Node to the Open VI Reference and set the Invoke Node to "Abort VI."
    Wire a Close Reference to the Invoke Node.
    Wire a General Error Handler to the Close Reference.
    Open the VI that you want to stop. Make sure it is running and then run the vi you just created. This will stop the first VI.
    Hope this helps! 
    Kameralina
    Ask NI (ni.com/ask)
    Search The KnowledgeBase
    NI Developer Zone
    Measure It. Fix It. ni.com/greenengineering/
    NI Vision ni.com/vision/

  • Win32 API error 126

    What to do if message: [Win32 API error 126 ("Dasangegebene Modul wurde nicht gefunden") when calling ::LoadLibrary from getFunction] apears

    What to do if message: [Win32 API error 126 ("Dasangegebene Modul wurde nicht gefunden") when calling ::LoadLibrary from getFunction] apears

  • When I export from LR5.3 I get an error message Win32 API error . However the export seems to work.

    The message is Win32 API error 2 ("The system cannot find the file specified") when calling ShellExecuteExW from AgWorkplace.shellExecute. However the export works. What is happening and how do I get rid of the error message?

    Near the bottom of the Export Daialog, in the "Post-Processing" section make sure that the "After Export" box is not empty (which is invalid and causes the export operation to trip up). Use the drop-down to select a valid choice such as "Do Nothing".

  • Does a reentrant dll call monopolize the calling thread?

    If I understand thing correctly, threading for a dll call is the same as threading for a vi whose execution priority is set to subroutine.
    To review threading in subvis:
    (1) the thread in which a subroutine-execution-priorty-vi call is made is monopolized by the subroutine-execution-priorty-vi since labview cannot time slice the thread.
    (2) if the subroutine-execution-priority-vi is not reentrant, then other threads that call the vi may be suspended because they are competing for the same code resource.
    (3) if the subroutine-execution-priority-vi is reentrant, then other threads may call the vi simultaneously. However, within any particular thread the vi must complete because of point (1).
    In
    sum, the OS timeslices between the threads, and labVIEW timeslices within the threads. If a vi's execution priority is set to subroutine, then the thread under which it is running is monopolized by the vi. Yes?
    A reentrant dll call would be equivalent to a reentrant subvi call in which the subvi's execution priority is set to subroutine. Yes?
    If the above is correct then this should also be correct:
    Using an API call to return the thread ID, you could use the the thread ID at the front and back side of a dll call, as well as in a message library function callable from a dll, to theoretically message labVIEW upon the dll return. The message would be uniquely identifiable because a dll call cannot be superceded by another dll call from within the same thread. Yes?
    I'm not saying that it would be particularly efficient to do so, only that it could be done. And depending on the messaging, it could be a useful option in the dll call configuration dialog box.
    In consider
    ation of "magic",
    Kind Regards,
    Eric

    Eric,
    I'm not sure I understand exactlly what you are trying to do here.
    If you want LV to react to a dll error, why don't you just pass a return
    code that's not zero? Then, back in LV, read the return code. If it's not
    zero, create an error, and pass this to the rest of the code. The rest of
    the code is (or should, following good programming practise) has an error
    in, and the code will not execute if the input error is TRUE. It does not
    even have to be the return code, it could be any input value. The input
    values can be changed in the code, and the modified value is returnd to
    LabVIEW.
    If you want to generate an error, and put it into a buffer to be read later
    on in LV, you'll have to synchronise the code. This is the consequence for a
    construction like this, and is the same for several windows API's
    (GetLastError, etc.). the buffer will stay in memory, untill all instances
    of the dll are released from LV memory.
    BTW: A dll could create another thread. This thread can run on the
    background, like the good old TRS's in dos. (A thread like this could even
    call a LabVIEW VI that is build in a dll, just like any other api.)
    BTW: A thread created by a dll can be made to be automatically released when
    the thread is detatched, or when the process is detached. This is important,
    because LV will crash if the dll is removed from memory, but the thread is
    not stopped properly.
    Regards,
    Wiebe.
    "Eric6756" wrote in message
    news:[email protected]...
    > Greg,
    >
    > As I think I lost you in the point of this line of questions, let me
    > back up.
    >
    > A couple of week ago I asked the following question, "Is there a
    > labVIEW library call that can be made from a dll to tell labVIEW to
    > abort the calling vi thread?" To that question you made the following
    > statement:
    >
    > "... and I doubt that there is a function to do that from a DLL as the
    > DLL could be arbitrarily deep down the stack and the function called
    > would have to magically find the VI that it wants to abort. And don't
    > forget that DLLs can be called by multiple VIs at the same time."
    >
    > You seem to be saying here that what I'm asking for is not possible.
    > And having thought about this for a while, I didn't understand why
    > not.
    >
    > For the moment I'm going to ignore the caveat you just put into the
    > dll calling presumptions I've made and assume the dll is going to
    > execute synchronously within a thread. As the original question
    > suggests, the objective here is to message labVIEW from a dll to
    > provide the same functionallity as a CIN, namely return an error code
    > to labVIEW from a dll.
    >
    > A library function could do this as follows:
    >
    > First, the library function would have two modes; set error, and
    > return error
    >
    > (1) set error:
    >
    > 1.1 get the set error caller thread ID from API
    > 1.2 get the passed in error
    > 1.3 store the error and associated thread ID locally
    >
    > (2) return error
    > 2.1 get return error caller thread ID from API
    > 2.2 locate the error, if any, associated with thread ID
    > 2.3 return the error and clear it locally
    >
    > Now, if a dll encountered an error that it wanted labview to deal
    > with, it would call the error function to set the error code. When
    > the dll call returns control to labVIEW, labVIEW could call the
    > function to return the error. This of course works only if the dll
    > call is synchronous within a thread. Obviously, if the dll releases
    > the thread before it returns, then more than one dll call can be made
    > from the thread and the presumption that an error could be uniquely
    > associated with a thread is itself an error.
    >
    > Having looked at your reply again, I think though your answering a
    > different question than I asked. I just wanted a function to message
    > labVIEW to abort the vi chain, I don't want to abort a vi chain from
    > within the dll. It is a feature of CIN calls which I wanted in dll
    > calls.
    >
    > That a dll call may not be synchronous within a thread throws a wrench
    > in the works. Apparently I've just chased down a dead end.
    >
    > Hey, but thanks for the wrench...
    > Kind Regards,
    > Eric

  • 3.3 Bug: Win32 API Error 2 - Please help

    Wondering if anyone may be able to help with the following error message:
    "An internal error has occured: Win32 API error 2 ("The system cannot find the file specified") When calling ShellExecuteExW from AgWorkspace.shellExecute".
    The wonderfully unhelpful persons at the helpline said they could not help me but indicated If I reload the version 3.3 in a different location the problem would go away since some plug-in from v1.4 had infected the new install.
    I have no custom add-ins/plug-ins, everything is default.
    I followed these instructions, however still have the same error. I removed then re-installed 3.3 on another drive away from C:\Progfiles......
    Any suggestions?

    Sorry F. McLion, I could have provided the following additional information:
    v1.4 lightroom owned, operating without issue, installed in default location
    C:\... drive
    v3.3 trial downloaded, installed default location, export operating without
    issue
    v1.4 launched to compare, export working fine
    v3.3 launched, export results in error message; determined that export actually
    worked, just resulted in the error message
    un-installed v3.3 per phone support (manager)
    re-installed v3.3 on F:\ drive from copy downloaded on F:\... drive. No change.
    Odly after I removed then re-installed v3.3, the pictures I was working
    on appeared in the re-installed instance with the most current changes - I would
    suspect a clean un-install would have removed any semblence of work done prior
    to removing (at least pointers to modified files). Since not, this means the
    un-install did not truely un-install, it simply removed some files but also left
    some remnents.
    Microsoft XP Home edition V 2002 Service Pack 3
    Dell Dimension 8400 P4 3.00 Ghz 3.00GB ram
    Hope this helps.
    John

  • How to migrate Win32 API QueueUserAPC on Solaris?

    Hi,
    I am trying to migrate Win32 API QueueUserAPC to Solaris. On Win32, it queues asynchrounous calls to a queue and runs under a specific thread context. Is there any equivalent call or implementation on Solaris?
    Thanks,
    Abhi.

    An excellent question.
    One that might best be discussed in a forum where database people hang out, rather than a forum where one reports documentation issues.

Maybe you are looking for

  • Nokia N8 asks for Sim Card and continues to restar...

    I have had my Nokia N8 for about 3 months, and have had no problems until the last few days when it will ask to insert a sim card (when it is already inserted) and it will do a restart for no apparent reason? Has anyone had this problem??

  • Need a information about Adobe CS2.

    Hi. I'll be joining a design company next month. They told me that they have a license of Adobe CS2 for windows. With those cd's can i install it on my mac? Or, if that ain't possible, can they buy the upgrade (to CS4) but for mac?

  • Unstructured user interface template substitution tags

    Does anyone know where I can find a full list of substitution tags. An example of the tags I am talking about would be #BODY#

  • Image in background

    Hi i wish to make some buttons and labels in frame which has a specific Image as a background. I make a MyJPanel extends JPanel and in override method paint i invoke drawImage() method In construcor i create all buttons and Labels. And after everythi

  • Creating dynamic datasources. Is this possible?

    Can I create a 'subset datasource' from an existing datasource and then pass this subset datasource to the <jbo:RowsetIterate> Let's assume I have a datasource containing 100 records. How is is possible to create a new datasource from the exiting dat