界面小知识

版权声明:www.gudianxiaoshuo.com (古典小说网) 今日头条号: 古典古韵古典小说、讨厌编程 https://blog.csdn.net/shuilan0066/article/details/83411644

1 、SetWindowPos

       当要调用的窗口,属于其他进程时,最好加上SWP_ASYNCWINDOWPOS (异步窗口),否则可能移动窗口时会很卡

      SWP_ASNCWINDOWPOS:如果调用进程不拥有窗口,系统会向拥有窗口的线程发出需求。这就防止调用线程在其他线程处理需求的时候发生死锁。

		HWND hWnd = FindWindow(L"ChatroomForm", NULL);
		if (hWnd)
		{

			DWORD style = GetWindowLong(m_hWnd, GWL_STYLE);
			if (style & WS_MAXIMIZE)
				::SetWindowPos(hWnd, HWND_TOPMOST, pt.x - 400, pt.y, 0, 0, SWP_NOSIZE | SWP_ASYNCWINDOWPOS);


			::ShowWindow(hWnd, SW_SHOWNORMAL);
		}

猜你喜欢

转载自blog.csdn.net/shuilan0066/article/details/83411644