delphi

Execute a method from a form created by class reference (Delphi)

Hi, I have a form (form2) and I implemented the following PUBLIC method: function ShowInterface(i:integer):boolean; This form is in a package that will be DYNAMIC LOADED. Now I want to instantiate this form (form2) and execute the method above. Important: I can't reference form2's unit in form1. I tryed this code, but it never find...

Are GUIDs necessary to use interfaces in Delphi?

The official documentation says they are optional. I know COM interop requires a unique identifier for each interface but every interface example I see has a GUID whether it's used with COM or not? Is there any benefit to including a GUID if its not going to be used with COM? ...

Should I move from Java programming to Delphi programming?

over the years i have been employed in a permanent position with firms that did their development work in Windows SDK, VC++, and most recently Java; in my own eyes, I am language independent. Should I move from Java to Delphi (assuming pay-scale remains unchanged)? I'm concerned because, for the most part, the net presents a relativel...

Delphi Custom popup/dropdown, how?

I want to make a custom dropdow/popup menu with a shadow nicely beneath it. The problem is that it is not a standard menu and I need to put some components on the popup/dropdown. So basically I want a dropdown I can do whatever I want with, not being limited to simple menuitems. I want it to act like a normal popupmenu problem is where d...

Need to allocate memory before a Delphi string copy?

Do I need to allocate memory when performing a Delphi string copy? I've a function which posts a Windows message to another form in my application. It looks something like this: // Note: PThreadMessage = ^TThreadMessage; TThreadMessage = String; function PostMyMessage( aStr : string ); var gMsgPtr : PThreadMessage; gStrLen : Int...

How to link Delphi with C++?

cpp.cpp extern "C" char* GetText() { return "Hello, world!"; } delphi.dpr {$APPTYPE CONSOLE} {$LINK 'cpp.obj'} function _GetText: PChar; cdecl; external; begin WriteLn(_GetText); end. I can't get this to work, no matter what I try. I tried various calling conventions, playing with underscores. even creating a .c wrapper for t...

2 Runtime Packages: how can I use a unit from each other? (Delphi)

Hi, Lets assume we have 2 runtime packages, with 1 form in each one; Pkg1 -> Unit1 (frm1) Pkg2 -> Unit2 (frm2) Now I want that they "know" each other. When pkg1 needs to know Unit2, we have to "require" Pkg2 in Pkg1. So now I can do a "uses" Unit2 and then do frm2.Show in Unit1 code. But when I do the same thing in Pkg2 (set to requ...

open database with initfile

how to open a database local or remote with IniFile. something like the below. vBanco : String; IniFileName : TIniFile; begin IniFileName := TIniFile.Create(ExtractFilePath(ParamStr(0))+FileName); Try if FileExists (remote+'db\ado.mdb') then begin vBanco := Trim(IniFileName.ReadString('a...

How can I find if there are printers installed (using Delphi)

My program is written in Delphi (object oriented pascal). When I try to print anything I get the message "There is no default printer currently selected." on computers with no printers installed. To prevent this I want to check if there are any printers installed. Is there any way to check if any printers are installed? ...

How to convert MP3 to PCM using delphi code?

I have Bass component from http://www.un4seen.com/bass.html. I load mp3 and triying to change the format to PCM but it wont do nothing? or any suggestion will be appreciated. ...

Decompiling a *.DLL to assembly for .net in delphi 4

I love my Delphi 4 but at the same time I see the need to talk to windows .net This is a recompiled dll that I found on sourceforge.net/projects/delphinet/ (DelphiNet03.zip) by some nice people that fund the dll from some were. The real answer is to make this dll so that fits into Delphi as true Delphi code, and not a dll clip on. So ...

Delphi: what are the 8 mystery components on my form?

When I iterate of the controls on my form, I see those which I placed there at design time or run time. They are all of type TEdit, Tmemo, TComboBox, etc ... However, there are always exactly eight which I do not recognize. I can skip over them, since they are not of a type which interests me, but I am curios. I am guessing system con...

Delphi - restore actual row in DBGrid

Hi! D6 prof. Formerly we used DBISAM and DBISAMTable. That handle the RecNo, and it is working good with modifications (Delete, edit, etc). Now we replaced with ElevateDB, that don't handle RecNo, and many times we use Queries, not Tables. Query must reopen to see the modifications. But if we Reopen the Query, we need to repositioni...

Delphi - COM/OLE starting example needed

Hi! 10 years have ellapsed since I used COM/OLE, and I forget 90% of them. Now we need to make a COM object to access some data from PHP/Python (this is specific thing, the php ODBC don't access the output params of a DataBase - like stored proc output), and my idea the I realize a minimal object with one method, and PHP/Python can call...

Delphi 7 : how to split a string into a TStringList

It's Delphi seven and I to split a string into lines. Specifically, I have a DFM as a string (pulled from a MySql database) and I want to split it into lines in a TStringList. It looks something like this ... 'Oject Form1: TScriptForm'#$D#$A' Left = 0'#$D#$A' Top = 0'#$D#$A' Align = alClient'#$D#$A' BorderStyle = bsNone'#$D#$A' ...

How to filter Delphi 2010 compiler output (hints)?

I'm trying to get rid of some hints(*) the Delphi compiler emits. Browsing through the ToolsAPI I see a IOTAToolsFilter that looks like it might help me accomplish this through it's Notifier, but I'm not sure how to invoke this (through what xxxServices I can access the filter). Can anyone tell me if I´m on the right track here? Thanks...

Delphi - How to prevent Forms/MsgBoxes to move under prior form?

Hi! Many times we experienced after Windows 98 era that some dialogs are lost their Z-Order, and moved back to prior form. For example: Dialog1.ShowModal; Dialog1.OnClickButton() : ShowMessage('anything'); When MessageBox appears, sometimes not got focus, it is moved under Dialog1. The users confused on it, because they are say: ap...

Using a java class from Delphi

I need to use the logic contained in some java classes. I found JNI, but that project seems not updated recently. Is there a way to use it in a Delphi native application? I use Delphi 2009. ...

Is it possible to make a TListView search by the caption of a different column in Delphi?

Hi, When you set the Caption of a TListItem it seems to always set the Text for the first column in the row. When you start typing in the ListView it will search & select the closest match based on the caption of the first column. I have a situation where I need the caption of the first row to be empty, but still need the search functi...

Delphi RTTI unable to find interface

I'm trying to fetch an interface using D2010 RTTI. program rtti_sb_1; {$APPTYPE CONSOLE} {$M+} uses SysUtils, Rtti, mynamespace in 'mynamespace.pas'; var ctx: TRttiContext; RType: TRttiType; MyClass: TMyIntfClass; begin ctx := TRttiContext.Create; MyClass := TMyIntfClass.Create; // This prints a list of all kn...