char* szSTAWin= "XDragSource::executeDrag is called from the same " "OLE STA thread that created the window."; char* szMTAWin= "XDragSource::executeDrag is called from an MTA thread " "that did not create the window.";
// Remove the subclass from the edit control.
::SetWindowLong(m_hwndEdit, GWL_WNDPROC,
(LONG) wpOrigEditProc);
return0;
}
LRESULT AWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ // Prepare the EDIT control
m_hwndEdit = CreateWindowA( "EDIT", // predefined class
NULL, // no window title
WS_CHILD | WS_VISIBLE | WS_VSCROLL |
ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL, 0, 0, 0, 0, // set size in WM_SIZE message
m_hWnd, // parent window
(HMENU) NULL, // edit control ID
(HINSTANCE) GetWindowLong( GWL_HINSTANCE),
NULL);
// the map is used in the window procedure for the edit window to associate the // it to the right main window ( AWindow)
mapEditToMainWnd[m_hwndEdit]= m_hWnd; // Superclass the edit window, because we want to process mouse messages
wpOrigEditProc = (WNDPROC) ::SetWindowLongA(m_hwndEdit,
GWL_WNDPROC, (LONG) EditSubclassProc);
// Add text to the window. if( m_isMTA)
::SendMessageA(m_hwndEdit, WM_SETTEXT, 0, (LPARAM) szMTAWin); else
::SendMessageA(m_hwndEdit, WM_SETTEXT, 0, (LPARAM) szSTAWin);
Any any;
any <<= (sal_uInt32)m_hWnd;
xInitTarget->initialize( Sequence<Any>( &any, 1) );
m_xDropTarget->addDropTargetListener( static_cast<XDropTargetListener*>
( new DropTargetListener( m_hwndEdit)) ); // // make this window a drop target
m_xDropTarget->setActive(sal_True);
return0;
}
// When the mouse is dragged for a second than a drag is initiated
LRESULT AWindow::OnMouseAction(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ if( uMsg== WM_LBUTTONDOWN)
{
SetTimer( 1, 1000);
}
CloseHandle(CreateThread(NULL, 0, MTAFunc, &data, 0, &mtaThreadId)); // We must wait until the thread copied the ThreadData structure
WaitForSingleObject( data.evtThreadReady, INFINITE);
CloseHandle( data.evtThreadReady);
LRESULT AWindow::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ // Make the edit control the size of the window's // client area.
::MoveWindow(m_hwndEdit, 0, 0, // starting x- and y-coordinates
LOWORD(lParam), // width of client area
HIWORD(lParam), // height of client area TRUE); // repaint window
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.