GetDefaultPrinters (WinAPI call) Crashes Labview

Hi all,
For several reasons I need to use the windows API to get the default printer. I know about labview's activex solutions but those are not universal. 
See attached VI. This winapi call crashes labview rather consistently. It runs fine and returns correctly the default printer. However, some time later, a few seconds or a few operations later it will always crash labview. Why? I've tried changing it to "Run in UI thread" instead of any thread but neither seems to help... 
To get it to crash immediately, try closing the VI. That seems to do it every time. Access violations... 
Solved!
Go to Solution.
Attachments:
defaultprinters.vi ‏10 KB

No.  You actually did NOT allocated memory in your VI.
Here is how to allocated memory, the old way:
George Zou
http://webspace.webring.com/people/og/gtoolbox

Similar Messages

  • Bug: Windows 7 DLL call to turn off monitor message crashes LabVIEW 10.0f2

    Hi,
    I wanted to log this bug on the forum. I have already logged this with NI UK Support: CAR# 286873
    I was trying to find a way to turn off a laptop lcd
    monitor during measurements. I was trying to replicate this
    http://codereflect.com/2009/04/03/how-to-programmatically-turn-onoff-your-monitor/
    which uses windows messaging.
    I found the attached Monitor-1.vi somewhere on the forum that seems to do the above.
    However when I run the VI it crashes LabVIEW 10.f2 on Windows 7 32-bit.
    cheers
    David
    Solved!
    Go to Solution.
    Attachments:
    Monitor-1.vi ‏13 KB

    Hi Cosmin,
    That was it! Thank you so much!
    I will let NI UK support that you identified the issue and get them to close the CAR.
    cheers
    David
    Attachments:
    Turn off Monitor.vi ‏12 KB

  • How can I call a LabVIEW executable from within another LabVIEW executable?

    I have a customer requirement for two LabVIEW executables. Based on their current setup, they need to run executable "A" or "B", both of which are under independent revision control. I have created a third "selection" executable that allows the operator to choose between one of the two, but I am receiving errors when I attempt to call a LabVIEW executable from within a LabVIEW executable using either the "System exec" VI or the "Run Application" VI. If I call a non-LabVIEW executable (such as Windows Explorer) everything works fine.

    > I have a customer requirement for two LabVIEW executables. Based on
    > their current setup, they need to run executable "A" or "B", both of
    > which are under independent revision control. I have created a third
    > "selection" executable that allows the operator to choose between one
    > of the two, but I am receiving errors when I attempt to call a LabVIEW
    > executable from within a LabVIEW executable using either the "System
    > exec" VI or the "Run Application" VI. If I call a non-LabVIEW
    > executable (such as Windows Explorer) everything works fine.
    As with the other poster, I suspect a path problem. You might try the
    path out in a shell window, and if it works, copy the complete absolute
    path to LV to see if that works. LV is basically passing the comma
    nd to
    the OS and doesn't even know what is in it, so you should be able to get
    it to work.
    The other poster commented on subpanels, which is a good suggestion, but
    without going to LV7, an EXE can have open more than one VI. You can
    use the VI Server and the Run method to fire up another top-level VI.
    The decision is whether you want both to be in unique processes.
    Greg McKaskle

  • How to display error messages and output from Matlab (which Matlab would typically send to its command window but no longer does when called by Labview) into Labview or allow it to be dumped into Matlab Command Window?

    Using Labview 6i and Matlab 6.1. I want to be able to see Matlab warnings and error messages either in the Matlab Command Window or in Labview itself. Currently Matlab is called by Labview (which is working). However I would like to debug and/or modify my Matlab script file to better understand how the two programs are interfacing. It is difficult since no data or messages can be displayed currently to the Matlab command window. I would like to change that if it is possible - Labview is suppressing that from happening. If not possible to send these
    messages to Matlab Command Window can I make it at least possible to see Matlab's actual warnings and/or error messages in Labview?

    I don't think you can debug your Matlab script from labVIEW. The following webpage talks about this:
    http://digital.ni.com/public.nsf/3efedde4322fef198​62567740067f3cc/19106e318c476e608625670b005bd288?O​penDocument
    My suggestion would be to write a script in Matlab and thoroughly test it before calling the script from a Matlab script node in LabVIEW.
    Chris_Mitchell
    Product Development Engineer
    Certified LabVIEW Architect

  • Save for previous version 8.5 to 8.2 generates code that crashes Labview (uses classes)

    Hello,
    I'm working on some java style interfaces for labview for hot swapping of instrumentation for design patterns. When I try to port this code, developed on Labview 8.5 back to labview 8.2, the code it generates crashes labview (both 8.5 and 8.2).
    Included is a small snipet of the work that demonstrates this behavior.
    It includes to classes:
    untitledProject1 - the containing project (version 8.5)
    FunctionGeneratorI - Similar to a Java style interface (A class with all Dynamic VI's with no useful functionality)
    FunctionGenerator33220a - An intended implementation of Function generator (only a few functions implemented)
    and a folder "labview8_2Distribution"
    Which contains the port of the 8.5 code to 8.2.
    To recreate the error:
    A.
    1. Open "labview8_2Distribution\Users\Laptop\Desktop\objec​t\Untitled Project 1" (8.2 save)
    2. Verify it crashes labview 8.5 and labview 8.2.
    3. Watch labview crash?
    B.
    1. Open the "Untitled project 1" in the root directory. (Using labview 8.5)
    2. Save the project as a labview 8.2 type.
    3. Try to open the saved version with 8.5 and 8.2.
    4. Watch labview crash?
    Greg Sonnenfeld
    Attachments:
    error.zip ‏885 KB

    Hello Karunya,
    In regards to your questions:
    >Can you post your code? Have you tested this by creating another project?
    Do you have an xcontrols in your projects? Do you have typedefs? Do you
    have a LVOOP constant on your block diagram? Are you also using Classes?
    I cannot post the cost as it is way too big. Not really my code but a spaghetti code from a previous programmer. I think problems saving it to a previous version have to do with a few things:
    1) Memory - I have 1 GB of RAM and I am running XP. I notice the available RAM dropping quickly as it is saving and then it blow up.
    2) Long Filenames - The directory path of the original file is incorporated into the saved "previous version" of the code. While a good design, it does make the file/path a bit longer when saving
    3) One of teh things it saves is the drivers and their menus. This is due to the drivers being in a subdirectory of the original code and not in the c:\program files\national instruments\labview 8.5\instr.lib directory. I saw this when I tried to save the file as an LLB.
    4) If I work with smaller parts of the code without long paths, it saves fine.
    There probably are xcontrols, definitely typedefs, no LVOOP's or Classes. Hope you can do something with all this. It just seems that converting to a later version of the code should be reversable. Thanks.
    Michael

  • Private dll calling in Labview

    Hi everyone, (refinement of my question)
    I have two dlls. One contains public functions which I call from Labview. The functions in this dll call functions in the other (private) dll. However, how do I tell Labview where to find this private dll?
    I have tried installing the dll in the system path directory. I have also put the dll in various different places relevant to Labview (e.g. in the directory of the Labview executable file). However, none seem to work (.
    Is there an option in Labview where I can set paths to dlls?
    Any help will be gratefully received.
    Ciao,
    Matthew Banham (colleague of Francois)

    > I have two dlls. One contains public functions which I call from
    > Labview. The functions in this dll call functions in the other
    > (private) dll. However, how do I tell Labview where to find this
    > private dll?
    >
    > Is there an option in Labview where I can set paths to dlls?
    >
    The problem is that the system loader is what handles the dependent
    DLLs. Since LV knows about the primary DLL, we try multiple locations,
    the path in the dialog, next to the VI, in the LV search paths, and
    finally we ask the system to look in their places. LV doesn't know
    about the dependent DLL, and it is up to the system to find it. I'd
    recommend trying the system or windows folder again. That should be the
    right solution.
    An off the wall thought that might h
    elp would be to add a dependency
    directly into LV by making a DLL node that calls in the the "private"
    DLL. You don't actually have to call it, you can place it in a case
    structure with a constant set the other way. Anyway, this will cause LV
    to look for the DLL, and I think it might help if nothing else works.
    Greg McKaskle

  • How do I call a LabView VI via dll to display its control panel in a tab of my uir in LabWindows

    Hi User Community,
    I am trying to build a LabWindows Top Level Control Panel to call individual LabView VI's, which have been compiled into a dll.
    I have no problem using the CmtScheduleThreadPoolFunction to start a new thread that calls these VI's however, I'm having trouble trying to get the display that comes up in it's own window to display in a tab of my existing UIR.
    I've compiled the DLLs to always display the VI Control Panel window when running - and usually it covers the whole screen you can't see the LabWindows window until the VI completes.
    Is there a definitive guide to LabWindows Windows/Panels/Tabs? Or does anyone have experience with this? Any help would be appreciated.

    Hello,
    I would suggest reviewing the Programming with Panels and Programming with Tabs CVI Help documents.  I think that this can be done with the LoadPanelEx function.  Let me know how it goes!
    As well, I found some example code to get you started.
    How to access individual controls within multiple tabs in CVI
    http://decibel.ni.com/content/docs/DOC-14187
    Regards,
    Shawn S. | NIC
    Instrument Driver/IVI PSE
    National Instruments

  • Error 0x80040707 - DLL function call crashed QTInstallCode

    Installing QuickTime Stand-Alone QuickTimeInstaller.exe Version 7.0.4.0 I get the following error and QuickTime will not load or function:
    Unhandled Exception
    Error Number: 0x80040707 - DLL function call crashed: QTInstallCode.QuickTimePostInstallProc
    Setup will now terminate.

    I was able to solve this, but I had to uninstall all instances of iTunes, ipod and QuickTime, delete their directories, use http://support.microsoft.com/kb/290301/
    to delete the installations of each and then use msconfig to remove them from the Startup.
    After that I rebooted and did a new install with the QuickTime Stand Alone and it worked!

  • Calling Quit LabVIEW function in a callback VI is not working

    calling Quit LabVIEW function inside a Callback VI (of an activeX component) is not closing the current instance of LabVIEW.
    does anyone else have this issue?
    RENN
    LV2012SP1 64bit
    Kudos always welcome for helpful posts

    Sounds similar to this - https://decibel.ni.com/content/message/48506#48506
    The bug is that the Quit LV function does not work when called from a VI launched through Asynchronous Call By Reference
    AQ said that that bug was resolved in the 2013 beta, so you could try joining the beta to see if that solution also works for your case.
    Try to take over the world!

  • Passing control reference to subVI crashes labview

    Hi,
    using a image control (as indicator) provided by imaq Vision, I tried to pass the reference of the control to a subVI. On a computer it works and on a other (same labview version, same vision version, same os, same hardware and hardware drivers!), this crashes labview. I tried to close the control refnum at the end of the subVI, but that changed nothing to the issue. Now I use the reference as a global variable and it seems to work...nevertheless, I would like to understand what the issue and if I should remove any passing to subVI of control ref because this can potentially triggers an error. My correlated question is if this global passing is a "fake" workaround or have real chance of improving (this before going through the whole code for changing all passing of reference to subVI)
    thanks a lot

    Hi,
    thank CoastalMaineBird for your answer
    How do you know it's this issue which causes the crash?
    When I remove this parameter from and the only property node in the subVi that write to it, I have no longer any problem. Moreover, to ensure that's really the "passing", and made a global variable containing the reference to this control and use my original SubVi that do access the control through its reference number
    , and it works! In this last exemple, the only change is the way of transmitting the reference
    What LabVIEW version?
    8.0.1
    up to date according Measurement & Automation update tool
    Given that one computer works OK, and another crashes, I would say that
    you are seeing the effect of something else, not the cause. If passing
    a control ref via terminals was fatal, it would be fatal all the time.
    You have some other sort of issue, perhaps timing of the different
    machines triggers the bug, perhaps running out of memory, perhaps
    LabVIEW is corrupted on one machine.... But I don't think changing all
    your code to use globals would solve the real problem. Actually, saying that I wonder about problem of synchronisation. I know from Visual C++ that this kind of error happens if two process try to access the same control at the same time. This is typically an error changing from a computer to an other, and mutex or semaphore are the way to deal nicely with that. But does labview contains already such a securisation? If so, the global variable point on a single object and can "fell" the semaphore/mutex. But passing make a copy that will likely have two different semaphore/mutex but will point to a single control! Do someone know if I'm wrong in this idea or not?
    Thanks

  • Auto cleanup crashes LabVIEW (and VI isn't even that large)

    Hi,
    I'm trying to cleanup a VI, and whenever I hit auto cleanup LabVIEW crashes and when retsrated it doesn't even say it previously crashed. I narrowed down the problem location to a for loop. The wierd thing is that I went through all the wires and objects within the loop and did auto cleanup on them but it doesn't crash. So why when I do it on all combined does it crash?
    I wrote a comment in the loop that crashes to show which on it is.
    I'm on Windows 7 LabVIEW 2010.0f2 32bit
    I did see this posting http://digital.ni.com/public.nsf/allkb/599FB39777B​DB12486257514005B7293, but even when doing it manually as suggested it still crashes.
    Thanks,
    Matt
    Solved!
    Go to Solution.
    Attachments:
    Score Videos temp.vi ‏126 KB

    This crash corresponds to a known issue in LabVIEW (CAR #298911), which has been fixed in the forthcoming LabVIEW 2011 release. I have attached a copy of your cleaned up VI from 2011, saved for 2010. You might try to copy the block diagram into a new VI and see if that still crashes LabVIEW, but otherwise an upgrade to 2011 when it's available should clear up the problem. Hope that helps.
    John B.
    Embedded Networks R&D
    National Instruments
    Certified LabVIEW Developer
    Attachments:
    Score Videos temp-1.vi ‏104 KB

  • XYGraph Cursor legend bug instantly crashes LabView 2012

    Hi!
    I am just facing a very annoying bug.
    Please find my example VI attached, I would like to know wheather you can confirm the bug? Run the VI if you wish to see some curve (actually the bug appears even if you do not put any data on the graph, if you do, just the same) and after that try to click on the cursor legend vertical scrollbar to scroll up or down to see the cursor names.
    It instantly crashes my LabView 2012 Full version:  12.0.1f2 (32-bit). This XYGraph always crashes LabView... I cannot go on with my project, now I will just try to bypass the error, I will try to delete the cursors, and add them again...
    Anyhow, very strange and annoying behaviour...
    Anyone could repeat the same bug?
    Thanks for support!
    Solved!
    Go to Solution.
    Attachments:
    XYGraph_bug_test1.vi ‏149 KB

    hello,
    please find attached my example VI, where I would like to programmatically set the label position of a cursor. Why my code does create at every run a new cursor with the same name?
    thanks!
    Attachments:
    cursor_offset_label_via_propertynode.vi ‏12 KB

  • Internet Toolkit for G5.0 crashes Labview 8.2 during Mass Compile

    I have just received my Labview 8.2 update and installed it my system along with all my toolkits. When I tried to Mass Compile Labview 8.2 directory I found that it would crash labview consistantly as shown in the attached image.
    I traced this to the vi's supplied with the Internet Toolkit for G5.0.
    The workaround is ...
    1. Re-installed the Internet Toolkit for G5.0 into Labview 8.2
    2. Mass Compiled ...\project\_config\authcfg.llb using Labview 8.0
    3. Mass Compiled ...\project\_config\authcfg.llb using Labview 8.2
    and there wasn't any more Labview 8.2 crashes during mass compile. As Labview 8.0 was able to mass compile the internet toolkit vi's without crashing I am suspicious that Labview 8.2 might not be completely compatible with Labview 5.0.
    I posted this just in case anyone else sees a similiar issue.
    David
    Attachments:
    Labview 8.2 Mass Compile Crash with Internet Toolkit.png ‏34 KB

    David,
    I was able to reproduce the crash mass compiling authcfg.llb or just trying to open the VI named 'Directory Configuration'.  That code is saved in LabVIEW 5.0.1 and must have something that LabVIEW 8.2 chokes on, I'll have to get someone to investigate it.  Your workaround of saving that .llb or even that one VI in 8.0 first (or probably even 7.x) is the only way I see around it with 8.2.
    I do want to mention that in Q1 2004 we released version 6.0 of the Internet Toolkit and it does not exhibit this behavior.  So the official solution for this crash is to upgrade to the latest Internet Toolkit.
    Kennon

  • Skype click to call crashes

    I Have the Extension Enabled But It Keeps Crashing? How Can It Be Fixed So I can use it? I had to Uncheck Enabled to Stop it From Crashing GOOGLE CHROME

    Offering an opposite view: I make great use of C2C, and just happen to be one of those who uses FireFox and Internet Explorer rather than Chrome.  I make great use of C2C, and am hoping current compatibility issues as at the time I am typing this message are soon to be resolved.   (I miss C2C and never experienced any issues in using it.)
    Update!
    http://community.skype.com/t5/Other-features/click​-to-call-crashes-my-browsers/m-p/1807427/highlight​...
    A new version of the Click-to-Call add-on was issued on 16 August 2013, making this thread outdated.
    Please try these steps, and if Click to Call is still not functioning as expected or if you encounter other problems, please start a new thread (line of conversation:
    Ensure your browsers are updated.
    Download and install the newest Click-to-Call (version 6.11...)
    Remember to enable the add-on in your browsers.
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • Bring Excel 2007 to the front when called from LabView v9 in Windows 7

    I am building a duplicate system using Windows 7, LabView v9 and Excel v2007.  The original system used WinXP, Excel 2007 and LabView v8.6.  The issue is that the original system was able to bring Excel to the front when called from Labview using the property node -application-> visible.  This new configuration runs Excel, loads the data, runs the macros but does not bring Excel to the front.  The icon blinks in the Win7 taskbar and when selected displays over LabView.  If I minimize the Labview window, Excel is there.  This leads me to conclude that Excel is visible, as requested but will not come to the front until selected from the taskbar.  The only differences, besides the versions, is the original system template files used the .xls extension in and was run in Excel in compatible mode.  At the customers request, the new system uses the .xlsm extension on the Excel template files.  I have tried using application.visible = True in the macro as well.  Could be a setting in Labview?  Could be a setting in Excel? Could be .xls vs. .xlsm? Or an issue with Windows 7 and the newer version of Labview. 
    HP workstation - Labview v9 - Windows 7 - Excel 2007 sp2
    Thank you in advance
    Stephen
    Solved!
    Go to Solution.

    I will try the windowstate change.  Were these done in succession? (i.e. property node -> property node -> property node) Or were they done along the way such as call the ActiveX open and a property node then in a worksheet modification area etc. so there was some time between calls? 
    I am not sure about the API since the discussion there is with regard to DDE.  (Taken from the link document:  If you want to call a DLL that contains ActiveX
    objects, use the Automation
    Open VI with the Property
    Node and the Invoke
    Node.).  I am calling Excel as an application not as a library call unless I am mistaken, which I could certainly be.  Are you thinking that once Excel is active through the Automation Open VI that a DLL call to set the application visible would work?  I may be trying this already but in Excel through the use of the macro I call from LabView.  It contains application.visible = True at the beginning before reading files and plotting data.  
    I may try sprinkling Property node with application->visible in various locations in the LabView diagram as I do update cells after the call to the plot macro.  The puzzle for me is the blinking Excel icon in the task bar.  This means active and running but not visible or something wrong as well.  There are a few #VALUE cells if not all test in the system are run.  Again not a problem in Excel 2007-WinXP-LV8.6
    Thank you again one and all.

Maybe you are looking for

  • Need Suggestion for doing XI Project

    I have to work with project like Inter-distribution of stock availabilty check, Request for goods,Purchase Order,Invoice.... Can u give me idea how to proceed with this project in XI.. I am new to SAP also... Wht kind of scenarios i have to work with

  • Screen flicker when copying to desktop

    I am experiencing a sudden screen flicker when I copy files or folders to my desktop? Doesn't seem to affect the system in any way, just very annoying. Anyone else having this issue? Is there a fix for this? Thanks, Rick

  • Probably a simple answer to a simple question

    I used all of my hard earned money to enjoy this wonderful device sent down from heaven. Now after 33 hours of trying to make my very un-cooperative computer work with this thing I have a really simple problem to you but to me its like nuclear physic

  • AP Group VLAN "Feelgood" does not exists on controller.

    Hi, While appling tenplates from WCS, i getting status report error message AP Group VLAN "Feelgood" does not exists on controller. I have double  checked the perticular AP group WLAN is created & mapped to the correct interface in the controller. Th

  • Iphoto quits unexpectedly when tagging faces

    I´ve got about 25K photos in my collection, thousands of them have been tagged (roughly 100 people). (Says 8K or so are still to be tagged.) Suddenly (happened a few months back), whenever I try to tag untagged photos, iPhoto will quit unexpectedly.