delphi

how to drag a text string and its hyperlink from an HTML page to a TEdit

I hope to to drag a text string and its hyperlink from an HTML page to a TEdit. For example displays aaa actual string is <a href=somewhere.html>aaa</a> I try to use drag&drop vcl, but found that it only can catch aaa itself rather than the string and its hyperlink. Welcome any comment Thanks interdev ...

CPU overheating because of Delphi IDE

I am using Delphi 7 but I have trialed the Delphi 2005 - 2010 versions. In all these new versions my CPU utilization is 50% (one core is 100%, the other is "relaxed") when Delphi IDE is visible on screen. It doesn't happen when the IDE is minimized. My computer is overheating because of this. Any hints why this happens? It looks like i...

Copy Delphi Profile

My computer crashed recently. We have a Delphi app that takes a lot of work to get running. One of my co-workers has it all installed still. Is there a way to copy the stuff stored in the palette? And the library paths? I am using Delphi 5 (I know it is very very very old) ...

Delphi 7 get folder name from path

I have a path say C:\Program Files\Borland what would bet the easiest way to parse that string and just return Borland? thanks ...

KaZip for C++Builder2009/Delphi

Hi. I have download and install KaZip2.0 on C++Builder2009 (with little minor changes => only set type String to AnsiString). I have write: KAZip1->FileName = "test.zip"; KAZip1->CreateZip("test.zip"); KAZip1->Active = true; KAZip1->Entries->AddFile("pack\\text.txt","xxx.txt"); KAZip1->Active = false; KAZip1->Close(); now he create a...

Delphi and Outlook TaskItem: How to know if DueDate is empty?

This seems like a no-brainer but I couldn't find anything on it. How do I detect if a date variant in Outlook is "empty"? For example TaskItem.DueDate - the duedate is not necessarily filled. If it's not filled Outlook returns "4501.01.01." - I can test for this value, but this just doesn't seem "elegant" enough. Thanks! ...

SQL Server 2005 and 'General network error'

I know there is a lot of information in the Internet about solving this problem, but it didn't help me. My Delphi application uses dbExpress controls to access the database and execute SQL queries. Once every couple of days, however, it stops working because the database connection fails. This happens on several different computers wit...

Manually Writing the HTML in TWebBrowser

EDIT: Look at Jorn's approach. I am using the strategy suggested here: http://cc.embarcadero.com/Item/23992 to get my HTML in the TWebBrowser, but I get a bunch of JavaScript errors when the page loads. If I click yes enough times I can see a page with no formatting and I'm guessing the page does nothing. My theory is that because the ...

Why does this code fail in D2010, but not D7?

Why does this code get an access error on the Result := Buffer line in D2010, but not D7? Something, I'd guess, involving UniCode, but the compiler doesn't generate any warnings. Any suggestions on an elegant workaround? Edit: Ouch: the GetTempPath call is trashing the stack as evidenced by the fact that Extension is empty after the ...

How do I make Master/Detail subreports in ReportBuilder come out right?

I've got a report in ReportBuilder that's supposed to report on two objects. I didn't create this report, and I can't ask the person who did about how it works. Before running the report, we have some code that goes through, finds all the properties on the objects, and loads them into a memory dataset that looks like this: OBJECT_ID: ...

Delphi 2010 Code Formatter: "(MyVar as TMyType).MyMethod" is split in two lines

How to prevent the code formatter from doing this? It seems that it moves casts with "as" always a line up. Is this a bug, or is there any setting in the formatter? // Before formatting: procedure TMyFrame.WidthEditChange(Sender: TObject); begin (Properties as TMyProperties).Width := (Sender as TJvSpinEdit).AsInteger; end; // After ...

How to pass a method as callback to a Windows API call?

Hi, I'd like to pass a method of a class as callback to a WinAPI function. Is this possible and if yes, how? Example case for setting a timer: TMyClass = class public procedure TimerProc(Wnd:HWND; uMsg:DWORD; idEvent:PDWORD; dwTime:DWORD); procedure DoIt; end; [...] procedure TMyClass.DoIt; begin SetTimer(0, 0, 8, @TimerProc); ...

Is it possible to smooth a scaled TBitmap in Delphi?

I am using Stretched=True on a TImage with a 256x256 bitmap. This gets scaled down by 1,2,4 or 8. As expected, text on the bitmap gets more horrible the more I depart from '1'. I notice though that Windows 7 explorer renders a scaled down version of the bitmap 'softer' and more pleasing. Is it possible to 'blur' a TBitmap in this way? ...

Error while dynamically loading mapi32.dll

Our application uses Simple MAPI to send e-mails. One of our clients has problems sending e-mail from a session on his terminal server. The mapi32.dll is loaded with a call to LoadLibrary which succeeds, but then our application tries to get the addresses of the functions MAPILogon, MAPILogOff, MAPISendMail, MAPIFreeBuffer and MAPIResol...

Anonymous method as function result

What I want to do is to assign an anonymous method which I get as a function result to a variable of the same type. Delphi complains about not beeing able to do the assignement. Obviously Delphi things I want to assign the "GetListener" function instead of the result of that same function. Any help with this is very much appreciated. ...

FastReport preview not showing all pages

I'm using FastReport 4.7.31 in Turbo Delphi Pro. The following procedure processes the data stored in several dated files depending on user input. procedure TfrmMain.MyReportPrint; var MDate : Tdate; S, myfile : string; firstone: boolean; // Date1, Date2 & ShowPreview are global variables set via a dialog box begi...

[Delphi] How would you refactor this code?

This hypothetical example illustrates several problems I can't seem to get past, even though I keep trying!! ... Suppose the original code is a long event handler, coded in the UI, triggered when a user clicks a cell in a grid. Expressed as pseudocode it's: if Condition1=true then begin //loop through every cell in row, //if aCell/...

How to know when my control changes size?

I'm building a custom control, and I need it to be able to respond when it gets resized. I need the old dimensions and the new dimensions available in order to do some calculations. Unfortunately, the SetWidth and SetHeight methods are private to TControl, not protected, and so I can't override them. Is there any other way to know tha...

Delphi disable warnings fails

I have the following code in a Delphi 2007 application: function TBaseCriteriaObject.RecursiveCount( ObjType: TBaseCriteriaObjectClass): integer; var CurObj: TBaseCriteriaObject; begin result := 0; {$WARNINGS OFF} for CurObj in RecursiveChildren(ObjType) do Inc(Result); {$WARNINGS ON} end; Which produces this warning: ...

SQL Query: Using IF statement in defining new field

I have a table with many fields and additionally several boolean fields (ex: BField1, BField2, BField3 etc.). I need to make a Select Query, which will select all fields except for boolean ones, and a new virtual field (ex: FirstTrueBool) whose value will equal to the name of the first TRUE Boolean Field. For ex: Say I have BField1 = F...