Jump to content

Choosing display device and pixel coordinates


njord
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...