News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

WM_CLIPBOARDUPDATE

Started by jj2007, January 17, 2017, 11:57:20 AM

Previous topic - Next topic

jj2007

The WM_CLIPBOARDUPDATE message is Vista and higher. XP fans must use the unreliable clipboard chain functions.

In case you have a timer in your message loop, here is a macro that sends the message in XP:
ClipboardChangeNotify MACRO hWin
  ifndef ccnOld
.DATA
ccnOld dd ?
.CODE
  endif
  push edi
  mov edi, offset ccnOld
  invoke GetClipboardSequenceNumber
  cmp eax, [edi]
  stosd
  pop edi
  .if !Zero?
invoke SendMessage, hWin, WM_CLIPBOARDUPDATE, 0, 0
  .endif
ENDM


Usage:  SWITCH uMsg
  CASE WM_TIMER
ClipboardChangeNotify hWnd
  CASE WM_CLIPBOARDUPDATE
MsgBox 0, "The clipboard has changed", "Hi", MB_OK
  ...


Demo attached - pure Masm32, tested on Win7-64 and XP