Archive

Posts Tagged ‘set’

How to Set / Remove the Form’s StayOnTop Style

December 15th, 1999 m3Rlin No comments

To set or remove the form’s StayOnTop style you can just set the form’s FormStyle property. But this has side effects. For example: if you modify the form’s system menu using the Windows API. After the form’s style is changed the system menu will return to it’s normal state. You can get around this in a very easy and easy way: using the SetWindowPos() function.

  (* hStyle - (HWND) The form's style. This can be:
  ** - HWND_NOTOPMOST - Removes the StayOnTop atribute.
  ** - HWND_TOPMOST - Sets the StayOnTop atribute
  *)
  SetWindowPos(Handle, hStyle, Left, Top, Width, Height, SWP_SHOWWINDOW);

How to Set the Length of a String

December 15th, 1999 m3Rlin No comments

The string length is automatically set but sometimes you want to change the length yourself. That’s because sometimes you have to have the same length of a string every time (when saving to binary files). You can always use the string[n] (ShortString) type but their maximum length is 256 characters.

!!Note: You CAN NOT set the length of string constants.

var
  sString: string;
...
  { This code sets the string length to 512 characters }
  SetLength(sString, 512);