PB去掉窗口标题栏

setWindowPos函数把窗口的显示层次修改为HWND—TOPMOST,就可使指定窗口永远不会被其它窗口覆盖,该函数声明为:
  Function Long SetWindowPos(Long hwnd,Long ord,Long x,Long y,Long dx,Long dy,Long uflag) Library ″user32″
  参数1为要顶层显示的窗口句柄,参数2指定显示的层次,参数7为附加选项,其余参数指定窗口位置和大小,均可忽略。在窗口的Open或Activate事件中加入如下函数调用:
  SetWindowPos(Handle(This),-1,0,0,0,0,3)
  参数2取-1表示在最顶层显示窗口,取1表示在最底层显示;最后一个参数若取1,表示窗口大小保持不变,取2表示保持位置不变,因此,取3(=1+2)表示大小和位置均保持不变,取0表示将窗口的大小和位置改变为指定值。
   此外可以通过FindWindow寻找窗口
          SetForegroundWindow()可以用来将其他线程创建的窗口送到前台并将其激活,获得用户的交互事件

例如:

1、把下列声明加到GLOBAL EXTERNAL FUNCTIONS:

Function ulong SetWindowPos(ulong hwnd,ulong hWndInsertAfter,ulong x,ulong y,ulong cx,ulong cy,ulong wFlags) LIBRARY "user32.dll"
Function ULong SetWindowLongA(Long hwnd, Long nIndex, Long dwNewLong) Library 'user32.dll'
Function ULong GetWindowLongA(Long hwnd, Long nIndex) Library 'user32.dll'

2、把下列代码加到W_FRAME窗口(即MDI窗口)的OPEN事件:

//
//置顶
//
SetWindowPos(Handle(This),-1,0,0,0,0,3)
//
//无标题菜单
//
long dwStyle
dwStyle = GetWindowLongA(handle(this), -16)
dwStyle = dwStyle - 12582912
dwStyle = SetWindowLongA(handle(this), -16, dwStyle)

SetWindowPos(handle(this), -2, 0, 0, 0, 0, 39)

猜你喜欢

转载自blog.csdn.net/tlammon/article/details/109079838