MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / DummyWindowThread

Method DummyWindowThread

src/Windows/DragDropWindow.cpp:108–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108int DragDropWindow::DummyWindowThread() {
109 OutMsg("[DnD] Thread start");
110
111 HRESULT res = OleInitialize(NULL);
112 if (res != S_OK && res != S_FALSE) {
113 OutErr("[DnD] Error initializing OLE (Thread): %d\n", res);
114 return -1;
115 }
116
117 m_hwnd = ::CreateWindowEx(
118 0,
119 m_className,
120 TEXT(""),
121 0,
122 CW_USEDEFAULT, CW_USEDEFAULT,
123 CW_USEDEFAULT, CW_USEDEFAULT,
124 // m_hParent,
125 HWND_MESSAGE,
126 NULL,
127 m_hInstance,
128 (LPVOID)this
129 );
130
131 ::SetEvent(m_createWindowEvent);
132 if (!m_hwnd) {
133 OutErr("[DnD] Cannot create drag and drop container window! %d\n", GetLastError());
134 return -1;
135 }
136
137 MSG msg;
138 DWORD retval;
139 while(true) {
140 int result = ::GetMessage(&msg, NULL, 0, 0);
141 if (result == -1) {
142 ::DestroyWindow(m_hwnd);
143 retval = -1; //error
144 } else if (result == 0) {
145 retval = 0;
146 break; //quit
147 } else {
148 ::DispatchMessage(&msg);
149 }
150 }
151
152 ::OleUninitialize();
153
154 OutMsg("[DnD] Thread end");
155
156 m_hWindowThread = NULL;
157
158 return retval;
159}
160
161int DragDropWindow::PerformDragDrop() {
162 int result = 0;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected