wrdDoc.SaveAs(SaveToFile); not working in windows 8 - delphi

I have developed an app for computers a while back, that generates a word document and saves it automatically under a name provided by the software.
The application has worked perfectly in windows xp and windows 7. But now it needed to be moved to a windows 8.1 computer and since the generating works perfectly. But the save command wrdDoc.SaveAs(SaveToFile); does not work.
Basically what happens, is on that command's execution a save dialog appears and you can save the document yourself. After you click save. You get an error command failed with no further details.
Is there anything that has changed since windows 7 that prevents this code from executing properly?
The old computer used the following:
windows 7
office 2007/2010/2013(all were used at some point in time)
New computer:
windows 8.1
office 2010
UPDATE:
it is also worth noting, the dialog does not show any of the word documents in the folder if i browse there... Can this be a hint to the problem?
Resolved
I managed to find the problem. It's a brand new laptop, and Acer had a bunch of crap installed that sync's with office and explore. Once i uninstalled that the software returned to working normally...
Thank you guys anyway so much :)

It depends on your word version. Only 2007 has a "Saveas" method for the document object (https://msdn.microsoft.com/en-us/library/bb221597%28v=office.12%29.aspx). The later versions (2010 and 2013) only have a "Saveas2" Method (https://msdn.microsoft.com/en-us/library/ff836084.aspx)

Related

Delphi Rio after patching not starting

I just did a complete system rebuild (format C drive and go from there)... Win 10 Pro 64 bit. I reinstalled Delphi Rio, the INITIAL release (6.7GB).... Delphi started up fine. I had previously downloaded Delphi Rio Patch 2, (7.3GB), so I unzipped it, and ran setup. It automatically chose the middle option (Modify), so I left it at that... and installed. It appeared to run fine. After completion, I noticed that it had removed the Delphi icon I created on my desktop, and that the links in my start menu for Delphi no longer work... I did not investigate a whole lot, as I had a patch 3 (7.9GB) to install as well. I unzipped, ran setup, and again Modify was the default option, so I ran with that... no errors. When completed, I tried to run Delphi. I have what I think is the appropriate directory structure (C:\Program Files (x86)\Embarcadero\Studio\20.0\bin) with 298 files in the bin directory, however bds.exe is NOT one of the files. Any idea what is going on?
The only possibility I can think of is that I have let my subscription expire.... and I am not entitled to the patches, yet the Embarcadero support system let me download them. Could this be the explanation?
Updating a certain Delphi version is usually done like this:
Download new ISO file or web installer
Uninstall the Delphi version you want to update and keep the registry settings (you are asked about this during the process)
Run setup from downloaded ISO or web installer
Your approach of installing the newer version on top of the older one is clearly the wrong way.
This is also explained in the install instructions (readme file) that comes with every ISO or web installer.

Delphi 2006-2010 error: "Cannot create file C:\Users\Admin\AppData\Local\Temp\EditorLineEnds.ttr"

I am getting an error after installing Delphi 2007 (Edit: This problem occurs in all Delphi versions from 2006 to 2010) that I can not figure out and have never seen before. After restarting I can launch the program without any problems, but if I were to close out of the program and start again it will give me the following error:
"Cannot create file C:\Users\Admin\AppData\Local\Temp\EditorLineEnds.ttr". The process cannont access the file because it is being use by another process."
"System" has a handle on this file that cannot be cleared unless I reboot. I can also correct the problem by renaming the file before I launch the program.
I have tried reinstalling the program with no luck.
Version installed: CodeGear™ Delphi® 2007 for Win32® R2 Version 11.0.2902.10471.
Operation System: Windows 7 Pro 64bit
Update 08/14 13:35 EDT
Tried the following solutions, but still having the same file lock issue:
Renamed Temp Directory to a directory I know had full security rights. Files would be created in this directory when launching Delphi, but EditorLineEnds.ttr would still get locked by SYSTEM and prevent me from relaunching.
Uninstalled the following security updates KB2982791 and KB2976897, but this did not solve the problem. I have suppressed windows updates for now and will try uninstalling all security patches for 8/13.
Uninstalled Delphi completely and re-installed. Problem still occurs after re-installing everything.
I will try reinstalling Windows from scratch and install Delphi before Windows
updates to see if updates are truly the cause. My workaround for now is just renaming EditorLineEnds.ttr before launch Delphi.
There are three solutions to this that I am aware of:
Try uninstalling the Windows security update KB2982791 which was already mentioned by Francisco Caffagni. This solved the issue for me (Windows 8.1 + Delphi 2007) but it might not be such a good idea to uninstall a Windows security update.
Rename the file every time you start Delphi. See below for a simple program that does it for you.
Use Andreas Hausladen's IdeFixpack (Delphi 2007 version, beware that version 4.4 does not work under Windows 8, version 4.3 seems to work), (for later Delphi versions) Note that the editor option Show Lineends will use a different character if you use this fix because the IDE won't load the EditorLineEnds.ttr font any more. (Solution 1 and 2 don't have this drawback, but who uses that option anyway?)
Note: Microsoft withdrew this fix a few days later and issued a new one KB2984615 on 2014-08-27. Unfortunately this did not fix the issue for me. Maybe uninstalling KB2982791 first and then installing KB2984615 might work, but I haven't tried it.
I wrote a simple program, that solves the issue for me:
It uses FindFirstChangeNotification / FindNextChangeNotification and checks whether that file exists and if yes, moves it to a unique subdirectory in %temp%.
Binary download
The source code is available from sourceforge.
This is my bds_start.bat script running Delphi2006 on Win7-64bit system. I customized GabeMeister answer and similar script found in one of the links. I now can restart DelphiIDE without reboot. All ttr temp files are still locked by system so del command may not work. They are deletable once system is rebooted.
It's however impossible to restart Delphi double clicking myproject.dpr project files. I was afraid to install IDEFixPack for D2006 because one of comments did not promise it to work.
bds_start.bat
#REM http://www.danielmagin.de/blog/index.php/2014/08/windows-update-disable-delphi-2007-2010/
#REM http://stackoverflow.com/questions/25295980/delphi-2007-error-cannot-create-file-c-users-admin-appdata-local-temp-editorl
#REM http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/idecommandline_xml.html
#REM del files created by DelphiIDE, may not able to delete but
#REM moving to a new name is possible. Use unique name by timestamp.
del "%temp%\EditorLineEnds*.ttr"
set dt=%date%_%time:~3,2%-%time:~6,2%
rename "%temp%\EditorLineEnds.ttr" "EditorLineEnds_%dt%.ttr"
start "" "C:\Borland\BDS\4.0\Bin\bds.exe" -pDelphi
Running CBuilder change argument to -pCBuilder. Maybe best fix would be to create bds.exe replacement tool, del/move *.ttr file, run and passthrough cmd arguments to the original bds_original.exe file. This should enable *.dpr double click restarts. Or use BdsLauncher.exe which I think is regedit linked to *.dpr extension. Then process list had bds.exe name.
Here is another workaround from http://www.danielmagin.de/blog/index.php/2014/08/windows-update-disable-delphi-2007-2010/
Quote:
you can rollback easy in two ways
1: create a batch file with following lines
wusa /uninstall /kb:2982791
wusa /uninstall /kb:2970228
this batch file you run on start up of windows. but with auto update both updates installs every time
2: disable the KB's from autoupdate
after update goto WindowsUpdatesin your system. disable both KB's so on new updates it will be not
installed again
For Delphi 2007, install IDEFixPack 4.4 and add add the following environment variable to the system settings:
IDEFixPack.DisabledPatches=DotNet.GlobalizationSearch
Reboot and it should work.
I have 2 desktops with Win 8.1 Pro and its working like a charm!
If you are on windows, I made a batch file shortcut for starting Delphi. Basically it is a batch file that changes the name of EditorLineEnds.ttr to the current date time, moves it to a different sub folder, and then starts Delphi.
Here are the contents of my batch script:
SET HOUR=%time:~0,2%
SET dtStamp9=%date:~-4%%date:~4,2%%date:~7,2%_0%time:~1,1%%time:~3,2%%time:~6,2%
SET dtStamp24=%date:~-4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%
if "%HOUR:~0,1%" == " " (SET dtStamp=%dtStamp9%) else (SET dtStamp=%dtStamp24%)
if exist "C:\Users\<username here>\AppData\Local\Temp\EditorLineEnds.ttr" (
echo "Moving EditorLineEnds.ttr"
MOVE "C:\Users\<username here>\AppData\Local\Temp\EditorLineEnds.ttr" "C:\Users\<username here>\AppData\Local\Temp\ExtraEditorLineEnds\%dtStamp%.ttr"
) else (
echo "EditorLineEnds.ttr was not found."
)
start "C:\Program Files (x86)\CodeGear\RAD Studio\6.0\bin\bds.exe"
Just to point out that the KB2982791 update has been withdrawn by Microsoft. The reasons cited appear to be problems with font rendering and system crashes and not this specific issue which, on the face of it, does appear to be the fault of Delphi and is merely exacerbated by the update.
The KB article on the Microsoft site has been updated: http://support.microsoft.com/kb/2982791
Specifically these sections are of interest:
Known issue 2
Microsoft is investigating behavior in which fonts do
not render correctly after any of the following updates are installed:
2982791 MS14-045: Description of the security update for kernel-mode
drivers: August 12, 2014
2970228 Update to support the new currency
symbol for the Russian ruble in Windows
2975719 August 2014 update
rollup for Windows RT 8.1, Windows 8.1, and Windows Server 2012 R2
2975331 August 2014 update rollup for Windows RT, Windows 8, and
Windows Server 2012
Status
Microsoft has removed the download links to
these updates while these issues are being investigated.
Known issue 3
Microsoft is investigating behavior in which systems may
crash with a 0x50 Stop error message (bugcheck) after any of the
following updates are installed:
2982791 MS14-045: Description of the
security update for kernel-mode drivers: August 12, 2014
2970228
Update to support the new currency symbol for the Russian ruble in
Windows
2975719 August 2014 update rollup for Windows RT 8.1, Windows
8.1, and Windows Server 2012 R2
2975331 August 2014 update rollup for Windows RT, Windows 8, and Windows Server 2012
This condition may be
persistent and may prevent the system from starting correctly.
Status
Microsoft has removed the download links to these updates while
these issues are being investigated.
The problem seems to be with Windows Updates installed on 13th August.
I tried uninstalling KB2982791 as suggested by the previous poster, but that did not fix the problem.
Uninstalling all Windows updates from 13th August did cure the problem however.
The same for CodeGear Delphi 2009 on Windows 7
Uninstalling following windows update 2982791 2970228 wont help.
Using IDE Fix Pack after that will help.
dzEditorLineEndsFix - Cannot create file %Temp%\EditorLineEnd.ttr
This is a small program that fixes the problem introduced by the Windows update KB2982791 with Delphi 2006 to 2010 that causes the error "Cannot create file %Temp%\EditorLineEnds.ttr".
It works by moving the file to its own unique subdirectory whenever it is being created.
I'm using Windows 8, not 8.1
I turned off all Windows updates and yesterday I checked for updates and installed all security updates. Today I have the same problem, but none of the above mentioned update was installed on my notebook.
I looked for all of them, but did not find any between installed security updates:
KB2982791, KB2970228, KB2975719, KB2975331
But I found another update KB2993651 and tried to uninstall it, uninstallation process was halted. I reset my comp. Now I cant find this update, and the problem did not solved.
So did not find a another workaround and created the following script, that I run before opening RAD 2010.
cd %temp%
ren EditorLineEnds.ttr EditorLineEnds%RANDOM%.ttr
I'm using the %RANDOM% function, because with the fixed name on second time the renamed file will also be locked and the script will not succeed on rename.

New TFrame and TDataModule crashing Delphi IDE

Here is the problem I've met:
Working in BDS 2006 IDE, my older computer gone, new ( i7 mount ) has been built and it has Windows 7 Ult OS 64bit, where 2006 was installed and QuickReports Pro as well as eDocEngine, FIB+, TMS, LMD, ZEOS & DB Comparer Component Packs - I use them in my products.
On computer I have Office 2010 installed as well, by default in 32bit version and Adobe CS6. That's it.
After installation I tried few times reinstall RAD 2009 and anyway, always the same problem, to simplify it is 100% reproducable like that:
Create new Delphi VCL Forms application ;
Click File / New / Other and goto, say, "Delphi files" and select Frame or DataModule. When new file is created, all the time we have message:
"Stack overflow - save your work and restart Delphi for Microsoft Windows"
After that IDE set in bad state and next F12 ( show VCL designer) closes Delphi with General Error.
Any idea what happens?
As I said, I tried few time uninstall - install 2006, start in any personality, use / do not use any of the updates or IDE fixes from Andy's site, nothing helps.
Any help would be greatly appreciated.
You can try running a second instance of the IDE in the debugger.
Create an empty dll or package project.
Open Run > Parameters
Set the host application to $(BDS)\bin\BDS.exe
Then just hit F9 to run the second instance of the IDE in the debugger. After that just follow the steps to reproduce the problem and wait for the exception. If all goes well you'll get a complete call stack to step through.
Note: You may see various other exceptions occurring as the IDE loads. These are normal and can usually be ignored.
Also you didn't mention what version of Windows was on your old machine. If it was Windows XP Uwe could be right. XP was a little more lax on security by default than Vista or 7. The new default is to restrict write access to any folder under Program Files. If that turns out to be the problem you can adjust the write permissions for $(BDS) for whatever user account you use for development.
Delete de PackageCache in Embarcadero registry entries. Its not a complete solution but worked for me.
Got that from here: http://qc.embarcadero.com/wc/qcmain.aspx?d=118669 (last answer).
I have no BDS 2006 at hand, but is it possible that the default folder for new projects is located below the Program Files folder? In that case there might be no write access to that folder.

Problems with Bitbtn in Delphi 6 under Windows vista

I've been working for a long time under Windows XP with Delphi 6 (and under Win2k before).
As I've recently bought a new laptop, I had to start using Windows Vista.
I've installed Delphi 6. Whenever I used the TBitBtn component, I get error when running the compiled program: like resource BBOK not found, resource BBcancel not found, etc.
"Project Project1.exe raised exception class EReadError with message 'Error reading BitBtn1.Kind: Resource BBCANCEL not found'. Process stopped. Use Step or Run to continue."
Right now, I do not have possibility to try to run the exe-file on WinXP; however I was able to compile the same code under WinXP and the produced executable ran fine under Windows Vista as well.
Is there some simple workaround other than upgrade to a newer version of Delphi?
Thanks in advance!
This is definitely not a very neat solution, but this issue seems working after:
Copying Buttons.pas and buttons.res from Sources\Vcl to the directory with my project.
Editing Buttons.pas to use QBOK, QBCANCEL etc. instead of BBOK, BBCANCEL.
Thanks for your comments.

Where does CodeGear Delphi 2009 store settings

I'm running windows 7 ultimate (32bit) and have a very anoying problem with my installation of delphi.
The problem is with the feature "Code Insight" and with "Code template completion", it is very anoying when it every time i write something and it wants to complete some piece of code for me (for example i hate it when he completes the for condition). The problem is that i can't shut it down since i think it has a bug when installed on windows 7 that when i turn those features off it works once and then it turns on again, like it couldn't write in the settings file.
Does anybody know where Codegear Delphi 2009 stores it's setting/configuration file? Or how can i turn off.
I tried running it as administrator in compatibility mode (vista and xp) tried searching for the file but with no luck.
In the registry under: HKEY_CURRENT_USER\Software\CodeGear\BDS\6.0
Also in HKEY_LOCAL_MACHINE\SOFTWARE\CodeGear\BDS\6.0 but there seems to be no data there of interest.
Also under C:\Users*USERNAME*\AppData\Roaming\CodeGear\BDS\6.0 are some settings stored.

Resources