I cannot access my stop button while data aquistion is going on

I have written an application that aquires data from a GPS reciever over a TCP connection and displays it on a graph in "real-time" and it works except that I cannot access my STOP button to stop the connection while it is working. I think I need to do something with multithreading and have done some multithread programming before to do background processing but cannot seem to get a handle on how to make this work. I am sure it must be something qite simple as it seems like something that is quite common. Any help greatly appreciated. My application started life as the Multi XY plot example program from NI.
Thanks
DEan

You can pass a reference to the dialog class into your thread and manipulate the graph that way. The following snippet demonstrates one way of doing this using the DAQmx C API
UINT CDAQMTExampleDlg::AcquisitionThread(void* pParam)
CDAQMTExampleDlg* pDlg = static_cast < CDAQMTExampleDlg* >(pParam);
double data[1000];
int32 read;
int error;
if( (pParam != NULL) && pDlg->IsKindOf(RUNTIME_CLASS(CDAQMTExampleDlg)))
CoInitialize(NULL);
TaskHandle taskHandle = pDlg->taskHandle;
CNiReal64Vector vectorData(1000);
double *pvectorData = (double*)vectorData;
while(!pDlg->stopTask)
DAQmxErrChk(DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByScanNumber,pvectorData,1000,&read,NULL));
pDlg->m_Graph.PlotY(vectorData);
Error:
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
pDlg->stopTask = true;
CoUninitialize();
return 0;
void CDAQMTExampleDlg:nBnClickedButton1()
int error;
DAQmxErrChk(DAQmxCreateTask("",&taskHandle));
DAQmxErrChk(DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle,"",10000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
DAQmxErrChk(DAQmxStartTask(taskHandle));
stopTask = false;
AfxBeginThread(AcquisitionThread, this);
return;
Error:
char errBuff[2048]={'\0'};
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 ) {
/*/ DAQmx Stop Code
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
if( DAQmxFailed(error) )
printf("DAQmx Error: %s\n",errBuff);
void CDAQMTExampleDlg:nBnClickedButton2()
stopTask = true;
I also wanted to make sure that you know that if you have Measurement Studio 7.x, you have access to a C++ DAQmx API. You can find examples of that API under ..\MeasurementStudio\VCNET\Examples\DAQmx. The C++ API provides asynchronous methods, which means that aquisition worker threads are automatically created for you in the background instead of you having to create them yourself. Plus the C++ DAQmx API provides error handling via exceptions and is designed for use with MFC.
I hope this helps
Bilal Durrani
NI

Similar Messages

  • HT201401 I am experiencing extreme difficulty with my celluar data, my sim has been changed to GiffGaff with the same number, yet I cannot access my icloud and celluar data I need my internet and icloud for a month now no connection please connect my cell

    I need to obtain my celluar data for my 3G iphone which has not been operating for the past 4 weeks now, since I changed my sim from orange to giffgaff and the sim cannot access the celluar data and neither the internet on the phone or on the sim.  I would like to connect this immediately as this is not good for business and for family and friends as they are complaining that they cannot access my number.  I am not please about this at all.  I have tried connecting through the computer and still no connection.  The serial number is 88******3NP and the Carrier is O2 14.0
    Thank You
    Ntala Cynthia
    <Personal Information Edited by Host>

    You need to contact GiffGaff for assistance. This is more than likely caused by changes in the APN. You need to have the settings from GiffGaff so you can access data and internet.

  • I cannot get the STOP button to appear in the Navigation Toolbar, even after going through the suggestions; it will appear when the Restore Default Set window is open, but disappears as soon as DONE is clicked

    The X for STOP loading the page does not appear in the Navigation Toolbar. If I do the right click, select Customize, Restore Default Set, it appears; click Done and it disappears. I have disabled the theme; disabled all extensions; reset the toolbar & controls; unchecked the acceleration. No luck.

    Starting in Firefox 4, the Go, Stop and Reload buttons are combined in one button at the right end of the URL or Address bar. The button changes depending on the activity:
    *green Go arrow when typing in the address bar
    *red Stop ("X") button while page is loading
    *gray Reload (circular arrow) when page is finished loading.
    Separate buttons are possible:
    #Open Customize Toolbar window by clicking Firefox button > Option > Toolbar Layout '''''OR''''' clicking View > Toolbars > Customize if using the Menu Bar '''OR''' right-click in an empty space on a toolbar and choose Customize
    #Stop and Reload buttons will show separated between the address bar and the search bar
    #drag the buttons anywhere on the Navigation toolbar
    #*order Reload-Stop will combine into one button
    #*order Stop-Reload will remain separate buttons
    #*or drag a "Separator" from the Customize window between Reload-Stop and they will remain separate
    #click Done at bottom right of Customize window to finish
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    You have multiple old versions of Java Console installed that Java did not clean up when updating. Your old versions are: 6.0.16, 6.0.22<br />
    Follow these instructions to remove the old versions: http://kb.mozillazine.org/Java#Multiple_Java_Console_extensions

  • I run firefox on windows 7 but in most sites I cannot access all the buttons, even to fill in this form I had to use explorer

    I always used firefox but cannot use on this computer, in almost all pages there are buttons that I cannot click on, for example to make this request I had to use explorer becasue the line of menus on the top of firefox was not active and I could not click on SUPPORT
    and this happens in most sites, it seems that all the buttons outside the main page are disabled or not clickable.
    Maybe there is just some setting to enable or disable but I've no idea where to search.
    thank you

    That may be caused by three issues:
    "- You have a theme that is not compatible with your Firefox build."
    Go to Firefox, Extensions, Appearance and make sure you use Default style.
    '''- You have an extension or theme that is damaging your Firefox installation or your browser's configuration is broken. Reset Firefox feature may help to solve that.'''
    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    '''- You have a Windows visual style that is not working well with Firefox. Try to switch to Classic style.'''
    Switching to Windows Classic style can solve many graphical glitches on Firefox by forcing it to use basic graphics without effects. To try if Firefox works better on Classic mode without changing your visual style, try this:
    # Create a Firefox desktop shortcut if you don't have it.
    # Right-click it and click on Properties.
    # On the Compatibility tab, click on ''Disable visual styles'' check box.
    # Click OK and start Firefox.
    ''You may need to restart Firefox on safe mode so no visual themes are loaded.''
    '''The Safe Mode is a troubleshooting mode, which disables most add-ons.''
    ''(If you're not using it, switch to the Default theme.)''
    * You can open the Firefox 4.0+ Safe Mode by holding the '''Shift''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Don't select anything right now, just use "Continue in Safe Mode."''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shift key) to open it again.''
    '''''If it is good in the Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one.
    Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''

  • Using firefox with yahoo toolbar I cannot access my hotmail button, it locks up my email account, I cannot read/delete emails or log out of account.

    I use the yahoo-firefox toolbar that has buttons you can access from the toolbar, mail etc. I have a button for Hotmail it goes to the account but locks up, it will not let me read/delete emails nor log out of my account. I can access it from another laptop that is not running the same versions of firefox/yahoo toolbar.

    Last but not least, for the site that has the problem:
    When you have a problem with one particular site, a good "first thing to try" is clearing your Firefox cache and deleting your saved cookies for the site.
    (1) Clear Firefox's Cache
    orange Firefox button (or Tools menu) > Options > Advanced
    On the Network mini-tab > Cached Web Content : "Clear Now"
    If you have a large hard drive, this might take a few minutes.
    (2) Remove the site's cookies (save any pending work first). While viewing a page on the site:
    * right-click and choose View Page Info > Security > "View Cookies"
    * Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
    In the dialog that opens, you can open the site's cookies individually.
    Then try reloading the page. Does that help?

  • Cannot access local DFS shares while VPN is active

    Hi
    We use Windows Server 2008 Standard as a domain controller. It also hosts DFS. Although the namespaces are hosted on the server, the data is stored on a Windows 2008 Storage Server. We do not use DFS replication.
    I have several DFS shares mapped on my Windows 7 client, which has just replaced my XP client, and can access them without any problems.
    However, as soon as I connect to a remote network (located on a different domain - it has nothing to do with our network at all), I am unable to access our DFS shares. If I try to access a DFS share an error message pops up stating:
    Location is not available
    Logon failure: unknown user name or bad password.
    The first time I connected the VPN a network dialog popped up asking what type of network it was and I chose Work. After connecting via the VPN I use remote desktop to carry out daily maintenance on a server on the remote network.
    Other local resources are available. I can ping machines via IP, name and FQDN. I can access the same DFS shares using UNC paths. So, although I receive the error message described above when accessing AD-name.local-backslash-share-name1 I have no trouble
    accessing server-name-backslash-share-name1
    As soon as I close the VPN connection normal functionality is restored and I can again access the DFS shares without any problems.
    Can someone help me fix this, please? When this was setup on my XP machine I never experienced this problem.
    Also, is there a way of typing LAN addresses without the forum software converting them to a customised hyperlink? Thanks!

    Thank you, fupin
    Sabrina's suggestion to edit the pbk file worked. I changed the setting from 1 to 0 and connected to the remote network via the VPN and am still able to access the local DFS shares.
    As per the OPs comments, the username and password I am using for the remote network are both different from the credentials I am using on the local network.
    ... take the steps in the KB 822707 to resolve it:
    1). Locate the .pbk file that contains the entry that you dial. To do so, click Start, click Search, type *.pbk in the All or part of the file name box, and then
    click Search.
    2). Open the file in Notepad.
    3). Locate the following entry: UseRasCredentials=1
    4). Modify the entry to the following: UseRasCredentials=0
    5). On the File menu, click Save, and the click Exit.
    Cheers!

  • SCCM 2012 cannot access distribution point as a data source for OS image

    I am trying to path a data source to one of our file servers and get the following error:
    I am guessing this is a permissions issue.  The path is correct. This is also a distribution point and I have no trouble distributing content to it.  The SCCM server is set to have local admin and network share rights to this file server.  Any
    ideas?

    Of course - that would be too easy... had to ask though :)
    Hmm, sounds odd.  I'm guessing that since you're using it as a DP you're on Windows Server... You might try browsing there in your runline but instead of doing
    \\server\share\OS.WIM try doing
    \\Server.FQDN\Share\OS.WIM
    I've seen some odd issues where I need to specify FQDN but it's pretty rare.  I do remember an issue where my own account would not go through even though it had rights and I could navigate.  I used a different account and I think after a while
    it cleared up.  My guess is something got rebooted and it "righted the ship" so-to-speak.  I'm sorry I don't remember more, that particular client had multiple accounts so I just switched to a different one and by the time I had to do the same function
    again the issues had resolved itself so I just moved on.

  • Box on screen saying cannot access account stopping any further action.

    Thank you to both King Penguin and Demo -  your solution worked and I am back on track again! I am not sure why the problem arose, but a reset will be my first action for any future problems. Many thanks again

    I think I can speak for King Penguin here and say that you're quite welcome.

  • I cannot access my calling pad or contacts on the Z10

    I upgraded my OS to 10.2.0.429 version 10.2.0.1803 last night. But since then, I have been unable to access my phone. I cannot get onto it to make or receive calls. When I call myself from another phone, the call is going through, but on my Z10, the phone is not ringing and there is no indication that the call has come through.  Is there anyway to remedy this. It is frustrating that I have a phone where I can access the internet and all my other apps (including the camera and search) but I cannot access the phone to call

    and you're not going to answer my question... I can't help you. I'd like to.
    The charging/draining issue can likely be rectified... leave it charge a few hours using the OEM wall outlet charger.
    Then, while it is still connected to the charger, remove the batttery and reinsert to reboot.
    Likely, the on-device software battery meter is offsync with the actual battery charge. Doing the above process will help reset that software meter.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Lost the STOP button with upgrade to FF9

    I cannot get the STOP button to appear on the Navigation Toolbar since I upgraded to FF9. Where did it go?

    It has been a combined button by default on the end of the location bar for some time now.
    While a page is loading it is a stop button, because that is when you may wish to stop it, and once it is loaded it becomes a reload button, because you may then wish to reload the page.
    It may be customised by dragging it off the end of the location bar and reversing the order of the buttons, you then get two separate buttons see:
    * [[how do i customize the toolbars?]]
    * [[common questions after upgrading from firefox 3.6#w_what-happened-to-the-back-refresh-and-home-buttons]]_what-happened-to-the-back-refresh-and-home-buttons

  • Window iphoto to big: no access to upload button and bug

    Hi,
    I have a problem with my iphoto window upload: she is to big since 2 weeks...I suppose that i'have touched something...I cannot have access to the lower right corner.
    For example:if i'm on facebook and want to upload some photos, the iphoto window open and this one is to big .So I cannot access to "upload' button and this window block,bug and i need to quite safari.
    If i go to " Presentation" and reduce it,it's not good ( reduce the other window) and if I click on the green button on the left corner its (in my example)for the faceBook page.
    Somebody for help me?
    Thanks !

    Hi...
    Login to another user account on your Mac. Try Facebook on Safari there. If it's ok there, then at least you know the issue is just with your user account, not a system wide problem.
    If you don't have another user account available, instructions for creating one here.
    http://docs.info.apple.com/article.html?path=Mac/10.5/en/8235.html
    If you haven't tried turning off Safari Extensions... do that. At least you can rule that out. You can access Safari Extensions from the menu bar, Safari / Preferences / Extensions.

  • My access was blocked because i left my pc on at home and now i cannot access anymore with thunderbird only via browser how can i restore access??

    I cannot access anymore via thunderbird while with the same pw i can access via browser after my account was blocked how can i restore access via email program?

    I was on my gmail account and looked at settings forward and pop/imap
    be sure they are activated.
    Imap if you want to access it from several places. That way you have the original on Gmail-server and copies on your pc.
    Pop on the other hand loads down the emails. perfect if its just one pc.
    (i'm not sure the Gmail-server deletes them thou).

  • I cannot accessing itues with windows i removed itunes and reinstall again but still i cannot connect to itune

    i cannot accessing itunes with windows i removed itunes the same order it said on support and reinstall it again but still i cannot accessing itunes

    Is it hanging while saying "Accessing iTunes Store"?

  • Cannot access itunes radio through autoconfig proxy

    I've moved to a new office, and the new office uses autoconfig proxy. The autoconfig proxy needs authentication. Since moving to this new office, I cannot access the itunes radio. I've tried going to one of the radio website radioio and tried listening directly from there. But also no success. I clicked on the links on the website and windows media player popped up, but it seems that it also cannot get through the proxy. In addition to proxy, it seems there is also a filter installed at the new office.
    Anyone knows how I can listen to the itunes radio again at this new office?

    You'll have to talk with the IT people and see if they have blocked the ports.

  • HT1386 During iTunes update on my pc, my iPhone was connected to pc via usb & was syncing, suddenly my iPhone stopped connecting to wifi and cannot activate. I cannot access iPhone data as it says connect to iTunes to activate but cannot connect

    During iTunes update on my pc, my iPhone was connected to pc via usb & was syncing, suddenly my iPhone stopped connecting to wifi and cannot activate. I cannot access iPhone data as it says connect to iTunes to activate but cannot connect. How do i connect to iTunes to activate iPhone as iPhone cannot connect to WiFi or any other network
    Please how do i reactivate iPhone?

    Hello DadiPrince,
    The following article contains information beneficial to getting your iPhone back into normal working order.
    iPhone: Troubleshooting activation issues
    http://support.apple.com/kb/TS3424
    Resolution
    Perform the following steps if you receive one of the messages above:
    Restart the iPhone.
    Try another means of reaching the activation server and attempt to activate.
    Try connecting to Wi-Fi if you're unable to activate using a cellular data connection.
    Try connecting to iTunes if you're unable to activate using Wi-Fi.
    Restore the iPhone.
    If you receive an alert message when you attempt to activate your iPhone, try to place the iPhone in recovery mode and perform a restore. If you're still unable to complete the setup assistant due to an activation error, contact Applefor assistance.
    All the best,
    Allen

Maybe you are looking for

  • How do I change the keyboard shortcut for Cycle through open documents in PS CC for Mac?

    Sorry to bug the community with such a seemingly inconsequential task, but I am seriously tired of using the awkward default keyboard shortcut for cycling through open docs in PS.  I'd like to change it to what I am used in in Chrome, which is Cmd+Op

  • Posting Date in Service Entry Sheet

    Hi All, The problem I am facing is as follows: The Client makes a service PO then it gets released from the highest level. Thereafter when we do service entry sheet in ML81N, that also has a release strategy and if suppose the highest level has relea

  • Ajax4jsf rerender not working properly.

    Hi, I am using ajax4jsf, version 1.0.2 in my project. I am having the following jsf page and the corresponding bean class. If bean throws any error message, the javascript method "showErrorMsg" is getting called, but, "userProfoileErrMsg" is always e

  • What happened to command control D over text?

    In Snow Leopard and Lion, you could hold down command control D over text (try it in TextEdit or Safari) and the definition for the word would pop up. What happened to this?  Why is it gone?  How can this be restored? Anyone? It is so bothersome when

  • Telephone number in smartform address

    I am using an address element text to show the address information, but i want to include the telephone number in the showed information, is there any posibility to  indicate that i want to show ALL the information of the vendor? Thanks in advance