|
-
Jul 26th, 2001, 04:23 AM
#1
Thread Starter
Hyperactive Member
Borderless Window
How do I make a borderless window. I am just passing values to the style part 'dwStyle' of the CreateWindow function. So far I have WS_OVERLAPPEDWINDOW. What else should I add to make the window Borderless?
Visual Basic 6.0 Enterprise
Visual C++ 6.0 Professional
Wak 
-
Jul 26th, 2001, 05:16 AM
#2
Thread Starter
Hyperactive Member
hmm
Ok, I got the borderless window. I used WS_POPUP for anyone that wanted to know. But how can I move my window around now that it has no title bar??
Visual Basic 6.0 Enterprise
Visual C++ 6.0 Professional
Wak 
-
Jul 27th, 2001, 04:42 AM
#3
PowerPoster
Use this when you recieve the WM_MOUSEMOVE message:
Code:
RleaseCapture();
SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION);
return 0;
-
Jul 27th, 2001, 04:57 AM
#4
Thread Starter
Hyperactive Member
cool
Thanx.
2 things though.
How does this work.
And also, how can I make it so I actually have to click on the window to trigger the free movement of the window, and not just anywhere inside windows??
Visual Basic 6.0 Enterprise
Visual C++ 6.0 Professional
Wak 
-
Jul 27th, 2001, 10:50 AM
#5
Junior Member
this should work:
when you receive WM_NCHITTEST, return HTCAPTION
Code:
case WM_NCHITTEST:
return HTCAPTION;
-
Jul 30th, 2001, 04:21 PM
#6
Lively Member
my 2 cents
This is what I would do... although I know practically nothing about graphical c++ programming.
Your window is made of of pixels... that hold X Y values.
You can get the XY values from your Mouse.
On a down_click get the values
Then they will drag the mouse around
When they release put the windows old XY location
on the new location that was taken when the user released the button.
You can even specify the XY values in the window to allow this Drag and Drop option. Note you wont get a Grey box like windows does... or the entire window wont move like in Linux. You'll have to figure that out.
I've done something like this before in VB... I did it so I could make a window that looked like an oval... not a box!
-
Jul 30th, 2001, 04:59 PM
#7
Junior Member
Brandito (and Wak, for an explanation): I know what you're talking about. I wrote something similar a while ago in VB, and about a week ago or so was trying to figure out how to do it in C.
In VB, you need to watch the position of the mouse, and then move the window accordingly because you can't readily intercept window messages (without subclassing, which can fairly compilcated).
what WM_NCHITTEST does is it's asking the program what kind of an object is below the cursor, so Windows knows how to respond.
For example, if you return HTMAXBUTTON, the Windows will think the user clicked on the Maximize button, and will hence maximize the window.
If you want the whole window to work as a caption, all you need to do is return HTCAPTION. (Note if you want a resizable window, you'll need to check if the cursor is over a border, and return the respective value, see below for all values)
Here's the MSDN listing for WM_NCHITTEST
Code:
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_NCHITTEST
WPARAM wParam, // not used
LPARAM lParam // horizontal and vertical position
);
Parameters
wParam This parameter is not used.
lParam The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen.
The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen.
Return Values
The return value of the DefWindowProc function is one of the following values, indicating the position of the cursor hot spot.
HTBORDER In the border of a window that does not have a sizing border.
HTBOTTOM In the lower-horizontal border of a resizable window (the user can click the mouse to resize the window vertically).
HTBOTTOMLEFT In the lower-left corner of a border of a resizable window (the user can click the mouse to resize the window diagonally).
HTBOTTOMRIGHT In the lower-right corner of a border of a resizable window (the user can click the mouse to resize the window diagonally).
HTCAPTION In a title bar.
HTCLIENT In a client area.
HTCLOSE In a Close button.
HTERROR On the screen background or on a dividing line between windows (same as HTNOWHERE, except that the DefWindowProc function produces a system beep to indicate an error).
HTGROWBOX In a size box (same as HTSIZE).
HTHELP In a Help button.
HTHSCROLL In a horizontal scroll bar.
HTLEFT In the left border of a resizable window (the user can click the mouse to resize the window horizontally).
HTMENU In a menu.
HTMAXBUTTON In a Maximize button.
HTMINBUTTON In a Minimize button.
HTNOWHERE On the screen background or on a dividing line between windows.
HTREDUCE In a Minimize button.
HTRIGHT In the right border of a resizable window (the user can click the mouse to resize the window horizontally).
HTSIZE In a size box (same as HTGROWBOX).
HTSYSMENU In a window menu or in a Close button in a child window.
HTTOP In the upper-horizontal border of a window.
HTTOPLEFT In the upper-left corner of a window border.
HTTOPRIGHT In the upper-right corner of a window border.
HTTRANSPARENT In a window currently covered by another window in the same thread (the message will be sent to underlying windows in the same thread until one of them returns a code that is not HTTRANSPARENT).
HTVSCROLL In the vertical scroll bar.
HTZOOM In a Maximize button.
hope all that makes sense...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|