Capture Windows system messages using RegisterWinMsgCallback()

Hello ,
I have programmed a socket server  to capture the socket message, this code phase using the Windows API "WSAAsyncSelect()" to register some specific messages, and when the client connect the server, it can trigger some events. the code phase as follows:
int main ()
    net_addrs.sin_family = AF_INET;
    net_addrs.sin_port = htons(CTRL_PORT_PAS);
    net_addrs.sin_addr.S_un.S_addr = inet_addr("192.168.0.101");               
    res = bind(sockt, (struct sockaddr *)&net_addrs, (int)sizeof(struct sockaddr));
    listen(sockt, NUM_THD);
    hwnd = (HWND)GetCVIWindowHandle();
    wmsg = RegisterWinMsgCallback(WindowsMsgProc, NULL, NULL, 0, &res, 1);/* Register windos call back*/
    res = WSAAsyncSelect (sockt, hwnd, wmsg, FD_READ|FD_ACCEPT|FD_CLOSE);
    DisplayPanel (dumyPanel);
    RunUserInterface ();
    closesocket(sockt);
    WSACleanup();
    DiscardPanel (dumyPanel);
 The callback function code :
void CVICALLBACK WindowsMsgProc (WinMsgWParam wParam, WinMsgLParam lParam, void *callbackData)
    if (wParam != sockt)
        MessagePopup("Winsock callback error", "Not for the socket");
        GenLog("quit");
        return ;
    switch (lParam)   
        case FD_READ:
            break;
        case FD_ACCEPT:
            MessagePopup("ooook", "have a connect request");
            break;
        case FD_CLOSE:
             GenLog("quit");
             break;
        case WM_DESTROY:
        case WM_QUIT:
        case WM_CLOSE:
             GenLog("quit");
            //QuitUserInterface(0);
            break;
The question is , if in the windows task manager to kill the process, Windows should send a WM_DESTORY or WM_QUIT message, but I find the message is never to capture by the callback function, because GenLog() never worked. Please give a support what is wrong in the above code. thanks.
David

David,
In order to catch an event like WM_QUIT, you would want to use installWinMsgCallback instead of registerWinMsgCallback. InstallWinMsgCallback will look for windows messages while registerWinMsgCallback will look for user defined messages. Having said that, installWinMsgCallback cannot be used to capture WM_QUIT or WM_DESTROY. To catch an event of your application closing under normal circumstances, you should use the EVENT_CLOSE in the panel callback. Terminating the process with the End Process function of the task manager will not send a WM_DESTROY or WM_QUIT that can be caught by your application. Terminating the process is not a normal exit condition for an application and typically is not expected to be handled.
National Instruments
Product Support Engineer

