delphi-2007

Delphi - inherit from a class and an interface (adapter pattern)?

懵懂的女人 提交于 2019-12-07 12:22:54
问题 I am trying to do the GoF adapter pattern and in the C# example that I am following the Adapter class is inheriting the original class and an adapting interface. In Delphi (2007), as far as I know, this is not possible, or is it? Cause if a class is inheriting an interface, it needs to inherit from TInterfacedObject and since Delphi doesn't allow multiple class inheritance, that is the end of story. I cannot inherit from a custom class and an interface at the same time. Am I correct? Thank

Delphi 2007 using Windows Imaging Component (WIC)

谁都会走 提交于 2019-12-07 04:41:11
问题 I need to read and convert some pictures around 1.7mb from jpg to bmp in Delphi 2007. Some pictures are cut out, grayscale or worst after conversion. I searched, but in no way i found a trick to add WIC routines like TWicImage in delphi 2007. I read somewhere that it can be easily added via COM, but I do not know how or what file has to be imported. Thank you. 回答1: Here is an example how to convert JPEG to bitmap using WIC: unit Unit1; interface uses Windows, Messages, SysUtils, Variants,

FileExists() returns false, even if file exists

别说谁变了你拦得住时间么 提交于 2019-12-06 23:58:14
问题 I want to check if a dll in System32 directory (Windows 7) exists. But even if it exists, FileExists() returns false. LoadLibrary returns a valid handle. In this case, I only want to check, if the files exists and visualize this information. Do you have a any tips to solve this? 回答1: Most likely this is down to file redirection. You have a 64 bit machine but from the 32 Delphi process, Windows\system32 actually redirects to Windows\Syswow64 . So when you think you are asking for the existence

Delphi 2007 - How to avoid having a \history folder?

有些话、适合烂在心里 提交于 2019-12-06 21:38:18
问题 Newer Delphi versions (including Delphi 2007, which I'm using) have a build in file history feature, which lets you revert to old files from within the IDE. That's nice, but I already have source control. Is it possible to disable this feature? I ask because the IDE auto-creates a \history folder with old versions of all your files, and that annoys me. 回答1: Tools \ Options \ Editor Options \ Uncheck "Create Backup Files" ;) 回答2: I believe you can go into the registry: D2007: HKEY_CURRENT_USER

How can I avoid refresh with TWebBrowser

社会主义新天地 提交于 2019-12-06 12:45:58
问题 I have a TWebBrowser component that show a Google maps page. The problem is that when user press F5 the page refresh and page reloads. This cause javascript variables to reinitialize and get out of sync with Delphi and a scripting error dialog appear, 'undefined' is null or not an object. I want to stop refresh from the user. I tried this event for OnBeforeNavigate2: procedure TNewOrganizationForm.mapAddressBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; var URL, Flags,

Changing the console size

限于喜欢 提交于 2019-12-06 12:39:15
Simple problem in Delphi. I've created a console application and I need to change the height of the console window to 80 lines, if it's less than 80 lines. This need to be done from code and is actually conditional within the code. (I.e. when an error occurs, it increases the size of the console so the whole (huge) error report is visible.) Keep in mind that this is a console application! When it starts, it uses the default console, which I need to alter! Wim ten Brink When calling SetConsoleWindowInfo() the values for Left and Top that are passed to the console need to at least be 1, not 0.

Delphi 2007 Debugger Gone

匆匆过客 提交于 2019-12-06 06:18:47
Scenario: Delphi did a non-normal shutdown. When I restarted I got the messages "Could not find xxxxx.bpl - Would you like to load this next time?" (NOTE: not exact language of message; but close). It did this on a couple files. Unfortunately I said "No - Don't Load on next Startup" and also did not note the specific bpl file names. I do recall they were in the CodeGear directory. This was stupid/lazy on my part. Delphi loads and compiles but there is no Debugging available (basically all the options under the Run menu are disabled). Under Tools->Options->Debugger Options there is no CodeGear

Incompatibilities between Indy 9 and Windows Server 2003?

拜拜、爱过 提交于 2019-12-06 02:17:33
I'm having a problem with a Delphi application on some Windows 2003 servers. It uses a webservice call to connect with another server and transmit data back and forth. As soon as the app gets to the Authenticate method, the app dies. The app has worked for years on previous boxes with Win Server 2003, but it doesn't on freshly built machines. The machines are set up the same way for the most part, but there is clearly some config setting that differs that I'm not able to track down. Also, while the error becomes apparent in the call to Authenticate, packet sniffing proves that nothing ever

How to remove errors (red underlines) in D2007

故事扮演 提交于 2019-12-06 00:13:16
问题 I have a lot of errors in structure panel. The application compiles and run fine with Delphi 2007. But the code have much code that have red underlines. If I press Ctrl + leftclick on it it finds the original declaration. But it is still annoying to have all those errors. 回答1: I have IDE Fix Pack installed, and still get incorrect error insight red lines regularly. Some things which help (temporarily) Close the project and delete *.local and *.identcache, then re-open the project. When

How compatible are static class methods and regular routine pointers?

会有一股神秘感。 提交于 2019-12-05 22:09:38
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(func: TFunc); begin Writeln(func(42)); end; begin CallIt(TMyClass.StaticMethod); // 1a: doesn't compile