This is an example on how to use scanline to quick access and manipulate the pixels of a bitmap in C++Builder.

Ok, create a project, drag an image and a button onto the from. Then in the form's crate handler, adding a line of code to load an exists picture.

void __fastcall TForm1::FormCreate(TObject *Sender)

//Then in button1 click handler, assign following codes to use scanline to...

Programming - C++Builder


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:DelphiNew Url In Custom WindowOnnewwindow2PpdispTwebbrowser

Usually when we open a new URL in our program using TWebBrowser, it runs  the Internet Explorer(or the program which has been registered to be the default browser) and navigate to the new url. This is always not what we want. Following codes shows how to open the new window by ourself's custom window.

proceduer TForm1.FormShow(Sender :TObject);


Programming - Delphi

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

More Articles...

Page 11 of 13