Similar Messages

  • Is there a way to get photos off of a thumb drive onto something that can be uploaded to the ipad. I am doing away with my windows systems and using the ipad exclusively?

    is there a way to get photos off of a thumb drive onto something that can be uploaded to the ipad. I am doing away with my windows systems and using the ipad exclusively?

    iPad Photo Recovery: How to Recover Deleted Photos
    http://www.iskysoft.com/iphone-data-recovery-mac/ipad-photo-recovery.html
    How to Restore Lost or Deleted Files from iPad
    http://www.iphone-ipad-recovery.com/recover-ipad-mini-files.html
    How to Recover Deleted Files from iPad
    http://www.kvisoft.com/tutorials/recover-deleted-files-from-ipad.html
    How to Recover Photos from iPad
    http://www.ipubsoft.com/idevice-tips/recover-deleted-photos-on-ipad-mini.html
    iSkysoft Free iPhone Data Recovery
    http://www.iskysoft.com/iphone-data-recovery/
    Recover iPhone/iPad/iPod touch lost data, Free.
    Free recover iPhone/iPad/iPod touch lost contacts, photos, videos, notes, call logs and more
    Recover data directly from iPhone or from iTunes backup
    Preview and recover lost iOS data with original quality
    Wondershare Dr.Fone for iOS
    http://www.wondershare.net/data-recovery/iphone-data-recovery.html?gclid=CJT7i9e 6gb4CFcvm7AodbUEAJQ
    Recover contacts, messages, photos, videos, notes, call history, calendars, voicemail, voice memos, reminders, bookmarks and other documents.
    iPad Data Recovery Software (PC & Mac)
    http://www.anysoftwaretools.com/ipad-data-recovery.html
    Jihosoft Mobile Recovery for iOS
    http://www.fonerecovery.com/iphone-data-recovery.html
     Cheers, Tom

  • Capture Windows WM_DEVICECHANGE message and respond it

    When a usb device being plugged in or off a port, the system can detect the message. Some solution is that using the "InstallWinMsgCallback ()" function to process the message, this way need that there must be a special cvi panel to receive the message. Due to my application is a Windows service, so I can not make a panel. I'd like to know is there any way to capture the message using the "RegisterWinMsgCallback()" function? If it will, how to do this? Thanks.
    David

    Hello ibalhashim,
    From your description, do you mean that after remapping the fb to ctrl, then only the button down and up are being sent?
    If it is, please share us how you have remapped the keys and please test if removing the remapping operations, the WM_INPUT message would restore. This would help narrow down this issue to see if it is caused by the remapping operations or the win32 app.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to manipulate Windows System Variables using Java

    Hi There,
    I want to manipulate Windows System variables (e.g. PATH, CLASSPATH) using Java program. Could anyone please let me know how it can be done in Java.
    Regards,
    Rakesh Nagar

    This is not just a Java question. It has never been possible in any Windows program to permanently change the value of an environment variable. You can only change it temporarily, and when the process that changed it ends, so does the change to the environment variable. This has been true since environment variables were added to DOS in about 1983.

  • Is it possible to have dual screens for two Pages documents or APPs? In a Windows system you use control left/right

    When trying to work on multiple documents or apps, I like to have a dual screen where by i can see two things at once. This worked when I used  a Window's system by pressing Control left/right and i could use both at the same time.
    Is this posible to do using a Mac Air?

    both VMWare Fusion & Parallels Desktop for Mac can use a bootcamp Windows installation as VM exactly like you want.

  • Unique id For System Message

    Dear all,
       Any one can please tell me the unique id for System Message.  Also i want to know the unique id for 'yes' and 'No' in System Message. Its very urgent
    Thanks in advance
    with Regards
    G.shankar

    System message has formtype = 0. The Yes and No button has no ids for sap, but when you want to press one of this button, use sendkeys as SBO_Application.SendKeys("") or tab for No (default is Yes).
    For accesing to correct system message, use some global variable and there before showing system msgbox set some value and compare it after showing.
    hope it helps

  • Unable to create File System Repository using Network Path

    Hi All,
    I am trying to create a File System Repository.
    I created a networkpath and windows system and used the same while creating File Repository according to the steps in help.
    With out using Networkpath(i.e.,If I use IP address,I am able to create File System Repository).
    But with the network path,it throws the following error as seen in Component Monitor.
    <b>Startup Error:    The localroot does not exist: C:\usr\sap\IGTE\j2ee\j2ee_00\cluster\server\NWP_001
    My network path is NWP_001
    </b>
    Did any one face this problem?
    Any help please........
    Rgds,
    Santhosh

    Hi,
    I am getting the same error even if I replace(\) by slashes(/).
    I tried on EP6SP12 as well as EP6SP2 and got the same error on both.
    The repository is searching for a folder named with
    n/w path on the portal server itself(i.e, it is searching in the following folder
    <b>C:\usr\sap\IGTE\j2ee\j2ee_00\cluster\server\NWP_001
    My network path is NWP_001</b>),instead of searching on the remote system.
    Can any one help me in solving the problem
    Thanks in Advance.
    Rgds,
    Santhosh

  • How to get window system user?

    Hi,
    How to get window system user use PL/SQL(form develope6i)?

    If you don't use Oracle database then you will have to do one of two things:
    (1) Now I'm back in the office I can check D2KWUTIL. The version I have comes with Forms6.0, so it is somewhat out of date, but it has a method called WIN_API_ENVIRONMENT.Get_Windows_Username - which works for NT/95 only, although I'm sure a later version will support more recent OS.
    (2) If that's no good then you'll have to use whatever facilities your database offers: I only know Oracle.
    I also repeat my suggestion that you try the Forms forum for additional help. This is the Database forum and so is focused on serverside Oracle PL/SQL. For your needs the Developer Suite forums are better.
    Cheers, APC

  • MDT 2012 Update 1 - Attempting to capture Windows Thin PC but it keeps looping after reboot.

    I have been trying to capture a master image of Windows Thin PC we have prepared using MDT 2012 Update 1 but to no avail. When attempting the capture process using LiteTouch.vbs it syspreps and then reboots as it normally would and then it simply keeps rebooting
    over and over in a loop.
    I am unsure of how to bypass this and correctly capture Windows Thin PC using MDT 2012 Update 1. If anyone has any advice or feedback they can offer I would greatly appreciate it. Thank you.

    Logs suggest that the script is most likely crashing early on.
    I suspect that the reason for this is that the deployment share was *updated* from a previous version of MDT, and some files are out of date.
    Can you update the share (full update, regenerate from scratch?)
    Otherwise we may need to run Litetouch.wsf manually from within WinPE:
    When WinPE Boots and you have a mouse, press F8.
    Run TaskMgr.exe and verify that wscript.exe is no longer running (wait 2 minutes).
    Then run the following command:
    "cscript.exe x:\deploy\scripts\litetouch.wsf /debug:true /debugcapture"
    That should run the litetouch.wsf script and it should display any errors if found.
    Keith Garner - keithga.wordpress.com

  • Trying to Create a Catalog file using WSIM (Windows System Image Manager)

    I have been looking online for a solution to htis problem for days and come up with nothing so any help would be amazingly helpful.
    I have created a Windows 8.1 image which I would like to role out to all users within my company but when trying to create a catalog file I am getting an erorr message saying "Windows SIM was unable to generate a catalog."  It says "Mounting
    Windows Image file......This might take a few minutes" and then fails after 6-7mins.
    When opening the log file I get this:
    10:00 : Cannot obtain read/write access for F:\sources\install.wim.
    In order to generate a catalog file, you must have read/write access to the Windows image file and its containing folder.
    10:13 :
    10:13 : Windows SIM was unable to generate a catalog. For troubleshooting assistance, see the topic: 'Windows System Image Manager Technical Reference' in the Windows OPK or Windows AIK User's Guide.
    10:13 :
    10:13 : System.InvalidOperationException: The operation failed to complete. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: String reference not set to
    an instance of a String.
    Parameter name: source
       at System.Globalization.CompareInfo.IsPrefix(String source, String prefix, CompareOptions options)
       at ?A0xfe36268f.ConvertToNtPath(String path)
       at Microsoft.ComponentStudio.ComponentPlatformInterface.CbsSessionAdaptor..ctor(String bootDrive, String imageWinDir, String servicingPath)
       at Microsoft.ComponentStudio.ComponentPlatformInterface.OfflineImageImpl.InitializePackages()
       at Microsoft.ComponentStudio.ComponentPlatformInterface.OfflineImageImpl..ctor(OfflineImageInfo imageInfo)
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
       at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
       at Microsoft.ComponentStudio.ComponentPlatformInterface.Cpi.PlatformImplementation.CreateOfflineImageInstance(OfflineImageInfo imageInfo)
       --- End of inner exception stack trace ---
    The one image that did work (LiteTouchPE_x64.wim) was from the OS I imported to Microsoft Workbench but the components are different to any that I have seen online when looking on how to do this.
    I have made sure that the architecture is x64 and tried from ISO files I have on the system already but get the same error.
    This is the first project I have been involved in and only ever done IT support before this.
    Thanks for your help in advance.

    Yes I am trying to capture a reference image that I have created on another machine and then reploy this through MDT. I am trying to open the Unattend.xml file because the "Capture and Sysprep" fails on the reference machine when trying to run
    Sysprep. When I try to open the Unattend.xml file in MDT I get the error below:
    Performing operation "generate" on Target "Catalog".
    Starting: "C:\Program Files\Microsoft Deployment Toolkit\Bin\Microsoft.BDD.Catalog35.exe" "D:\Windows8.1 TEST3\Operating Systems\Windows8.1 x64\Sources\install.wim" 1 > "C:\Users\*****\AppData\Local\Temp\3\Microsoft.BDD.Catalog.log"
    2>&1
    No existing catalog file found.
    PROGRESS: 0: Starting.
    PROGRESS: 0: Creating mount folder: C:\Users\*****\AppData\Local\Temp\3\IMGMGR_install_Windows 8.1 Enterprise_njegg3ph.con.
    PROGRESS: 5: Creating temp folder: C:\Users\*****\AppData\Local\Temp\3\IMGMGR_install_temp_qj0x3ga5.obv.
    PROGRESS: 10: Mounting Windows image: D:\Windows8.1 TEST3\Operating Systems\Windows8.1 x64\Sources\install.wim. This might take a few minutes.
    ERROR: Unable to generate catalog on D:\Windows8.1 TEST3\Operating Systems\Windows8.1 x64\Sources\install.wim: System.ComponentModel.Win32Exception: The process cannot access the file because it is being used by another process
       at Microsoft.ComponentStudio.ComponentPlatformInterface.WimImageInfo.PreCreateCatalog()
       at Microsoft.ComponentStudio.ComponentPlatformInterface.OfflineImageInfo.CreateCatalog()
       at Microsoft.BDD.Catalog.Program.DoCatalog()
    Non-zero return code from catalog utility, rc = 2002

  • Sun Java System Messaging Server for Windows xp

    Hi,
    We are in a project that uses Sun Java System Messaging Server on Windows xp platform. But we didn't find the software download.
    Please tell how can i have that software?

    Messaging Server 6.x has never been released for Windows. A windows release is projected for the future, but that may be months away.
    Messaing 6.1 is available NOW for Redhat Linux AS2.1 u2 and Solaris X86. I have installed both, and find them both good.

  • HP Deskjet 3050A J611 series - error message -Bad image windows\system 32\d3d 10 warp.dll

    I use the HP Deskjet 3050A J611 series printer with my laptop and a desktop PC.  It works fine with the laptop but when I installed the software onto the desktop the window error message Bad Image Windows\ System 32\d3d 10 warp.dll kept popping up every few minutesd.  By a process of ilimination I discovered that it was the Photo Creations that was causing the problems, when I removed it all was good and I was able to use the printer.  The only problems is that I now cannot print photos from my pc.  I have windows 7.
    Can anyone help please?

    Hi Chris.
    That error message comes from Direct3D, which is part of the DirectX software in Windows. It appears that part of the DirectX environment on your computer is corrupt. Microsoft provides a diagnostic tool that should help you sort this out. Please see http://windows.microsoft.com/en-us/windows-vista/run-directx-diagnostic-tool
    If that does not solve the issue, you may want to reinstall the device driver for your graphics adapter.
    When all's running smoothly, you can reinstall HP Photo Creations to print again. Our customer support team would be happy to help with the reinstallation. You can reach them at www.hp.com/global/us/en/consumer/digital_photography/free/software/support-form.html
    Hope this helps,
    RocketLife
    RocketLife, developer of HP Photo Creations
    » Visit the HP Photo Creations Facebook page — news, tips, and inspiration
    » See the HP Photo Creations video tours — cool tips in under 2 minutes
    » Contact Customer Support — get answers from the experts

  • I want to capture system message during data upload.

    Hello,
    I want to capture system message during data upload.
    How should I do this?
    suppose during call transaction system shows message:-
    " Info record for vendor 102925 and material DYND80000 does not exist"
    then How can I get that message?

    Hi Megha,
    CALL TRANSACTION tcode USING i_bdcdata
                              MODE lws_mode
                            UPDATE lws_update
                          MESSAGES INTO <b>i_messages.</b>
      CLEAR wa_error.
      IF sy-subrc NE 0.
        cnt_failed = cnt_failed + 1.
        wa_error-status = c_fail.
        LOOP AT i_messages . "WHERE msgtyp EQ 'E' OR msgtyp = 'A'.
          flg_fail = c_x.
    *---Calling FM to get for Error Message Text
          <b>CALL FUNCTION 'MESSAGE_PREPARE'  </b>                     "#EC *
            EXPORTING
              language               = 'E'
              msg_id                 = i_messages-msgid
              msg_no                 = i_messages-msgnr
            IMPORTING
              msg_text               = lws_text
            EXCEPTIONS
            function_not_completed = 1      " Invalid Date Error Description
              message_not_found      = 2
              OTHERS                 = 3.
    <b>Reward points if this helps.
    Manish</b>

  • Xtra: trouble capturing windows message

    We are trying to use the RegisterNotificationClient in an
    Xtra to capture couple windows messages from an external DLL.
    I basically have two questions:
    1. Is using RegisterNotificationClient the right way to
    capture windows messages from an xtra?
    2. If the answer to 1 is yes, then I have another question as
    when we try to set up the parameters for the
    RegisterNotificationClient I have a misstmatch in the nid, second
    parameter to specify the id of the message to be captured. I have
    for windows an integer constant, but the nid param expects a GUID
    number ...
    Thanks!

    Thanks for the reply Tom. (BTW I'm not the original poster.)
    You are correct- It is a USB drive formatted FAT 32 . After my original post, I erased the drive and started over with a clean slate. This was successful for tape one (about 60 minutes). About twenty minutes into tape two though, it was deja vu all over again. FC froze, I force quit, and lost all of what I had captured from tape one in the process. I unsuccessfully tried to recapture tape one. Same problem again.
    Although this is the first time I've tried to capture through FC onto an external drive, I've got three other USB drives full of video I've captured from VHS with the same computer through a DV encoder. When you say USB is not supported by Apple for video applications, does that mean video editing applications? As for complete information, apologies but I'm not exactly sure what other info. you mean. Please let me know. Thanks again. I appreciate the time.

  • Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system. I have a wndiws 7 system and use a Intel core processor. I have restarted several times and still ge this

    Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system. I have a wndows 7 system and use a Intel core processor. I have restarted several times and still ge this error. I have also tried to reinstall firefox and get the same error
    == This happened ==
    Every time Firefox opened
    == today ==
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDS; InfoPath.2; .NET4.0C; AskTbUT2V5/5.8.0.12304)

    <u>'''Kill Application'''</u>
    In Task Manager, does firefox.exe show in the <u>'''Processes'''</u> tab?
    See: [http://kb.mozillazine.org/Kill_application Kill Application]
    '''<u>Causes and solutions for Firefox hanging at exit:</u>'''
    [[Firefox hangs]]
    [http://kb.mozillazine.org/Firefox_hangs#Hang_at_exit Firefox hangs at exit]
    [[Firefox is already running but is not responding]]
    <u>'''Safe Mode'''</u>
    You may need to use '''[[Safe Mode]]''' (click on "Safe Mode" and read) to localize the problem. Firefox Safe Mode is a diagnostic mode that disables Extensions and some other features of Firefox. If you are using a theme, switch to the DEFAULT theme: Tools > Add-ons > Themes <u>'''before'''</u> starting Safe Mode. When entering Safe Mode, do not check any items on the entry window, just click "Continue in Safe Mode". Test to see if the problem you are experiencing is corrected.
    See:
    '''[[Troubleshooting extensions and themes]]'''
    '''[[Troubleshooting plugins]]'''
    '''[[Basic Troubleshooting]]'''
    If the problem does not occur in Safe-mode then disable all of your Extensions and Plug-ins and then try to find which is causing it by enabling <u>'''one at a time'''</u> until the problem reappears. <u>'''You MUST close and restart Firefox after EACH change'''</u> via File > Restart Firefox (on Mac: Firefox > Quit). You can use "Disable all add-ons" on the Safe mode start window.

Maybe you are looking for