Uneditable source files and shortcuts changed while debugging - delphi

I'm using "Code Gear Delphi 2007", while debugging (Run F9, button with play icon), I can't type any char into source files.
Furthermore, some of default shortcuts (like copy CTRL+C, paste CTRL+V...) are automatically switched to different values:
When the execution is stopped (Program reset CTRL+F2, button with stop icon), all problems disappear.
How could I reset my IDE as it was before these problems?

You have most likely changed the Debugger Options to Map TD32 keystrokes on run and Mark Buffers read-only on run.

Related

Delphi Executable starts in debug mode

Whenever a Executable is opened, the delphi IDE opens as like debug mode. what settings has changed in my IDE?
Can any one help me!
Update: 1. Build taken in other machine also causing this issue.
How come a opening an EXE, starts the IDE?
Default debugger was modified from vcjitdebugger to delphi debugger. So in case of exception delphi instance was started. It can me modified as below:
You need to delete the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
On a 64 bit system delete this key also:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
At the top of your IDE, you have a combo box with the available layouts of the IDE.
You probably have ‘Debug layout’ selected instead of ‘Default layout’ or so...
When you have opened a project, select 'Default layout' and then it will persist that choice for the next time you open a project.

(How) can I export the call stack when on a breakpoint?

Is there a way to export the call stack when the code is stopped on a breakpoint?
I have very long ID strings that I need to grab for use in another program (see pic), and retyping from a screen capture is not really an option ;-)
I'm clicking around in the XE2 IDE but can't find anything.
(Workaround: For now I continue stepping through the code after the breakpoint, until I have moved far enough back up the stack that the local variables are available again.)
The call stack debug window supports the usual selection and clipboard shortcuts. So use CTRL+A to select the entire call stack, and CTRL+C to copy to the clipboard. Or you can select a single item and copy with CTRL+C. Or you can select multiple items with CTRL+click and SHIFT+click, and so on.

Delphi 2007 IDE layout modified after a crash

I loaded a bad PAS/DFM file (long story), which caused a GPF, after which the IDE crashed horribly. Lost my Project-related data (list of open files, etc).
Now, when I start the IDE, it always is in "run" mode. that is, it shows the breakpoints and watches and local variables, even though no program is running. Similarly, the properties are not visible unless I use F11 to bring them up. I've restarted the IDE repeatedly. Interestingly, it still can compile and run a program.
How do I reset the IDE so that it works properly?
Check your layout. It's a combo box on the toolbar. It's probably set to 'Debug Layout' instead of Default or Classic (or something else if you've setup a custom layout.)

A kinder way than TerminateProcess?

I have a backup app that will close user-defined running programs before the backup so that open data files can be closed and flushed before the backup. After the backup is complete it restarts the programs in the list.
I have no problem getting the window Handle using the Caption and PostMessage(AppHandle,WM_CLOSE,0,0); That works fine for most apps, but not for ones running in the Notification Area (System Tray)
Currently I am using TerminateProcess( and it works for those Notification Area apps, but it leaves files open as Windows bypasses any Close instructions and just slams those apps down.
I have searched long and hard and I cannot find a nicer way to shut down Notification Area apps. Can anyone please help?
Thanks
In order to close a program gracefully, you need to know something about how that program expects to be closed. If closing the main window accomplishes it, then you need to know how to recognize the "main" window.
Programs don't run "in" the notification area. They display icons there. Any program with a notification icon must also have a window (because the shell tells the program that the icon has been clicked by sending messages to the window). Even if the window isn't visible, it still must exist. If you can determine some set of properties that identify the window associated with a particular notification icon, then you could close it. There is no standard set of attributes to look for, though; each program can do it differently.
And even if you find the window you're looking for, closing it might not be the way the program expects to be terminated, either. It might expect a certain command from the notification icon's menu instead, or some message sent by a dialog box that the program displays.
If your application is running on Windows Vista or Windows 7, don't shut down programs - instead use the Volume Shadow Copy service to access a snapshot of the files while they are still in use. This is what the Windows 7 built-in backup program does.
If you're on an earlier version of Windows, there's no foolproof solution. If the program has a systray icon, it will have a hidden window as well, and you can try sending WM_QUERYENDSESSION and WM_ENDSESSION to it. However, there is no guarentee that the program will shut down, and if it does shut down, since you may be bypassing parts of its normal shutdown process, it may not complete its normal cleanup. There may also be programs running with no associated windows at all. The best approach would probably be to simply log off the user, and perform the backup from a service process. Of course, you'll still have sharing issues with files opened by other services...

How to debug Delphi project?

I'm a .NET developer, but I have got a quest - I must find errors in a Delphi project.
After opening a project (Borland Delphi 7) and trying to debug it ('Run' menu), I've noticed all debugging options are inactive (gray).
How can I make it usable?
I'm not sure why the pause button doesn't work, but I have seen Delphi 7 get "confused" and refuse to stop on legitimate breakpoints before.
Make a backup of everything, just in case you don't have the source for all of the DCUs.
Delete the project's DCUs.
Make sure you're including debug information in the project's options.
Do a full build (not just a recompile).
I hope this helps.
The debugger is always active, unless it is explicitly deactivated. Just run the application and the inactive menu items will become active. (For some options you have to have to pause the running application)
Just try pressing F8. This will run the application and pause at the first line of executable code and most of the debugging items will become active.
Hard to tell just from that description, but here are a few pointers.
Make sure you've got a project (.dpr) loaded, and not just a source (.pas) file.
Try to build the project with SHIFT-F9. When it's done, if everything compiles successfully, you'll see blue dots in the "gutter" at the left side of the text editor, showing which lines actually contain debuggable code. If you don't get any of those, go into Project Options and turn on the Debug option, then rebuild.
Once you've done that you should be able to run and debug the app.
Tools-->Debugger Options
Make sure integrated debugging is checked.

Resources