|
-
Dec 4th, 2001, 12:19 PM
#1
Thread Starter
Addicted Member
&^%$@@!&%$@, fik dich, help [resolved thanks]
ok win32
i am trying to make a window with no title bar and maximize it so i can draw on it and bitblt with the gdi but i can't get rid of the title bar also i want to leave the application if the window is dblclked and that doesn't seem to want to work
i have read and reread the msdn on WM_KEYDOWN & WM_SYSKEYDOWN & WM_*BUTTON* .... help
Code:
#include <string.h>
#include <windows.h>
/* --------------------------- *** Function Prototypes *** -------------------------------- */
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
);
BOOL initBoard(
HINSTANCE hInstance // hInstance of the application
);
BOOL createBoard(
HINSTANCE hInstance, // hInstance of the application
int nCmdShow // show state
);
LRESULT CALLBACK wndProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
/* ------------------------------------------------------------------------------------------ */
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow){
MSG wMsg;
BOOL bRet;
bRet = initBoard(hInstance); // intialize rBoard001 class
/* Check to see that class intialized properly */
if(bRet == false){
return 0; // if it did not end application
}else{
bRet = createBoard(hInstance, nCmdShow); /* if class intialized attempt to create an instance
if the lass fails to create exit application */
if(bRet == false){
return 0;
}
}
// Setup Msg loop
while(GetMessage(&wMsg, NULL, 0, 0)){
TranslateMessage(&wMsg);
DispatchMessage( &wMsg );
}
return wMsg.wParam;
} // End WinMain();
BOOL initBoard(HINSTANCE hInstance){
WNDCLASSEX mCls;
HBRUSH hBrush;
hBrush = CreateSolidBrush(RGB(0,0,0));
// Fill in the window class structure with parameters
// that describe the main window.
mCls.cbSize = sizeof(mCls);
mCls.style = NULL; // redraw if size changes
mCls.lpfnWndProc = wndProc; // points to window procedure
mCls.cbClsExtra = 0; // no extra class memory
mCls.cbWndExtra = 0; // no extra window memory
mCls.hInstance = hInstance; // handle to instance
mCls.hIcon = NULL; // predefined app. icon
mCls.hCursor = NULL; // predefined arrow
mCls.hbrBackground = hBrush; // default background color
mCls.lpszMenuName = 0; // no menu resource
mCls.lpszClassName = "rBoard001"; // name of window class
mCls.hIconSm = NULL; // load the title bar icon
// Register the window class.
return RegisterClassEx(&mCls);
} // End initBoard();
BOOL createBoard(HINSTANCE hInstance, int nCmdShow){
HWND hWnd;
// Create the main window.
hWnd = CreateWindowEx(
WS_EX_TOPMOST| WS_EX_LEFT,
"rBoard001", // name of window class
NULL, // title-bar string
WS_DLGFRAME , // top-level window
CW_USEDEFAULT, // default horizontal position
CW_USEDEFAULT, // default vertical position
CW_USEDEFAULT, // default width
CW_USEDEFAULT, // default height
(HWND) NULL, // no owner window
(HMENU) NULL, // use class menu
hInstance, // handle to application instance
(LPVOID) NULL); // no window-creation data
if (!hWnd)
return false;
// Show the window and send a WM_PAINT message to the window
// procedure.
ShowWindow(hWnd, SW_SHOW|SW_MAXIMIZE);
UpdateWindow(hWnd);
return true;
} // End createBoard();
LRESULT CALLBACK wndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
switch(uMsg){
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
return 0;
case WM_RBUTTONDBLCLK:
DestroyWindow(hwnd);
case WM_DESTROY:
PostQuitMessage(0);
break;
default: // If I don't use it let windows handle it
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}
Last edited by ZanM; Dec 5th, 2001 at 12:41 PM.
Magiaus
Visual Basic 6.0 SP5
Visual C++ 6.0 SP5
The only sovereign you can allow to rule you is reason.
-
Dec 4th, 2001, 04:16 PM
#2
PowerPoster
Try "WS_POPUP" as the style of the window if you want it to have no titlebar.
You receive a "WM_LBUTTONDBCLK" message when the window is double clicked with the left mouse button, and "WM_RBUTTONDBCLK" when the window is double clicked with the right mouse button.
-
Dec 4th, 2001, 04:40 PM
#3
You also have to specify that the window is able to recieve double clicks at creation. Check the WNDCLASSEX, or the CreateWindowEx Documentation for more info.
Z.
-
Dec 5th, 2001, 10:56 AM
#4
WNDCLASS wc;
wc.style = CS_DBLCLKS | CS:HREDRAW | CS_VREDRAW;
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 5th, 2001, 12:16 PM
#5
Thread Starter
Addicted Member
cool
ok now i have a window that has no caption is topmost and recieves dblclk msgs, cool
question though the window displays the waiting cursor is there a reason for that and is there a way i can remove the window from the taskbar..?
here is my WNDCLASSEX and createWindowEx as they are now
Code:
BOOL initBoard(HINSTANCE hInstance){
WNDCLASSEX mCls;
HBRUSH hBrush;
hBrush = CreateSolidBrush(RGB(0,0,0));
// Fill in the window class structure with parameters
// that describe the main window.
mCls.cbSize = sizeof(mCls);
mCls.style = CS_OWNDC | CS_DBLCLKS; // redraw if size changes
mCls.lpfnWndProc = wndProc; // points to window procedure
mCls.cbClsExtra = 0; // no extra class memory
mCls.cbWndExtra = 0; // no extra window memory
mCls.hInstance = hInstance; // handle to instance
mCls.hIcon = NULL; // predefined app. icon
mCls.hCursor = NULL; // predefined arrow
mCls.hbrBackground = hBrush; // default background color
mCls.lpszMenuName = 0; // no menu resource
mCls.lpszClassName = "rBoard001"; // name of window class
mCls.hIconSm = NULL; // load the title bar icon
// Register the window class.
return RegisterClassEx(&mCls);
} // End initBoard();
BOOL createBoard(HINSTANCE hInstance, int nCmdShow){
HWND hWnd;
// Create the main window.
hWnd = CreateWindowEx(
WS_EX_TOPMOST,
"rBoard001", // name of window class
NULL, // title-bar string
WS_POPUP | WS_MAXIMIZE, // top-level window
0, // default horizontal position
0, // default vertical position
640, // default width
480, // default height
(HWND) NULL, // no owner window
(HMENU) NULL, // use class menu
hInstance, // handle to application instance
(LPVOID) NULL); // no window-creation data
if (!hWnd)
return false;
// Show the window and send a WM_PAINT message to the window
// procedure.
ShowWindow(hWnd, SW_SHOW);//|SW_MAXIMIZE
UpdateWindow(hWnd);
return true;
} // End createBoard();
Magiaus
Visual Basic 6.0 SP5
Visual C++ 6.0 SP5
The only sovereign you can allow to rule you is reason.
-
Dec 5th, 2001, 12:36 PM
#6
PowerPoster
To display the normal cursor, change this line:
mCls.hCursor = NULL;
to
mCls.hCursor = LoadCursor(NULL,IDC_ARROW);
-
Dec 5th, 2001, 12:40 PM
#7
Thread Starter
Addicted Member
thanks
this is only my second windows app so i am still learning the window class setup and creation ins and outs
thanks guys
Magiaus
Visual Basic 6.0 SP5
Visual C++ 6.0 SP5
The only sovereign you can allow to rule you is reason.
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
|