Using BroadcastSystemMessage to ping another application

I have a server application from a vendor that provides various services I need to use.  The vendor also provided a sample client application written in Borland C++ Builder.  I'm trying to implement the same message passing scheme they use in their client ina CVI program, but I can't get past the first step.
The Borland app first uses BroadcastSystemMessage to ping their server application.  Then it waits for a response from the server in the form of a WM_COPYDATA windows message.  The original Borland code for pinging the server looks something like this:
   UINT ping_id = RegisterWindowMessage("client_ping");
   DWORD dwApps = BSM_APPLICATIONS;
   BroadcastSystemMessage( BSF_NOHANG, &dwApps, ping_id, (WPARAM) m_client_handle, 0 );
The m_client_handle is the windows handle of the client application.  The server uses that handle to send it's reponse directly back to the client. My CVI implementation of the ping looks like this:
    GetPanelAttribute (panelHandle, ATTR_SYSTEM_WINDOW_HANDLE, (int *)&ClientWindowHandle);
    int PingId = RegisterWindowMessage("client_ping");
    DWORD dwApps = BSM_APPLICATIONS;
    int err = BroadcastSystemMessage(BSF_NOHANG, &dwApps, PingId, (WPARAM) ClientWindowHandle, 0);
BroadcastSystemMessage returns a 1 indicating that everything worked fine.
The next half of the ping is to catch the return message from the server.  The Borland app does this by implementing the call OnCopyData for it's main form.  As best as I can determine, this is essentially a predefined message handler for WM_COPYDATA.  I implemented this in CVI with the following code:
int main (int argc, char *argv[])
    // this is really the same call as before (i.e., I only get the handle once)
    GetPanelAttribute (panelHandle, ATTR_SYSTEM_WINDOW_HANDLE, (int *)&ClientWindowHandle);
    InstallWinMsgCallback (panelHandle, WM_COPYDATA, ProcessWmCopydataMessage, VAL_MODE_INTERCEPT, &panelHandle, &ClientWindowHandle);
int CVICALLBACK ProcessWmCopydataMessage (int panelHandle, int message, unsigned int* wParam, unsigned int* lParam, void* callbackData)
    PCOPYDATASTRUCT ServerInfo;
    if (message == WM_COPYDATA)
        // process returned message
The problem is that I never get a call to PrcoessWmCopydataMessage.  Am I doing something wrong in my setup?  In particular, am I retrieving the correct handle for my application and am I sending it correctly in the broadcast message?  Is there any spy tool that allows you to watch all windows messages and reponses so I can determine if the server is doing anything?
I tired writing my own dummy server just to verify that BroadcastSystemMessage works the way I expect.  The only problem is that I can't figure out how to catch the broadcast message in my dummy server app.  How do I install a callback that will catch broadcast messages?
One last thing: at first I couldn't get BroadcastServerMessage to compile.  It said it was not declared.  After a quick search on the forum, I added the following line before my inclusion of the windows header:
    #define _WIN32_WINDOWS 0x0410
It compiles now, but I'm concerned that by faking my Windows version I may have messed up something else.  I running Windows 7 BTW.
Tony G.

