FAQ Database Discussion Community


Programatically press ALT+TAB until the active caption matches a given string in Delphi

delphi,delphi-2010
I'm trying to programmatically select a windows that matches a specific string in caption by pressing ALT+TAB. Any idea how can I do that? I'm trying to find an alternate solution to the code below which has a strange downside: the minimize button of the external application does not work...

How to solve error 'DesignIntf.dcu' not found in Project (Not Package)

delphi,delphi-7,delphi-2010
I've done a lot of research before asking here so I already tried to add -LUDesignIDE to the compiler options. However it was enough to add 'DesignIDE' to the requires part of the package files but in my .exe files - so pure project files with some units - I...

Run function inside a thread and get result

delphi,delphi-2010
I have 2 functions that can tell me if a file is in use by checking if the size of the file grows.In order to work I need to use a delay of 5000ms between each size gathered from the same file.This is OK but it blocks my main thread...

How to pass a method's nested procedure as a parameter?

delphi,delphi-2010
Given a TForm with a TListBox on it, the following works: procedure TForm1.FormCreate(Sender: TObject); procedure _WorkOnListBox; begin ListBox.Items.Append('Test'); end; begin _WorkOnListBox; end; As does the following: procedure TForm1.DoWithoutListBoxEvents(AProc: TProc); begin ListBox.Items.BeginUpdate; try AProc; finally ListBox.Items.EndUpdate; end; end; procedure TForm1.FormCreate(Sender: TObject); begin DoWithoutListBoxEvents(procedure begin LayersListBox.Items.Append('Test'); end); end; But the following does...

Value of PixelsPerInch varying with windows themes?

delphi,winapi,delphi-2010,delphi-xe7
In windows 7 environment, the value of PixelsPerInch varies while switching between Win7 and classic themes. Strangely, while having the current windows OS active on a 150% scale, in Win7 theme PixelsPerInch returns a value of 96. The attached table will elaborate further....

Function to increment filename

delphi,delphi-2010
I'm trying to make a function that can increment a filename. If last char of the string is a number then increment it. If last char is a letter then add _1 or _2 or _3(increment this also). I have to be sure the filename is unique but i cannot...

How to get window main menu bar bounds?

delphi,screenshot,delphi-2010
My aim is to get screenshot of a window from a foreign application without its main menu bar. I'm using this code: BitBlt(Canvas.Handle, 0, 0, Width, Height, WinDC, xShift, yShift, SRCCOPY); where xShift and yShift variable values I need to determine by myself because windows in various applications can have...

Error: “Undeclared identifier” using a form from another Unit - Delphi 2010

delphi,delphi-2010
I'm trying to use a Form from another Unit, but the code isn't recognizing the other Unit. Example: unit uImpressao; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIForm, uniGUIBaseClasses, uniPanel, uniURLFrame; type TfImpressao = class(TUniForm) ufRelatorio: TUniURLFrame; UniImage1: TUniImage; procedure UniImage1Click(Sender: TObject); private...

Delphi 2010 - Watchfolder - Check if a file is in use - Add item to listbox while the listbox is in loop

delphi,delphi-2010
I'm trying to make a watchfolder application using Delphi 2010. On the main form I added 2 listbox and a timer. I list all files from a specific folder. At every 5 seconds i perform a check over the files from a listbox to see which file is still in...

Delphi 2010 - Overbyte ICS FTP upload with progress bar

delphi,delphi-2010
I'm using the ICS Overbyte FTP for uploading a file. I want to display a progressbar and a speed indicator in order to trqack and estimate large file uploads. How can I do that? Also after the upload is completed i want to delete the file from my hdd. Here...

TPopupmenu Ownerdraw

delphi,delphi-2010,popupmenu,ownerdraw
i set the Popupmenu OwnerDraw property True but there is no "OnOwnerDraw" event neither in the object inspector nor .OnOwnerDraw property in the code ! using Delphi 2010 ...