njord Posted July 29, 2011 Posted July 29, 2011 Hello comrades. I have two monitors connected to my pc. 1.How can I choose which monitor Leadwerks Application window will be created in ? 2.How can I control on which xth, yth pixel the LE window will pop up (if not full screen) ? 3.How can I make my LE app "always on top" ? I have tried using parts of this example code : http://www.leadwerks.com/werkspace/topic/3433-checking-if-your-game-has-been-started-multiple-times/page__p__31286__hl__setfocus__fromsearch__1#entry31286 however FindWindow never returns a non null value. Thanks in advance! Quote
Canardia Posted July 29, 2011 Posted July 29, 2011 You can grab the HWND value of the created window with hwnd=GetFocus() right after the graphics command. Then you can use all Windows API functions to manipulate the window. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■
Masterxilo Posted August 7, 2011 Posted August 7, 2011 FindWindow is used like: HWND WINAPI FindWindow( __in_opt LPCTSTR lpClassName, __in_opt LPCTSTR lpWindowName ); so it should be HWND hWnd = FindWindow(0, title.c_str()); in the example you linked to. Quote Hurricane-Eye Entertainment - Site, blog.
njord Posted August 10, 2011 Author Posted August 10, 2011 FindWindow did not work somehow. But this worked : Graphics(resolutionX,resolutionY,32); HWND windowHandle = GetActiveWindow(); void setWindowAlwaysOnTop(bool enable) { if (enable) { SetWindowPos(windowHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); } else { SetWindowPos(windowHandle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); } } void moveWindow(int posx, int posy, int width, int height) { if (width < 1) { width = resolutionX; } if (height < 1) { height = resolutionY; } MoveWindow(windowHandle,posx,posy,width,height,true); } void showWindowBorders(bool enable) { if (enable) { SetWindowLong(windowHandle, GWL_STYLE, GetWindowLong(windowHandle, GWL_STYLE) | WS_BORDER | WS_DLGFRAME | WS_THICKFRAME); } else { SetWindowLong(windowHandle, GWL_STYLE, GetWindowLong(windowHandle, GWL_STYLE) & ~(WS_BORDER | WS_DLGFRAME | WS_THICKFRAME)); } } Thank you for the answers lads. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.