Hey Tony -
The reason you get the compile error is because CVI does not define _WIN32_WINNT in the version of CVI you are using.  We expect the programmer to define it based on their own needs.  BroadcastSystemMessage is conditionally compiled so that it will not be defined if _WIN32_WINNT is not defined:
WinUser.h
#if defined(_WIN32_WINNT)
WINUSERAPI
long
WINAPI
BroadcastSystemMessageA(
The consequence of defining it to be 0x0410 is that you are stating your program is compatible with version NT 4.0 of Windows and later.  This means that you can use all functionality of the Windows OS that was available in Windows NT 4.0, but none of the newer functionality will be available to you.  If you try to run your program on a version of Windows older than Windows NT 4.0, the program will likely not run (this should not be an issue...)
Note that 0x0410 is not actually a defined Windows version.  From a recent version of the Interface to the Win32 API, you can read from sdkddkver.h:
#define _WIN32_WINNT_NT4     0x0400
#define _WIN32_WINNT_WIN2K   0x0500
This means that you are stating your program uses no Windows fuctionality more recent than Windows NT 4.0.  Here's some more good information on using these macros.
NickB
National Instruments

Similar Messages

  • Error message Indesign:Either the file does not exist, you do not have read access to it, or use the file in another application.

    I've got problem with opening a file in InDesign. The file type is an InDesign Markup Document. The error message is: Either the file does not exist, you do not have read access to it, or use the file in another application. What's wrong?

  • Calling a Taskflow present in one App using a url from another Application

    Hi,
    I a have a requirement to call a taskflow present in another Application using a url from present JDEV Application.
    Is that possible in JDEV 11g? Can anyone give me an example.
    Thanks,
    User
    Edited by: user617801 on Feb 24, 2009 11:24 AM

    Hi,
    Check out this example . It is for TP4, but it should be the same on WLS.
    Pedja

  • Using java to run another application

    How to use java code to execute another program such as MS Word and etc? and how to locate the java running program into the right side windows?
    Thanks

    It woulds to me like you would like to do some OLE, and have the product open up into your application like it does in C/C++, VB, or J++ applications. If this is the case I would as: do you know how to do this using C/C++? I ask this because the only way I know of to do what you ask for is with a lot of C/C++ code using the OLE interface for the products you would like to incorporate.

  • XviD to DVD using iDVD 2 (or another application?)

    I'd like to be able to download this free movie http://www.starwreck.com/download.php which is in the XviD format, and burn it to a DVD that could play in a DVD player. Is that something I should be able to do, and if so how?
    Thanks!

    VisualHub claims to convert divx into something useful for creating videoDVD....
    there are plug-ins for QTpro, to let QT playback and convert divx too.... workflow would be divx>>dv>>iDVD…
    but, I do know, there're many "flavors" of divx out there... hopefully, yours is supported.....
    helpful?

  • Creating a View at Database level to be used in an another application

    Posted - 01/20/2012 : 11:43:27
    I have a table Named Customer_Distribution in which we store all the recepient information based on a request submitted by the customer.
    Maximum number of recepients for a request is 3.So if a customer submits a request with 3 recepients the Customer_Distribution table will have 3 records inserted for the request as below
    ReqNo recepientdesc recepientname recepientemail
    1 R Abc [email protected]
    1 U xyz [email protected]
    1 S sap [email protected]
    I'm trying to create a view and need help to create the view such that the entire Request Information is in a single row rather than multiple rows as we are trying to use this view in another application where it will be easy to retreive if the entire information is in a single row
    The View should have the data in the below format
    ReqNo desc1 name1 email1 desc2 name2 email2 desc3 name2 email2
    1 R Abc [email protected] U Xyz [email protected] S sap [email protected]
    Thanks

    user12946819 wrote:
    Hi
    Would you be able to elaborate more on your response as i am new to oracle and have hard time using your response
    Thanks
    ME_XE?with
      2     data as
      3  (
      4     select 1 as ReqNo, 'R' as recepientdesc, 'Abc' as recepientname, '[email protected]' as recepientemail      from dual union all
      5     select 1 , 'U', 'xyz',  '[email protected]'         from dual union all
      6     select 1 , 'S', 'sap',  '[email protected]'       from dual union all
      7     select 2 , 'Q', 'me',   '[email protected]'        from dual
      8  )
      9  select
    10     ReqNo,
    11     max( decode( rn, 1, recepientdesc))     as desc1,
    12     max( decode( rn, 2, recepientdesc))     as desc2,
    13     max( decode( rn, 3, recepientdesc))     as desc3,
    14     max( decode( rn, 1, recepientname))     as name1,
    15     max( decode( rn, 2, recepientname))     as name2,
    16     max( decode( rn, 3, recepientname))     as name3,
    17     max( decode( rn, 1, recepientemail))    as email1,
    18     max( decode( rn, 2, recepientemail))    as email2,
    19     max( decode( rn, 3, recepientemail))    as email3
    20  from
    21  (
    22     select
    23             ReqNo, recepientdesc, recepientname, recepientemail,
    24             row_number() over (partition by ReqNo order by recepientdesc asc) as rn
    25     from data
    26  )
    27  group by ReqNo;
                 REQNO DES DES DES NAME1     NAME2     NAME3     EMAIL1                                        EMAIL2                                        EMAIL3
                     1 R   S   U   Abc       sap       xyz       [email protected]                                 [email protected]                               [email protected]
                     2 Q           me                            [email protected]
    2 rows selected.
    Elapsed: 00:00:00.01
    ME_XE?In the future, posting sample data in a format that someone can easily use (like i did above) will get you answers a lot quicker. I'm in a decently good mood this morning so i did it myself. 7 times out of 10 i'll skip over questions that don't make it easy for me to help. Just an FYI to help you in future posting.

  • File Error: The Specified file is open and in use by this or another app...

    I have imported a string of pictures and dragged them into the FCP timeline. I render them and it renders a certain percentage then it stops and says "File Error: The Specified file is open and in use by this or another application."
    After reading this, I quit out of FCP, restarted my computer, opened FCP, nothing other program, tried to render again and same thing happened. It renders part of it then the error message pops up, then I can render again and it will do another percent then it will pop again and so on.
    Suggestions, or does anyone know why this happened? Thank you very much for your time.
    A

    okay - don't know where you've got your scratch disc set but hopefully it's to another drive other than your boot.
    The same drive where your render files should be located, ie some drive other than your boot drive.
    Can you copy the jpegs over to that drive into a folder.
    Delete them from your tl, delete them from your proj. Save your project. Close fcp.
    If they're on your boot drive - delete them.
    Reopen fcp and Reimport them from the new location.
    Sorry for all the steps - but we have no idea how you have configured fcp or your level of experience. Trying to cover all the bases ...

  • TS1393 I cannot eject my iPod using either itunes or the eject button on bottom tool bar beacuse it says something is in use by another application or "The device 'generic volume' cannot be stopped because  a program is still accessing it" Synced new iPad

    How can I eject my ipod when neither itunes not the "safe to eject" button will allow it.  Itunes says "...cannot be ejected because it contains files that are in use by another application."  The safe to eject button says "The device 'generic volume' cannot be stopped because a program is still accessing it."  The has never happened before.  The only thing new is that I added an iPad yesterday.  Thanks. 

    Go to your computer's System Tray and try ejecting.  If you can't eject, there is an application that is trying to access your iPod.
    Go to http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx and download ProcessExplorer.
    Go to http://support.microsoft.com/kb/555665 and follow the instructions under Resolution.
    Note that this is a good, general process any time you can't access any file.
    In my case an update to RealPlayer installed a program called RecordingManager that was accessing my iPod.

  • HT1339 I lost all my songs on ipod when my mom plugged her ipod into my computer. I tried to restore it but it says it cannot be restored because it is in use by another application. What do I do now? help! I still have all my songs in my itunes library

    I lost all my ipod songs when my mom plugged her exact same ipod (5th generation nano) into my computer. She did not get my songs on hers but somehow I lost mine. I tried the five R's and evrything I could find online. I cannot get the songs from my iTunes library back on my ipod. I get a message that says. "Gina's ipod cannot be restored because it is being used in another application." Please help me

    Why do you need to restore your iPod to resync your content back over to it from your iTunes library? You should just be able to configure the content to sync to your device as you did before this problem occurred.
    iTunes: Syncing media content to iOS devices and iPod
    B-rock

  • I was trying to move iphoto library to my external hardrive, realised it was incompatible with Mac.  The iphoto will not open now, message is "Iphoto library is either in use by another application or has become unreadable".  I have read other posts.

    Hi,
    I was trying to save a copy of my iphoto library by copying images to my external harddrive.  I wasn't sure how to do it, realised the hard drive is not compatible. Now the iphoto library wont open and reads "iphoto library is either in use by another application or has become unreadable".
    I have tried to use options command and click on iphoto then rebuild yet nothing happens and same error message occurs.
    I have gone to  my personal drive, desktop, iphoto library, and found file Albumdata.xml and when i click on it, there is a lot of text in it, i am assuming these are all my photos.
    I have tried clicking and dragging this file to iphoto app and it doesn't work, as the same error comes up in iphoto being in use or unreadable....
    What am I meant to do with albumdata.xml file and how do I reopen Iphoto from here on in?
    Please help as I am not technically minded and still trying to understand how to use the Macbook at all as I am used to Microsoft.
    Thank you very much,
    KS

    Rule Number One - NEVER go directly uinto the iPhoto library - there are no user servicable parts in it and making any change no matter how small can corrupt your library and cause data or photo loss
    Exactly how were you trying to save a copy of your iPhoto library?
    Albumdata.xml does not contain your photos - and again NEVER make any changes to the content of the iPhoto library - no dragging - no changes - never go into the library
    We need to know exactly what you did
    And probalby the easiest solution is to load your backup from before you messed things up
    For reference after you get things working
    Moving the iPhoto library is safe and simple - quit iPhoto and drag the iPhoto library intact as a single entity to the external drive - depress the option key and launch iPhoto using the "select library" option to point to the new location on the external drive - fully test it and then trash the old library on the internal drive (test one more time prior to emptying the trash)
    And be sure that the External drive is formatted Mac OS extended (journaled) (iPhoto does not work with drives with other formats) and that it is always available prior to launching iPhoto
    And backup soon and often - having your iPhoto library on an external drive is not a backup and if you are using Time Machine you need to check and be sure that TM is backing up your external drive
    LN

  • ISight camera "in use by another application"

    Hello. I'm having trouble using my built-in iSight camera in my brand new MacBook Pro. I can get the thing to work while using iMovie 08, but it won't work with Photo Booth, iChat, or iMovie HD. The very first day I had the computer, it worked with Photo Booth, so I'm fairly certain it's a software problem. I've loaded a ton of software.
    The error message I get for iChat and Photo Booth is "Photo Booth cannot open because no camera is attached or the camera is in use by another application." It isn't. I swear.
    After reading through a bunch of posts, here's what I've tried:
    1. Reinstalling QuickTime
    2. Updating the OS
    3. Rebooting
    4. Repairing permissions
    5. Deleting the Photo Booth preferences
    6. Zapping the PRAM
    7. Resetting the CMU
    8. Logging in through a brand-new user account
    9. Checking to make sure the camera shows up under the About This Mac/More Info section
    10. Trashing everything I can find related to the HP Scanner software (though I'll need that again in the future)
    11. Getting rid of other devices listed under the Image Capture folder in my Library
    12. Re-installing Photo Booth
    13. Calling Apple Support. They gave up and told me to "archive and reinstall," but after spending several weeks installing software, I don't want to do that. Archiving and reinstalling is a pain in the butt. They also offered to "escalate" the issue, but after 1.5 hours on the phone, I decided to try back another day.
    In the meantime, I wanted to see if anyone else had some advice.
    It feels like the old days of OS 9 extensions conflicts. But I'm just not sure how to problem solve these things. Like, for example, if it IS a problem with HP scanner software, how do I get rid of all of it? Might it be a problem with having both iMovie HD and iMovie 08 on the same computer...? How can I systematically problem-solve this thing?

    Welcome to Apple Discussions, schmargle
    I think you are on the right track. The fact that you have "loaded a ton of software" makes me think possible conflicts.
    For your HP issue, parkersal's solution at http://discussions.apple.com/message.jspa?messageID=4246676#4246676 might help you. In addition to some more details about parkersal's tip, you can find some other users' suggestions in Shelia Addison's sightless iSight ... thread.
    If HP is not your only problem, your quickest fix may to be an Erase (your entire startup disk) and Install (of the OS.) Update to the latest version, and test your iSight before you install anything else to be sure it works. Then install the additional software you need one-by-one, testing iSight between each one to make certain you know which one is breaking it.
    EZ Jim
    PowerBook 1.67 GHz w/Mac OS X (10.4.11) G5 DP 1.8 w/Mac OS X (10.5.1)  External iSight

  • I can't eject ("files in use by another application") Windows/Vista Issue?

    OK... so in the grand scheme of things, this really is NOT the end of the world... but it sure is super-annoying!! This is my first every Apple product (took a while to get on the bandwagon) and I was hoping for more stability and ease of use... I've called AppleCare several times and they can't help me figure this out... according to them it's a Windows/Vista issue (which DOES seem likely). I'm running Windows Vista Home Premium on a Dell Dimension E521.
    Here's how it goes... I plug my iPod in, which opens up iTunes and it syncs fine. I wait until the top of iTunes says "sync complete" and the face of the iPod simply says "Connected". Then I click on the "eject" button next to the iPod listing in iTunes. It pauses for a moment, then I look down and the iPod suddenly has those syncing, circular arrows, moving again and it says "Synchronizing- do not disconnect". And then a few moments later, iTunes gives me a pop-up that says " XXXX ipod cannot be ejected because it contains files that are in use by another application"
    So obviously, something else is connecting to the iPod and preventing me from ejecting it using iTunes, but I have not been able to figure out what it is!
    Since it's something on my machine, I have tried the following:
    - shut down AntiVirus (TrendMicro Internet Security 2008)
    - turned off Windows Firewall
    - went through all the programs running in the task bar and turned them off
    - opened up Task Manager and turned EVERYTHING else I could see off
    None of the above have made any difference. The workaround that Apple gave me was to go into Computer and then right click on the listed drive and select "Safely Remove" which usually works (the times it doesn't work, it gives a similar message saying the device was being used by another application and can't be removed, try again later). But 90% of the time it works.
    I use that or the Eject option when I right click on that drive (not sure the difference, they seem to do the same thing). The workaround works, but I'd sure LOVE to get iTunes to be able to eject my iPod!!
    Here's what I've done regarding this iPod and iTunes:
    - reset the iPod
    - restored the iPod
    - uninstalled and re-installed iTunes
    - selected and unselected the various things I'm syncing (currently: Music, TV Shows, Podcasts, Photos) to see if it was one of them causing the issue
    NONE of the above has made any difference (and I've done each about 2-3 times, ZERO exaggeration).
    I've called into AppleCare about half a dozen times now, hoping to get that one brilliant tech that knows more than the others... but no luck yet... so I thought I'd try this forum to see if one of the brilliant posters here can help me sort this out.
    PLEASE- ANY help you can provide (or even just point me in the "right" direction of how to determine this) would be GREATLY appreciated!!
    Thanks so much in advance,
    SC

    I am using windows Vista and having this problem also (not exactly, but iTunes gives pop-up that "files are in use"). Acting a suggestion from another answer in this thread, I clicked on Computer and selected eject...windows did warn me that the device was in use, but also gave me a CONTINUE button, which I clicked and it was ejected...had to go back to iTunes and eject the iPod there also, but it did eject

  • HT1351 Whether or not I sync items on iTunes to my ipod, I cannot eject the ipod because a message keeps coming up and saying that my ipod cannot be ejected because it contains files that are being used by another application. How do I fix this?

    I just got an ipod classic 7th generation a couple days ago and I'm having a heck of a time with it. My latest problem is that with media on iTunes, I cannot eject the ipod because it says that it cannot be ejected because it contains files that are being used by another application. What application is this, and what do I do about it?

    Hi newipoduser,
    Here are some possible solutions:
    Do you use musicmatch jukebox on your computer? If you do, you have to go into task manager on windows and end process mim.exe. It interferes with disconnecting ext devices
    Empty your "trash/recycle bin."
    If that doesn't work, try quitting all your programs, especially music-type programs, basically things that look for mp3's etc.
    if that doesn't work, "log off" then "log on" and that should refresh/purge your OS system.
    Finally, you can restart your computer.
    Hope one of these helps!
    Cheers,
    GB

  • My iPhoto won't open. It says "Your photo library is either in use by another application or no longer readable." Please tell me I haven't lost all my pics?! I do not have them backed up. I have tried restarting my mac. Please Help!

    My iPhoto won't open. It says "Your photo library is either in use by another application or no longer readable." Please tell me I haven't lost all my pics?! I do not have them backed up. I have tried restarting my mac. Please Help!

    What haven't you backed them up? You should always have a back up of any important material on your Mac. Make one now:
    Most Simple Back Up
    Drag the iPhoto Library from your Pictures Folder to another Disk. This will make a copy on that disk.
    Slightly more complex:
    Use an app that will do incremental back ups. This is a very good way to work. The first time you run the back up the app will make a complete copy of the Library. Thereafter it will update the back up with the changes you have made. That makes subsequent back ups much faster. Many of these apps also have scheduling capabilities: So set it up and it will do the back up automatically. Examples of such apps: Chronosync or DejaVu . But are many others. Search on MacUpdate
    What version of iPhoto do you have?

  • Passing the values from one application to another application using mvc

    Hi sdn,
    Iam new to bsp.i created one application zappl1 in that i created one controller and one view.in that view i created 2 input fields.and also  created another application zappl2 in that also created one controller and one view. wai i want to enter in the inputfileds of first application view that values will be display in second application view.Please help out of this.

    Hi,
    I can see 2 ways of doing. Either you use parameters in the URL from the first application to the second, as any web application would do.
    Or, you can think of using the Web Application Server let :
    - the first application store the values
    - for the second application to retrieve
    Personnally, I would tend to suggest the first solution as it allows both applications to be replaced later on.
    Best regards,
    Guillaume

Maybe you are looking for

  • How to Delete errated Downloads on iPad from iTunes store

    I tried to download some podcast in the itunes store but they report an error and cannot be downloaded. They seem to block other downloads like films. How can I delete these non downloadable podcast from the list? Thanks for your answers Eric

  • How to retrieve damaged files

    I had recently deleted all songs synced with my iPod from my itunes library. Intending to add a song to the iPod, I connected it to my computer. The iPod started syncing and since there were no more songs in the itunes library except the one I intend

  • How to install the metadata cache invalidation tool

    Hi, I have  a problem in using JCO destinations for Adaptive RFC models. I went through the below pdf and they mentioned metadata cahce invalidation tool and it is not installed in the portal https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/lib

  • Samsung N150 Verizon mini + adding Virgin mobile broadband 3g USB

    I got the Verizon mini notebook 2 days ago and am having a heck of a time connecting my Virgin mobile broadband 3g USB adapter. I disabled the laptop network card and I followed Virgin's directions and still no internet access. I cannot get a hold of

  • Apple registration will not recognize serial number from 5s

    Tried to register 5s.  It will not recognized any aerial numbers.  Am I looking in wrong place?