How to determine the correct moment when Word has finished to write to a docx file

Hello,
we are currently passing a document to Microsoft Word for editing and want to take back the changed/saved document when editing is finished. But it seems we have issues to determine the correct moment when Word has for sure saved all changes and
it is save to take back the file.
To pass the document to Word we use ShellExecuteEx with the file name. Then we use the Running Objects Table and a File Moniker to wait for the file to be closed.
Sample code:
HRESULT hRes = S_OK; 
CComPtr<IMoniker> spIMoniker; 
CComPtr<IRunningObjectTable> pRT; 
hRes = GetRunningObjectTable(0, &pRT); 
if (FAILED(hRes))
   TWTHROW1(TWERR_ANY_ERROR, hRes, _T("GetRunningObjectTable failed."));
hRes = ::CreateFileMoniker(m_strTempFilename.AllocSysString(), &spIMoniker);
if (FAILED(hRes))
   TWTHROW1(TWERR_ANY_ERROR, hRes, _T("CreateFileMoniker failed."));
while (S_OK == pRT->IsRunning(spIMoniker) && !m_bShutdown)
   Sleep(500);
   continue;
So we wait for the file to be removed from the Running Objects Table and additionally wait until we can get exclusive access to the file before we take over the changed file. But still it seems to happen that we take the file too early. Hence it
seems the file is removed from the Running Objects Table by Microsoft Word before saving the file has completed.
Is this behaviour of Microsoft Word by design? What is the best practice to identify the moment in time when writing the file has completed. Some other applications like Winzip seem to do the same thing.
Thanks,
Wolfgang

Hi WolfGang,
Thanks for posting in MSDN forum.
Based on the description, you are developing application with Windows API. I would like to move it to
General Windows Desktop Development Issues forum.
The reason why we recommend posting appropriately is you will get the mostqualified pool of respondents, and other partners who read the forums regularly can either share their knowledge
or learn from your interaction with us.
Thanks for your understanding.
Regards & Fei
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.

