不规则labview界面

我们将labview面板中指定颜色透明,剩下的图形就构成了不规则labview界面,我们要用到如下三个函数:

1.Retrieves information about the specified window.

LONG GetWindowLongA(
  HWND hWnd,
  int  nIndex
);

Parameters

hWnd

Type: HWND

A handle to the window and, indirectly, the class to which the window belongs.

nIndex

Type: int

The zero-based offset to the value to be retrieved. Valid values are in the range zero through the number of bytes of extra window memory, minus four; for example, if you specified 12 or more bytes of extra memory, a value of 8 would be an index to the third 32-bit integer. To retrieve any other value, specify one of the following values.

ValueMeaning

GWL_EXSTYLE

-20

Retrieves the extended window styles.

GWL_HINSTANCE

-6

Retrieves a handle to the application instance.

GWL_HWNDPARENT

-8

Retrieves a handle to the parent window, if any.

GWL_ID

-12

Retrieves the identifier of the window.

GWL_STYLE

-16

Retrieves the window styles.

GWL_USERDATA

-21

Retrieves the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.

GWL_WNDPROC

-4

Retrieves the address of the window procedure, or a handle representing the address of the window procedure. You must use the CallWindowProc function to call the window procedure.

 

The following values are also available when the hWnd parameter identifies a dialog box.

ValueMeaning

DWL_DLGPROC

DWLP_MSGRESULT + sizeof(LRESULT)

Retrieves the address of the dialog box procedure, or a handle representing the address of the dialog box procedure. You must use the CallWindowProc function to call the dialog box procedure.

DWL_MSGRESULT

0

Retrieves the return value of a message processed in the dialog box procedure.

DWL_USER

DWLP_DLGPROC + sizeof(DLGPROC)

Retrieves extra information private to the application, such as handles or pointers.

Return Value

Type: Type: LONG

If the function succeeds, the return value is the requested value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

If SetWindowLong has not been called previously, GetWindowLong returns zero for values in the extra window or class memory.

2.Changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory.

LONG SetWindowLongA(
  HWND hWnd,
  int  nIndex,
  LONG dwNewLong
);

Parameters

hWnd

Type: HWND

A handle to the window and, indirectly, the class to which the window belongs.

nIndex

Type: int

The zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer. To set any other value, specify one of the following values.

ValueMeaning

GWL_EXSTYLE

-20

Sets a new extended window style.

GWL_HINSTANCE

-6

Sets a new application instance handle.

GWL_ID

-12

Sets a new identifier of the child window. The window cannot be a top-level window.

GWL_STYLE

-16

Sets a new window style.

GWL_USERDATA

-21

Sets the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.

GWL_WNDPROC

-4

Sets a new address for the window procedure.

You cannot change this attribute if the window does not belong to the same process as the calling thread.

 

The following values are also available when the hWnd parameter identifies a dialog box.

ValueMeaning

DWL_DLGPROC

DWLP_MSGRESULT + sizeof(LRESULT)

Sets the new address of the dialog box procedure.

DWL_MSGRESULT

0

Sets the return value of a message processed in the dialog box procedure.

DWL_USER

DWLP_DLGPROC + sizeof(DLGPROC)

Sets new extra information that is private to the application, such as handles or pointers.

dwNewLong

Type: LONG

The replacement value.

Return Value

Type: Type: LONG

If the function succeeds, the return value is the previous value of the specified 32-bit integer.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

If the previous value of the specified 32-bit integer is zero, and the function succeeds, the return value is zero, but the function does not clear the last error information. This makes it difficult to determine success or failure. To deal with this, you should clear the last error information by calling SetLastError with 0 before calling SetWindowLong. Then, function failure will be indicated by a return value of zero and a GetLastError result that is nonzero.

3.Sets the opacity and transparency color key of a layered window.

BOOL SetLayeredWindowAttributes(
  HWND     hwnd,
  COLORREF crKey,
  BYTE     bAlpha,
  DWORD    dwFlags
);

Parameters

hwnd

Type: HWND

A handle to the layered window. A layered window is created by specifying WS_EX_LAYERED when creating the window with the CreateWindowEx function or by setting WS_EX_LAYERED via SetWindowLong after the window has been created.

Windows 8:  The WS_EX_LAYERED style is supported for top-level windows and child windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.

crKey

Type: COLORREF

A COLORREF structure that specifies the transparency color key to be used when composing the layered window. All pixels painted by the window in this color will be transparent. To generate a COLORREF, use the RGB macro.

bAlpha

Type: BYTE

Alpha value used to describe the opacity of the layered window. Similar to the SourceConstantAlpha member of the BLENDFUNCTION structure. When bAlpha is 0, the window is completely transparent. When bAlpha is 255, the window is opaque.

dwFlags

Type: DWORD

An action to be taken. This parameter can be one or more of the following values.

ValueMeaning

LWA_ALPHA

0x00000002

Use bAlpha to determine the opacity of the layered window.

LWA_COLORKEY

0x00000001

Use crKey as the transparency color.

Return Value

Type: Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

还用用到一个labview的私有属性节点来获取该VI前面板的句柄

调用函数如下图所示:

其中SetWindowPos可以忽略,他只是指定窗口位置的。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值