Skip to content
This repository was archived by the owner on May 14, 2023. It is now read-only.

Commit e03df39

Browse files
committed
Replace all FAQs/ files with redirects
1 parent cbeb4e7 commit e03df39

6 files changed

+6
-523
lines changed

Diff for: FAQs/AboutBoxComponent.md

+1-21
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
11
# About Box Component FAQ
22

3-
This page has some frequently asked questions about the DelphiDabbler [About Box Component](https://delphidabbler.com/software/aboutbox). You can also try the component's [documentation](../Docs/AboutBoxComponent.md).
4-
5-
----
6-
7-
***How does the component load the information it displays?***
8-
9-
There are two ways of providing the information to be displayed in the about box.
10-
11-
The simplest is to simply set the `ProgramName`, `Version`, `Copyright` and `Notes` properties to the required values. This can be done at design time. For this to take effect ensure that nothing is assigned to the `VersionInfo` property.
12-
13-
The alternative is to enable the component to get the required information from the program's version information resources, if they exist.
14-
15-
First, drop a `TPJVersionInfo` component on the same form as the About Box Component. Leaving all the `TPJVersionInfo` component's properties at their default values ensures that it reads your program's version information resources.
16-
17-
Now set the about box component's `VersionInfo` property to reference the `TPJVersionInfo` component. That's all you need to do. The about box will now automatically get the text to display from the program's version information.
18-
19-
----
20-
21-
***Any plans to make the component compatible with Unicode Delphis?***
22-
23-
The component has been Unicode compatible since v3.5. If you're using an older version you need to update it. You will loose support for Delphi 1 though!
3+
This page has [**moved**](https://lib-docs.delphidabbler.com/AboutBox/faqs)

Diff for: FAQs/ConsoleAppClasses.md

+1-173
Original file line numberDiff line numberDiff line change
@@ -1,175 +1,3 @@
11
# Console Application Runner Classes FAQ
22

3-
This page has some frequently asked questions about the DelphiDabbler [Console Application Runner Classes](https://delphidabbler.com/software/consoleapp). You can also try the class' **[documentation](../Docs/ConsoleApp.md)**.
4-
5-
## Contents
6-
7-
1. [Why am I getting an access violation when running code that uses TPJConsoleApp compiled with with Delphi 2009 (and later)?](#faq-1)
8-
2. [Does TPJConsoleApp handle Unicode output from console applications correctly?](#faq-2)
9-
3. [In the command shell running "MyApp.exe >out.txt" redirects MyApp's output to out.txt. Why doesn't this command redirect when run with TPJConsoleApp?](#faq-3)
10-
4. [In the command shell I can pipe data between applications. How can I do this with TPJConsoleApp?](#faq-4)
11-
5. [How do I create or open a file with an inheritable handle?](#faq-5)
12-
13-
----
14-
15-
## FAQ 1
16-
17-
**Why am I getting an access violation when running code that uses TPJConsoleApp compiled with with Delphi 2009 (and later)?**
18-
19-
This is because Delphi 2009 and later (the "Unicode Delphis") use the Unicode Windows API (earlier versions used the ANSI API). It is a peculiarity of the Unicode implementation of the `CreateProcess` API function (which `[[(Docs.)TPJConsoleApp]]` uses) that causes this access violation. This peculiarity wasn't present in the ANSI version of the function.
20-
21-
> The classes have been updated to work round this problem. You need to update to release 1.0.2 or later.
22-
23-
24-
## FAQ 2
25-
26-
**Does TPJConsoleApp handle Unicode output from console applications correctly?**
27-
28-
There is no straightforward answer to this. Because `TPJConsoleApp` can run any console app it can know nothing about the output of programs it is used to run.
29-
30-
In the case where the program's output is displayed in the console window the question is irrelevant.
31-
32-
If the output is being redirected to a file then the output is a faithful byte by byte copy of the console program output. If the program writes Unicode text then that's what the file will contain.
33-
34-
If output is redirected to the pipe then, again, the actual bytes output by the program are written to the pipe. The programmer is responsible for reading the pipe and must make sure that any structured data is re-assembled correctly. Each time the pipe is read it is possible it may contain an odd number of bytes, which is not valid Unicode. But I stress, it is up to the programmer to handle this - it is not a function of `TPJConsoleApp`.
35-
36-
> Some pipe filter classes are available in the [I/O Utility Classes project](https://delphidabbler.com/software/ioutils), one of which can read Unicode from a pipe correctly. See [this example](../Docs/ConsoleApp/Examples/Example12.md) for details.
37-
38-
## FAQ 3
39-
40-
**In the command shell running `MyApp.exe >out.txt` redirects MyApp's output to `out.txt`. Why doesn't this command redirect when run with `TPJConsoleApp`**
41-
42-
The `>` redirection operator in `MyApp.exe >out.txt` is special to the command shell. The shell interprets it by making `MayApp.exe` write its standard output to `out.txt` instead of the console.
43-
44-
The operator has no meaning outside the command shell. To see this try executing a command line containing the ">" operator via the Windows Run dialog box [Windows Key + R]. It won't work. Using the Windows API to execute such a command also fails: this is what `TPJConsoleApp` does.
45-
46-
`TPJConsoleApp` **can** do redirection, but you have to do a lot of the work yourself that the command shell does behind the scenes. To understand this let's take a look at what the command shell does when it encounters the `>` operator.
47-
48-
First the shell creates a new empty file named `out.txt`. The file is created with an inheritable handle to permit it to be used by a child process. `MyApp.exe` is now executed as a child process of the shell and has its standard output handle redirected to the file handle so that anything written to standard output goes to the file.
49-
50-
We have to do the same to use `TPJConsoleApp` for redirection. First create the file ensuring its handle is inheritable ([FAQ 5](#faq-5) explains how). Assign the file handle to `TPJConsoleApp`'s `StdOut` property. Finally call `Execute` with a command line parameter of `@@MyApp.exe@@`, leaving off the redirection operator part.
51-
52-
Redirection using the `2>` (redirect standard error output) and `<` (redirect standard input) operators is similar. Open the required files for output (standard error) or input (standard input) and assign the (inheritable) handles to `TPJConsoleApp`'s `StdErr` or `StdIn` properties respectively.
53-
54-
55-
## FAQ 4
56-
57-
**In the command shell I can pipe data between applications. How can I do this with TPJConsoleApp?**
58-
59-
The only way I have found to do this is to run each application in sequence, capturing output via a pipe to a memory stream an feeding that data into the next application, again via a pipe. It's cruder than threads, because it just runs each application in turn and buffers output before feeding to the next application, but I suspect (but don't know) that is what Windows `cmd.exe` does when you use the pipe (`|`) operator. Regardless, I haven't found a way to do this successfully using a separate thread for each application.
60-
61-
To help handle the housekeeping you can use the following class, which needs both the `PJConsoleApp` and `PJPipe` units. Enter the code in a unit named `UConsoleAppChain`.
62-
63-
~~~pascal
64-
unit UConsoleAppChain;
65-
66-
interface
67-
68-
uses
69-
Classes,
70-
PJConsoleApp, PJPipe;
71-
72-
type
73-
TConsoleAppArray = array of TPJConsoleApp;
74-
75-
// Chains together two or more apps represented by TPJConsoleApp instances
76-
// passing intermediate data via pipes and memory streams.
77-
TConsoleAppChain = class(TObject)
78-
private
79-
fIntermediateStream: TStream;
80-
fOutPipe: TPJPipe;
81-
fInPipe: TPJPipe;
82-
procedure SourceWork(Sender: TObject);
83-
public
84-
constructor Create;
85-
destructor Destroy; override;
86-
procedure Execute(const Apps: TConsoleAppArray);
87-
end;
88-
89-
implementation
90-
91-
uses
92-
SysUtils;
93-
94-
{ TConsoleAppChain }
95-
96-
constructor TConsoleAppChain.Create;
97-
begin
98-
inherited Create;
99-
fIntermediateStream := TMemoryStream.Create;
100-
end;
101-
102-
destructor TConsoleAppChain.Destroy;
103-
begin
104-
fInPipe.Free;
105-
fOutPipe.Free;
106-
fIntermediateStream.Free;
107-
inherited;
108-
end;
109-
110-
procedure TConsoleAppChain.Execute(const Apps: TConsoleAppArray);
111-
var
112-
Idx: Integer;
113-
FirstAppIdx: Integer;
114-
LastAppIdx: Integer;
115-
begin
116-
Assert(Length(Apps) >= 2);
117-
118-
FirstAppIdx := Low(Apps);
119-
LastAppIdx := High(Apps);
120-
121-
fIntermediateStream.Size := 0;
122-
123-
for Idx := FirstAppIdx to LastAppIdx do
124-
begin
125-
try
126-
if Idx > FirstAppIdx then
127-
begin
128-
fIntermediateStream.Position := 0;
129-
fInPipe := TPJPipe.Create(fIntermediateStream.Size);
130-
fInPipe.CopyFromStream(fIntermediateStream);
131-
fInPipe.CloseWriteHandle;
132-
Apps[Idx].StdIn := fInPipe.ReadHandle;
133-
end;
134-
135-
if Idx < LastAppIdx then
136-
begin
137-
fOutPipe := TPJPipe.Create;
138-
Apps[Idx].StdOut := fOutPipe.WriteHandle;
139-
Apps[Idx].OnWork := SourceWork;
140-
end;
141-
142-
fIntermediateStream.Size := 0;
143-
144-
if not Apps[Idx].Execute then
145-
raise Exception.CreateFmt(
146-
'Error executing "%0:s": %1:s',
147-
[Apps[Idx].CommandLine, Apps[Idx].ErrorMessage]
148-
);
149-
finally
150-
FreeAndNil(fOutPipe);
151-
FreeAndNil(fInPipe);
152-
end;
153-
end;
154-
end;
155-
156-
procedure TConsoleAppChain.SourceWork(Sender: TObject);
157-
begin
158-
fOutPipe.CopyToStream(fIntermediateStream);
159-
end;
160-
161-
end.
162-
~~~
163-
164-
To use, pass an array of `TPJConsoleApp` instances to the `Execute` method, in the order you want them executed. The output of the first instance is used as input to the second and so on. There must be at least two `TPJConsoleApp` instances in the array.
165-
166-
You must set the `StdIn` property of the first app to get the initial data unless it is supplied in any other way. You must also set the `StdOut` property of the last app if you want final output redirected in any way. `TConsoleAppChain` overwrites the remaining `StdIn` and `StdOut` properties, so don't set them. It also sets the `OnWork` event handler of all except the last `TPJConsoleApp` instance to copy output from the pipe to a memory stream.
167-
168-
Each console application except the first must be capable of taking input from standard input. Similarly and each application except the last must write output to standard output.
169-
170-
171-
## FAQ 5
172-
173-
**5: How do I create or open a file with an inheritable handle?**
174-
175-
This question is answered in [Appendix 1](../Docs/ConsoleApp/Appendices/Appendix1.md) of the [Console Application Runner Classes documentation](../Docs/ConsoleApp.md).
3+
This page has [**moved**](https://lib-docs.delphidabbler.com/ConsoleApp/faqs)

Diff for: FAQs/DropFilesComponents.md

+1-102
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,3 @@
11
# Drop Files Components FAQ
22

3-
This page has some frequently asked questions about the DelphiDabbler [Drop Files Components](https://delphidabbler.com/software/dropfiles). You can also try the components' [documentation](https://delphidabbler.com/url/dropfiles-docs).
4-
5-
## Contents
6-
7-
1. [How do I handle files dropped on a single component on my form?](#faq-1)
8-
2. [Why don't the components accept drag and drop when using Vista?](#faq-2)
9-
3. [The WinHelp help file doesn't work on Vista / Windows 7. Can you please convert to HTML Help?](#faq-3)
10-
4. [The components don't seem to accept files dropped from Outlook. Is there any way to make that work?](#faq-4)
11-
5. [Can the components filter a list of dropped components by file extension?](#faq-5)
12-
6. [How do I filter a list of dropped files using a wildcard?](#faq-6)
13-
7. [Where do I find drop files component examples?](#faq-7)
14-
8. [Can the components handle file drops on an application minimised to the tray / notification area?](#faq-8)
15-
9. [Can the components handle drag and drop onto frames?](#faq-9)
16-
10. [Can I find out where files were dropped on a control?](#faq-10)
17-
18-
----
19-
20-
## FAQ 1
21-
22-
**How do I handle files dropped on a single component on my form?**
23-
24-
Use a `TPJCtrlDropFiles` component. Drop this on the same form as the control you want to drop files on and set the component's `ManagedControl` to reference the control. Any files dropped on the managed control will now be intercepted by the `TPJCtrlDropFiles` component and will trigger its `OnDropFiles` event, which you should then handle as normal.
25-
26-
## FAQ 2
27-
28-
**Why don't the components accept drag and drop when using Vista?**
29-
30-
For security reasons in Windows Vista and later, drag/drop is disallowed between windows with different security permissions. This means that applications that processes drag and drop may not be able to receive files dragged and dropped from another window if the security permissions are not compatible.
31-
32-
This is a "feature" of the operating system, not a problem with the components.
33-
34-
## FAQ 3
35-
36-
**The WinHelp help file doesn't work on Vista / Windows 7. Can you please convert to HTML Help?**
37-
38-
No, sorry. I've tried Microsoft's conversion utility which is difficult to use and it will take much too long to convert. I just don't have the time. Instead I've created some on-line Drop Files Components documentation
39-
40-
## FAQ 4
41-
42-
**The components don't seem to accept files dropped from Outlook. Is there any way to make that work?**
43-
44-
No. The components only accept files dragged and dropped from Windows Explorer. To change this would need a complete rewrite.
45-
46-
I suggest you look for code that supports OLE drag and drop.
47-
48-
## FAQ 5
49-
50-
**Can the components filter a list of dropped components by file extension?**
51-
52-
There are two ways to do this.
53-
54-
### Method 1
55-
56-
Handle the component's `OnFileFilter` event.
57-
58-
To accept only files with the '.myext' extension place the following code in the event handler.
59-
60-
```pascal
61-
Accept := ExtractFileExt(FileName) = '.myext';
62-
```
63-
64-
### Method 2
65-
66-
Use a `TPJExtFileFilter` component.
67-
68-
Drop one of these components on the form and assign a reference to it to the Drop Files Component's `Filter` property. Now set the `TPJExtFileFilter` component's `Extension` property to a semi-colon separated list of the extensions you want to accept, for example `'.txt;.htm;.html'`.
69-
70-
The associated drop files component will now accept only files with the specified extensions.
71-
72-
## FAQ 6
73-
74-
**How do I filter a list of dropped files using a wildcard?**
75-
76-
Use a `TPJWildCardFileFilter` component, set its `Wildcard` property to the required wildcard and assign the component to the appropriate Drop Files Component's `Filter` property.
77-
78-
Note that wild cards must conform to the DOS / Windows wild card specification.
79-
80-
## FAQ 7
81-
82-
**Where do I find drop files component examples?**
83-
84-
From v5.0 two demo / example projects have been included with the component download.
85-
86-
## FAQ 8
87-
88-
**Can the components handle file drops on an application minimised to the tray / notification area?**
89-
90-
No.
91-
92-
## FAQ 9
93-
94-
**Can the components handle drag and drop onto frames?**
95-
96-
Yes - use `TPJCtrlDropFiles` and set its `ManagedControl` property to reference the required frame.
97-
98-
## FAQ 10
99-
100-
**Can I find out where files were dropped on a control?**
101-
102-
Yes. All three drop files components expose a `DropPoint` property that gives you the x and y co-ordinates of the position the files were dropped.
103-
104-
For `TPJDropFiles` the position is relative to the client area of the control, for `TPJFormDropFiles` the position is in terms of the client area of the containing form and for `TPJCtrlDropFiles` the co-ordinates are relative to the managed control.
3+
This page has [**moved**](https://lib-docs.delphidabbler.com/DropFiles/faqs)

Diff for: FAQs/FAQs.md

+1-23
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,3 @@
11
# Frequently Asked Questions
22

3-
Here's a list of the available FAQs for the DelphiDabbler Code Library.
4-
5-
## Contents
6-
7-
* [About Box Component](./AboutBoxComponent.md)
8-
* [Console Application Runner Classes](./ConsoleAppClasses.md)
9-
* [Drop Files Components](./DropFilesComponents.md)
10-
* [Message Dialog Components](./MessageDialogComponents.md)
11-
* [Window State Components](./WindowStateComponents.md)
12-
13-
## Ask a Question
14-
15-
If you have a question that needs answering please check the FAQs above **and** the [relevant library documentation](../README.md) - you may find an answer there.
16-
17-
If you still can't find an answer then please do the following:
18-
19-
1. Go to the Code Library Documentation repository's [issues page](https://github.com/delphidabbler/ddab-lib-docs/issues).
20-
2. Check any existing issues to see if someone else is asking a similar question. If so add a comment giving the question a thumbs up (enter `:+1:` in the comment to display a :+1: emoji). Add any further information you think is relevant.
21-
3. If there is no similar issue create a new one and ask your question.
22-
23-
Any answer will be posted on the relevant FAQ page.
24-
25-
> **Note** you will need a GitHub account to be able to create or comment on an issue.
3+
This page has [**moved**](https://lib-docs.delphidabbler.com/faqs)

Diff for: FAQs/MessageDialogComponents.md

+1-53
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,3 @@
11
# Message dialogue Components FAQ
22

3-
This page has some frequently asked questions about the DelphiDabbler [Message dialogue Components](https://delphidabbler.com/software/msgdlg). You can also try the components' [documentation](https://lib-docs.delphidabbler.com/MsgDlg).
4-
5-
----
6-
7-
**Can I change the colour of the dialogue box window?**
8-
9-
Yes and no!
10-
11-
With `TPJWinMsgDlg` (and the deprecated `TPJMessageDialog`) you can't do this because this component is just a wrapper around Windows API calls that do not permit the colour to be changed.
12-
13-
It is possible using `TPJVCLMsgDlg`, which wraps Delphi VCL calls which use a normal Delphi `TForm` to implement the dialogue box. The component's `OnShow` event gives access to the dialogue form. Just handle the event and change the form's colour in the event handler, like this:
14-
15-
```pascal
16-
procedure TForm1.PJVCLMsgDlg1Show(Sender: TObject; Dlg: TForm);
17-
var
18-
I: Integer;
19-
begin
20-
Dlg.Color := clWindow; // replace this with your desired colour
21-
end;
22-
```
23-
24-
Note that the `Dlg` parameter is a reference to the dialogue box form while `Sender` is a reference to the component. `Dlg` is valid only while the dialogue is being displayed.
25-
26-
> You need v2.2 or later of the components for this to work.
27-
28-
----
29-
30-
**Can I change the colour of the dialogue box buttons?**
31-
32-
No. `TPJWinMsgDlg` (and the deprecated `TPJMessageDialog`) are simply wrappers round Windows API calls that do not expose this behaviour. `TPJVCLMsgDlg` uses standard Delphi `TButton` controls which do not allow their colour to be changed.
33-
34-
----
35-
36-
**How do I get access to the controls used in a dialogue box displayed by TPJVCLMsgDlg?**
37-
38-
Handle the component's `OnShow` event and enumerate the controls owned by the form referenced by the `Dlg` parameter. The following example displays the class and name of each control on the dialogue box form in a `TMemo` control.
39-
40-
```pascal
41-
procedure TForm1.PJVCLMsgDlg1Show(Sender: TObject; Dlg: TForm);
42-
var
43-
Ctl: TComponent;
44-
I: Integer;
45-
begin
46-
Memo1.Clear;
47-
for I := 0 to Pred(Dlg.ComponentCount) do
48-
begin
49-
Ctl := Dlg.Components[I];
50-
Memo1.Lines.Add(Ctl.ClassName + ' : ' + Ctl.Name);
51-
end;
52-
end;
53-
```
54-
55-
> You need v2.2 or later of the components for this to work.
3+
This page has [**moved**](https://lib-docs.delphidabbler.com/MsgDlg/faqs)

0 commit comments

Comments
 (0)