Similar Messages

  • Insufficient rights - How to determine the correct rights?

    All,
    Does anyone know how to determine the correct rights if you get the error message "Insufficient rights for operation"?
    In SAP backend systems you can start transaction SU53 to check your "missing" authorizations, but is something like that also possible in MDM?
    I also don't see any detailed information in the logs or reports.
    If anyone has an good suggestion, please let me know, since I don't want to do "trail and error" to know what Functions to set to Execute and what Tables/Fields to set to Read/Write (because there are quite some combinations to check).
    p.s. I've read the complete reference guide of the MDM console and sometimes it's really obvious what Functions and Tables/Fields you have to set, but for instance when I want to give authorization to maintain Relationships in the DataManager and have set the Main table and all Relationships to Read/Write and have set all Records and DataManager functions to Execute it still doesn't allow me to maintain the relationships on the records! I only get the message "insufficient rights" and it's unclear what rights are missing!
    Regards,
    Marcel

    hi Marcel,
    I doubt if we have anything in MDM to show you what authorizations are missing.However,you can check the following :
    1. What activity are you trying to perform when you get this error.
    2. Check if authorization are given in the role for that actitvity.
    3. Check how many roles are allocated to user and  Is authorization given in all roles if more than 1 role is assigned to that user?
    Please let us know answer of the queries...
    Regards,
    Vineet

  • Call RFC for Lookup from BPM. how to determin the correct target system

    Hi
    I have a scenario where i am sending a sync call to SAP R/3 to fetch some sata using the BPM.
    The issue is I can have multiple SAP systems so to determin the SAP system for the correct lookup is necessary.
    in the rec determination step of Config I can configure multiple receivers but this isthrowing an error saying the multiple receivers cannot be determined for sync step.
    Any idea why is such an error occuring
    Regards
    Nikhil

    Nikhil,
    Multiple Receivers cannot be configured for a Synchronous Interfaces. reason is that when you are sending the request message to the target systems, XI will recieve multiple responses for one request and this is aginst the concept of Synch Message Processing.
    You will have to have an option of determining the receivers inside your BPM and using separate Send Steps for each of these.
    Regards
    Bhavesh

  • How to determine the positioning order when using tab key?

    Hallo,
    in my jspx-page i want to define the order which the cursor jumps when the user is using the tab key.
    i don't know how to? in html there i can use tabindex. which way i must go?
    Any help is appreciated.

    I found that tabindex is not applicable. But i think it is an important point for better handling.
    Is there no easy way to do it?

  • How to determine the correct K value within a grayscale image, quick?

    I frequently need to know specific grayscale values from grayscale images for further use in other applications.
    Problem: When opening the Color Picker the picked grayscale value is separated in CMYK. But I need it in K only.
    I actually have a workaround by comparing the RGB values while zeroing the CMY values and altering the K unless I found the correct value.
    Anyone knows an easier way to get a correct grayscale value in K (out of CMYK), quick?
    And btw. the K from the info panel does not show the correct value I need to know.

    Hi ,
    Please configure the steps in SPRO ..
    Product Costing Controlling -> Cost Object Controlling -> Product Cost by Order -> Period end closing -> Work in Progress
    Configure all the steps , it needs to be ideally done by the FICO consultant , please revert back or search SDN regarding issues in configurations
    Regards
    Sarada

  • How to determine the position of a word in a line

    hello
    i want to know the position of a word on which caret is at present or the position of the selected word in a line displayed in the JEditorPane. for example, if this line is displayed
    Java is an Object oriented Language.
    if i select "an" then its position i get must be 3. Select Java postion must be 1 and so on.
    thanx in advance
    -Ashish

    Hi,
    you can use a StringTokenizer to break the result of getText() of JEditorPane into words and simply count them until the caret postion is passed. Add a method like this in your JEditorPane subclass:
    public int whichWord() {
    String delimiters = "\n\t "; // checking for new line, tab and space as word breaks
    StringTokenizer st = new StringTokenizer(getText(),delimiters,true);
    int pos = getCaretPosition();
    int count = 0;
    int len = 0;
    while ((len<pos)&st.hasMoreTokens())
    String s = st.nextToken();
    len += s.length();
    if (delimiters.indexOf(s)==-1) { count++; }
    return count;
    }Hope this helps - not tested, coded on the fly into this textbox.
    greetings Marsian

  • How to get the correct result when I access mxml file in address bar in IE?

    os: windows xp
    web server: tomcat 5.5
    lcds version: 2.6
    One week ago, I installed lcds2.5 in my coumputer. At that time, when I type address http://localhost/lcds/test.mxml in address bar of Internet Explorer, the web server return the result of test.swf.
    I upgraded lcds from 2.5 to 2.6 this morning, and then when I type http://localhost/lcds/test.mxml in IE address bar again, the server return the source code of text.mxml in the web page, which is not I expected.
    Why the web server don't handle the *.mxml file like in lcds2.5? How can I resolve this problem?

    Hi,
    Webtier Compiler is which is no longer part of LCDS starting with the version 2.6. However you can install it if you want, read the instructions from this link http://labs.adobe.com/wiki/index.php/LiveCycle_Data_Services:Setting_up_an_SDK,_Compilers ,_and_Flex_Builder

  • How to determine the download media required from my License key?

    Hi
    After recently rebuilding a dead PC,  The user has advised me she used to use Illustrator.
    Unfortunately the user does not have the install media available.
    Support advised my license key is a volume license for Design Standard.
    I have downloaded Design Standard (Universal) but the Licence key is not accepted.
    Can anyone advise how to determine the correct download based on my License key?
    Many thanks

    Some times you may need to sign in to volume licensing account and download
    refer
    Adobe Licensing Website | Serial numbers | Orders | Accounts

  • How can I get my clock to remain on the correct time when starting bootcamp and windows XP? wireless option is not available.

    How can I get my clock to remain on the correct time when starting bootcamp and windows XP? wireless option is not available.

    Have a look at solutions in here https://discussions.apple.com/message/10689317#10689317
    Regards
    Stefan

  • How to determine the policy, when it is applied?

    Hi!
    Perform Group Policy.
    When do I need to reboot when
    to logoff, and when the policy is executed after
    without further action?
    How to determine the policy, when it is applied?

    Hi,
    Group policy settings that affect computer settings section apply at reboot and refrresh every 90 min (default refresh interval for computers). Group policy settings that affect user settings section apply at user logon to the domain.
    You can use RSOP.MSC or command-line gpresult /? to find out what/which GPO settings have been applied to the computer/user belonging to a domain.
    More information can be found below:
    http://msdn.microsoft.com/en-us/library/aa373481(v=vs.85).aspx
    http://technet.microsoft.com/en-us/library/cc940895.aspx
    Hope this help.
    Regards,
    Calin

  • How do I determine the correct sales org for the employee?

    Hi
    The requirement here is to determine the correct sales org for the employee logged in when creating an activity (a customer visit). We know that all employees will belong to one sales org.
    On this basis, in the organisational data determination I have maintained the organisational data profile Z0001 with the Organisational Model Determination Rule: 10000162 (employees for responsible org. unit). I have left the Responsibilities Determination Rule empty. I am not sure if both have to be filled. Can anyone explain the difference between the two?
    I have checked the sales organisation and distribution channel. This is for the sales scenario.
    I simulated this rule in Maintain Determination Rules. I entered the Sales Org and no agents (employees) were found.
    The org data profile Z0001 has been assigned to the transaction.
    The Object Permitted in Determination has been checked for the sales scenario in the Organisational Model.
    Regards
    Declan

    Hi PePe
    I made the change and it worked as I wanted it. Thanks a lot.
    You say there's no need to Maintain the Responsibilities Rule. Can I ask what this section does and why it can be one or the other?
    Regards
    Declan

  • I want to back up my 4S but I don't get the correct screen when I plug it into my Mac - Just iPhotos and iTunes (songs) pop up. How do I get to the screen where I can back up and restore?

    I want to back up my 4S but I don't get the correct screen when I plug it into my Mac - Just iPhotos and iTunes (songs) pop up. How do I get to the screen where I can back up and restore?

    Hi Spookola,
    I don't know how that could have happened. Go through the folders for the rolls and separate the 2005 rolls from the 2006 rolls, then import the 2006 rolls.

  • How can determine the duration of an audio file

    Hi,
    i'm making speech recognition project using java. i can capture sound by michrophone and playback it. the type of the sound is .wav.
    my question is how to determine the recording duration (for example: determine the duration for 0.25 second) because i must recorded syllable,the assumtion is needed less than 0.5 second to say a word. and then.. can this wav file be changed into... binary or integer ?
    thanks for your help

    FYI I'm newbie in Java,
    Yes, I want to limit the audio file lengths to a certain value. What should I do?
    I have read wav file using an AudioInputStream, for audio format I'm using sampleRate = 8000.0F and sampleSizeInBits = 8. My friend said if I used 8 bit for sampleSizeInBit (resolution in amplitude) the binary file should be -128 till 127 in range according to the bit. I try this code and the result is binary file which is zero, positive, and negative.
    the code
    try{
    audioInputStream.read(audioBytes);
    for (int i=0; i<audioBytes.length;i++){
    System.out.println(audioBytes);
    catch(IOException ioe){
    System.out.println("Error"+ioe);
    I'm not sure that the code is right, but it works. Should I change the audioBytes into integer before? I try this code but it doesn't work.
    int a = new int[audioBytes.length];
    for (int i=0;i<audioBytes.length;i++){
    a[i] = new Byte(audioBytes[i]).intValue();
    this binary file has been printed in console (I’m using texpad). So, how I can write that to file.txt? I'm using FileoutputStream but it doesn't work correctly. Here is the code
    FileOutputStream fos = new FileOutputStream(strFilePath);
    {audioInputStream.read(audioBytes);
    fos.write(audioBytes);
    catch (IOException ioe){
    System.out.println("Error"+ioe);
    When I open file .txt is read as character like this üüüüüüüüüüüüûüüüûüûûû ||||||| ||||||| ||||||||||||||||||||||||||||| &#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746; (like using alt plus number)
    Edited by: anasfr on Mar 19, 2009 9:02 AM

  • How to determine the ROWNUM in a Master Detail Form

    Hello,
    I am working in a Master Detail Form with Orders and Order Items Information; and I created a process that allows the users to select a Product ID on a tabular form, and the next column is populated automatically with the Product Description.
    To achieve that, I followed some instructions by Denes Kubicek (http://apex.oracle.com/pls/otn/f?p=31517:241), but my case is slightly different:
    <ul>I am using a wizard-created tabular form, instead of a manual tabular form; and </ul>
    <ul>Instead of using another page as a Popup to pass the parameter of the ROWNUM, I am using a plug-in called “Tabular Form Super LOV” which is a modified version of the SkillBuilders’ Super LOV that works on Tabular Forms. </ul>
    The Product ID is returned in the correct row by the plug-in; but in the case of the Product Description, it is always returned into the first row; and my problem is that I don't know how to determine the row where the user clicked to call the plug-in.
    I set up an example in apex.oracle.com in case someone would like to look at it:
    Workspace: ediazjorge
    Username: test
    Password: test
    App Name: Sample App
    App Number: 1550
    BTW, I am using Apex 4.1.1.00.23 and Oracle DB 10.3.2.
    Thanks in advance,
    Erick

    Hello VC,
    Thank you for your time and help.
    Unfortunately, it is still not working properly:
    1. When the Popup LOV opens, the first row of the tabular form is 0, the second row is 1, and so on. How can I assign the values starting with 1 and in the format *0001* ? (I am still a novice on Apex and new to JavaScript :-), sorry about that).
    --2. Also, when I close the Popup LOV, the value of P1_ROWNUM is ‘undefined’ again so I'm not sure if the Product Name column will be populated.--
    3. And finally, you are using the jQuery Selector uPopupLOVIcon, which is an attribute of the Cloudy Theme. In my real application (Apex 4.1.1.00.26), my element looks like: *<img src="/i/lov_16x16.gif" width="16" height="16" alt="Popup Lov" alt="List" style="vertical-align:middle;" align="middle" />*. What do you recommend me to use as a jQuery Selector?
    Again, I really appreciate your help and time. I think you solved the most difficult part.
    Thank you so much,
    Erick
    Update: I just found out that the problem with my comment 2 is because I didn’t delete the previous dynamic action that set the value to P1_ROWNUM.
    Edited by: ediazjorge on Sep 18, 2012 11:20 AM

  • How to determine the scratch disc size?

    hello,
    once i was reading an adobe pdf "How to get better performance in photoshop cs5" - that was in 2009 or 2010, and may be outdated, but there was a calculation method
    to determine the size of a scratch disc. (similar calculation see below, if i can remember right)
    i am asking myself, how can i determine the correct size of an external SSD-scratch disc, only used by photoshop (completely empty):
    should i buy a 128GB or 256GB or 512GB SSD which is only reserved for photoshop?
    basic question 1 : i guess i should avoid to set the internal SSD as photoshop scratch disc, as it slows down everything?
    basic question 2 : in sense of maximum performance: better buy an external USB3.0 or thunderbolt SSD? will photoshop really use the extra thunderbolt speed when swapping data?
    secondary question:
    can i calculate the size regarding my daily working habits?
    i am mainly working like this:
    - with my imac 27" late 2013 with 32GB RAM and 256 GB internal pci-e SSD (800 MB/sec), which will stay always half empty for performance reasons.
    - OSX 10.8 mountain lion and 10.9 mavericks soon
    - photoshop cs5, cs6 and cc (always without extended)
    - 8bit and 16bit mode
    - only RGB
    - with latest phocus/Hasselblad and canon RAW Files which produce a basic .psb document at ...
    - 10.000 x 7000 px at 300dpi
    - with average 10 - 40 main image layers and 20-50 adjustement layers (try to reduce that in 16bit)
    - .psb file is 2-20 GB big (file in finder)
    - 16bit file compression is off, when saving .psb files (faster handling)
    -  set photoshop to 70% ram usage (from 32GB RAM)
    i wonder how to calculate ?
    for example:
    10.000 x 7000 px at 300dpi needs for one image layer at 16bit: 2GB RAM in photoshop cs6 or cc (just as a number), this may be wrong
    so lets take 2GB RAM and multiply with 10 image layers in my .psb file (16bit) = 20 GB RAM, and multiply with 20 adjustment layers (guess they need less ram, for one lets say 500MB) = 20GB + 10GB = this 16bit .psb layer file would need 30GB RAM, so when i have 32GB in my imac, i set cs6 or cc to 70% ram usage, it misses at least round 8-10GB RAM > can i guess that photoshop would swap these 8GB onto my scratch disc? or do i miss something important in my thinking?
    tricky thinking
    thanks for help

    station_two wrote:
    The rule of thumb I follow says to figure on 50 to 100 times the size of your largest file ever multiplied by the number of files you have open.  I have seen the scratch file exceed 300 GB once, an admittedly rare occurrence, but it often exceeds 200 GB when stitching large panoramas and the like.
    As an example—and stressing that I'm aware that others have even more scratch space than I do—I keep two dedicated, physically separate hard drives as my primary and secondary Photoshop scratch disks and a lot of GB free on my boot drive for the OS.  I also have 16 GB of RAM installed.
    Additionally, if you only have a single HD, i.e. your boot drive, you'd need it to be large enough to accommodate both the swap files of the OS as well as Photoshop's scratch.
    - i dont use HDD anymore only SSDs, both internal and external
    - i set history state to only 5 or 6, to improve performance
    - i set cache size to 4 and tiles to "big and flat" with 1028kb (there is no "big and much layers" option)
    - is this still the rule of thumb? i read it in 2009 , too, guess it was outdated, as cs6 and cc have improved codes in terms of performance?
    - if you say "50 to 100 times the size of your largest file ever multiplied by the number of files you have open.":
    i will not open more than one document at same time to prevent performance lags, so lets calc like: dokument size in finder (you mean in finder or doc. size shown in photoshop?) = e.g. 5GB x 100 = 500GB, so my external scratch disc SSD, i would buy now, should be at least 500GB, USB 3.0 or thunderbolt ... maybe better thunderbolt, yes? with usb 3.0 i could gain 300MB/sec if thats enough for photoshop?
    thanks

Maybe you are looking for