R
raagkush
Guest
I am trying to display a picture in a borderless window. I have set the window parameters as shown in the code using HWND. It works for a smaller image, i.e. images smaller than my monitor resolution.
But when I try to load an image of the size of my monitor resolution there a grey bar displayed in the bottom of my window. I assume this bar us the bottom part of my dialogue window.
How to remove this bar? My code is as follows:
#include "stdafx.h"
#include "includes.h"
using namespace cv;
/********************* PRESETS **************************/
/*configBorderlessWindow : This Function configures the opencv image display
window to
borderless using windows system functions*/
HWND win_handle;
void configBorderlessWindow( IplImage* cv_img )
{
cvNamedWindow("TEST");
cvMoveWindow("TEST", 0, 0);
cvShowImage("TEST", cv_img);
win_handle = FindWindow(0, L"TEST");
if (!win_handle) { printf("Failed FindWindow\n"); }
/* Setting the flags for the borderless window */
unsigned int flags = (SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE );
flags &= ~SWP_NOSIZE;
unsigned int x = 0;
unsigned int y = 0;
unsigned int w = cv_img->width;
unsigned int h = cv_img->height;
SetWindowPos(win_handle, HWND_TOPMOST, x, y, w, h, flags);
SetWindowLong(win_handle, GWL_STYLE, GetWindowLong(win_handle, GWL_EXSTYLE) | WS_EX_TOPMOST);
ShowWindow(win_handle, SW_SHOW);
//ShowWindow(win_handle, SW_MAXIMIZE); // Maximize window AK 04012019
SetActiveWindow( win_handle );
HWND setFocusHandle = SetFocus(win_handle);
//ShowCursor( FALSE );
}
int main()
{
IplImage* cv_img= cvLoadImage("android_189017-640x480.jpg");
printf("Success");
configBorderlessWindow(cv_img );
waitKey(0);
}
Continue reading...
But when I try to load an image of the size of my monitor resolution there a grey bar displayed in the bottom of my window. I assume this bar us the bottom part of my dialogue window.
How to remove this bar? My code is as follows:
#include "stdafx.h"
#include "includes.h"
using namespace cv;
/********************* PRESETS **************************/
/*configBorderlessWindow : This Function configures the opencv image display
window to
borderless using windows system functions*/
HWND win_handle;
void configBorderlessWindow( IplImage* cv_img )
{
cvNamedWindow("TEST");
cvMoveWindow("TEST", 0, 0);
cvShowImage("TEST", cv_img);
win_handle = FindWindow(0, L"TEST");
if (!win_handle) { printf("Failed FindWindow\n"); }
/* Setting the flags for the borderless window */
unsigned int flags = (SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE );
flags &= ~SWP_NOSIZE;
unsigned int x = 0;
unsigned int y = 0;
unsigned int w = cv_img->width;
unsigned int h = cv_img->height;
SetWindowPos(win_handle, HWND_TOPMOST, x, y, w, h, flags);
SetWindowLong(win_handle, GWL_STYLE, GetWindowLong(win_handle, GWL_EXSTYLE) | WS_EX_TOPMOST);
ShowWindow(win_handle, SW_SHOW);
//ShowWindow(win_handle, SW_MAXIMIZE); // Maximize window AK 04012019
SetActiveWindow( win_handle );
HWND setFocusHandle = SetFocus(win_handle);
//ShowCursor( FALSE );
}
int main()
{
IplImage* cv_img= cvLoadImage("android_189017-640x480.jpg");
printf("Success");
configBorderlessWindow(cv_img );
waitKey(0);
}
Continue reading...