An very easy way to hide TPageControl's 3D border is to reload the window form procedure. To capture the TCM_ADJUSTRECT message and redraw the pagecontrol's border. See below.

protected procedure WndProc(var Message:TMessage); override;

procedure TPageControl.WndProc(var Message:TMessage);
  if Message.Msg=TCM_ADJUSTRECT then
    Inherited WndProc(Message);
    if Fborder=bsNone then

Programming - Delphi

Tags:DelphiDrag And DropNot WorkOleinitializeOleuninitializeTwebbrowser

I am writing a simple web editor like dreamweaver, I used the TWebBrowser as the editing component. When I run the program, the webbrowser component's design mode has already been set to on, and I can also edit the html elements in my webbrowser window now.

While one problem I found was that I could not move the element by drag and drop. When I select an element in the window and then hold the left mouse button down...

Programming - Delphi

Tags:C-builderDelphiNot WorkOleinitializeOleuninitializeTcppwebbrowserTwebbrowser

This is because you do not call the OleInitialize function. As the OLE operation is not thread-safe, so operation to the memory will cause failure or error. OleInitialize ensure that the concurrent modules run in an STA mode (that is, a single-threaded mode)  to avoid the sharing of resources error. Therefore, in a program's starting function WinMain, we should make some changes as following.
WINAPI WinMain...

Programming - C++Builder

Tags:C-builderNew Url In Custom WindowOnnewwindow2PpdispTcppwebbrowser

When we write our program using TCppWebBrowser, we always want it to open a new web page by our custom window. While if you do not handle the OnNewWindow2 event, it would runs the default webbrowser to open the new url. This example shows how to handle the OnNewWindow2 event and get the result of what we want.

Create a new project, put a TCppWebBrowser onto the form. Assign codes to the form's OnShow and CppWebBrowser1's...

Programming - C++Builder


This example shows how to get the image properties using TWebbrowser in delphi.

Create a new project in Delphi. Put a webbrowser, a button, a listbox onto the form. Then put the codes to the proper position.


//In the FormCreate Handler, assign the following codes to
//make the browser navigate to a web page
procedure TForm1.FormCreate(Sender: TObject);

//Double click button1 to assign the...

Programming - Delphi


This example shows how to use the execCommand and pasteHTML method to put an alternative text to an image in TWebBrowser control in Delphi.

procedure TForm1.Button1Click(Sender: TObject);
  HtmlDoc: IHTMLDocument2;
  HtmlSelObj: IHTMLSelectionObject;
  HtmlTxtRng: IHTMLTxtRange;
  HtmlDoc := WebBrowser1.Document as IHTMLDocument2;
  HtmlDoc.execCommand('InsertImage', False, '');
  HtmlSelObj := HtmlDoc.selection;
  if HtmlSelObj.type_ =...

Programming - Delphi

Tags:Access Violation At AddressC++builderDelphiRead Of Address

When running your program, raise an error message, show as following(this message can be copied out by press Ctrl+C key when the error dialog prompt). One thing to make you very depressed was that you have carefully checked your codes many times while nothing found wrong.

Project app.exe faulted with message: 'access violation at 0x40036887: read of address...

Programming - Delphi


Project aaa.exe raised exception class EInvalidCast with message 'Invalid class typecast'. Process stopped. Use Step or Run to continue. This is the error message prompt by delphi or c++builder enviroment when debugging the program. This is always caused by the incorrect typecast.

Let us see an example attached by c++builder to show how to read the data from a memo field into a blob stream and display it in a memo...

Programming - C++Builder


First, we assume you have a table with a blobfield named "image", then you could use the following codes to read or write the contents from or to the "image" field.

void __fastcall ReadBlobField()
    TBlobField* pField = (TBlobField*)pQuery->FieldByName("Image");  
    TBlobStream* pmem = new TBlobStream(pField, bmRead);  
    pmem->Seek(0, soFromBeginning);  
    Graphics::TBitmap* pBitmap = new...

Programming - C++Builder

More Articles...