delphi-2007

Delphi Remote Debugger Freezing up

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-14 03:52:55
问题 I have Windows Server 2008 R2 Machine that is running a Delphi 2007 application. Update: Switching Delphi versions is currently not an option. I have Delphi XE but there are over 300,000 lines of code to review before any switch can occur. I have run into a problem where I would like to step through the code. I don't want to install Delphi on the machine, so I have installed the remote debugger. Updated steps to be more complete: Compile app with Remote Debug Symbols Copy Application and

Is there any way to catch the error if loading a dll cannot find a dependency?

浪尽此生 提交于 2019-12-14 00:58:18
问题 I am writing a Windows 32 bit program that can use one of multiple possible dlls. So it tries to load each dll in turn, using SysUtils.SafeLoadLibrary and if loading succeeds, it uses that dll. Unfortunately some of these dlls are statically linked to other dlls. These dlls may be missing from the computer. In that case I get dialog telling me [myprogram]: [myprogram.exe] System Error The program can't start because [some dll name] is missing from your computer. Try reinstalling the program

How can I temporarily disable the “return value might be undefined” warning?

扶醉桌前 提交于 2019-12-13 11:55:40
问题 I want to disable a specific warning (W1035) in my code, since I think that the compiler is wrong about this warning: function TfrmNagScreen.Run: TOption; begin if ShowModal = mrOk then Result := TOption(rdgAction.EditValue) else Abort end; There is no way the result could be undefined, since Abort throws EAbort . I tried: {$WARN 1035 Off} : Apparently this only works for some specific errors (see Documentation) {$W-1035} : Does nothing at all I know I can switch off the warning globally in

How can I read email with HTML format in a Delphi application?

人盡茶涼 提交于 2019-12-13 07:28:12
问题 I have created a program that can read email from Exchange 2007. However, it can only read the body of the email in plain-text format. When I tried to retrieve email in HTML format, my software cannot read the body and it always blank. I am using Delphi 2007 and IMAP 9. Update: Here is my code: procedure TForm1.tmrCekTimer(Sender: TObject); var TheFlags: TIdMessageFlagsSet; TheUID: string; TheMsg: TIdMessage; MailBoxName: string; MyClass: TComponent; begin MailBoxName := 'INBOX'; if TheImap

Duck typing in Delphi 2007 (Continued)?

不问归期 提交于 2019-12-13 06:12:27
问题 This is a follow up to this post. I refined my requirement based on the accepted answer posted here. My *.dpr file: program DuckD11; {$APPTYPE CONSOLE} uses SysUtils, uDuckTyping in 'uDuckTyping.pas', uBirds in 'uBirds.pas'; procedure DoSomething(AObject: TObject); begin Duck(AObject).Quack; end; var Bird: TBird; Ganagana: TGanagana; Canard: TCanard; begin Writeln('Duck typing :'); Writeln; Bird := TBird.Create('Bird'); try DoSomething(Bird); finally Bird.Free; end; Ganagana := TGanagana

How to detect UnloadPackage from the target BPL?

☆樱花仙子☆ 提交于 2019-12-13 03:49:58
问题 Is there a part of code which is executed when a dynamic package is unloaded calling UnloadPackage function? var MyPackageHandle : THandle; begin MyPackageHandle := LoadPackage('.\MyPackage.bpl'); if(MyPackageHandle <> 0) then UnloadPackage(MyPackageHandle); end; In this case, I need to execute some code inside MyPackage.bpl when it's unloaded 回答1: The general rule is that you should put code that needs to be called when your package is unloaded into the finalization part of your unit. I know

Installing Rad Studio 2007 and Rad Studio 2010 in same machine

拈花ヽ惹草 提交于 2019-12-12 15:41:23
问题 I want to install Rad Studio 2010 on a machine that already has installed Rad Studio 2007, There is some compatibility problem? thanks in advance, Bye. 回答1: See this answer from Nick Hodges. There is no problem with installing a newer version of Delphi/RAD Studio on a machine that has an older version. As Mason says, the reverse is not necessarily true. 回答2: Trying to install an older version of Delphi when a newer version already exists can cause problems. If you have to have both, either

Strange rare out-of-order data received using Indy

橙三吉。 提交于 2019-12-12 10:26:19
问题 We're having a bizarre problem with Indy10 where two large strings (a few hundred characters each) that we send out one after the other using TCP are appearing at the other end intertwined oddly. This happens extremely infrequently. Each string is a complete XML message terminated with a LF and in general the READ process reads an entire XML message, returning when it sees the LF. The call to actually send the message is protected by a critical section around the call to the IOHandler's

How compatible are static class methods and regular routine pointers?

心不动则不痛 提交于 2019-12-12 09:53:35
问题 It seems to me that static class methods and regular routine pointers are compatible from a practical viewpoint but the compiler doesn't know this. Example: type TFunc = function(i: Integer): string; TMyClass = class public class function StaticMethod(i: Integer): string; static; end; class function TMyClass.StaticMethod(i: Integer): string; begin Result := '>' + IntToStr(i) + '<'; end; function GlobalFunc(i: Integer): string; begin Result := '{' + IntToStr(i) + '}'; end; procedure CallIt

Why does this string have a reference count of 4? (Delphi 2007)

二次信任 提交于 2019-12-12 09:30:21
问题 This is a very Delphi specific question (maybe even Delphi 2007 specific). I am currently writing a simple StringPool class for interning strings. As a good little coder I also added unit tests and found something that baffled me. This is the code for interning: function TStringPool.Intern(const _s: string): string; var Idx: Integer; begin if FList.Find(_s, Idx) then Result := FList[Idx] else begin Result := _s; if FMakeStringsUnique then UniqueString(Result); FList.Add(Result); end; end;