Click here to Skip to main content
15,916,835 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: 16bit & 32bit Portability issues Pin
David Crow11-Jul-05 3:51
David Crow11-Jul-05 3:51 
GeneralNotification on CPU frequency change in SpeedStep Pin
Vitaly Kashkarov10-Jul-05 19:09
Vitaly Kashkarov10-Jul-05 19:09 
GeneralDirectSound Question Pin
Mark Keeling10-Jul-05 17:58
Mark Keeling10-Jul-05 17:58 
GeneralRe: DirectSound Question Pin
Trollslayer10-Jul-05 22:15
mentorTrollslayer10-Jul-05 22:15 
GeneralRe: DirectSound Question Pin
Mark Keeling12-Jul-05 13:56
Mark Keeling12-Jul-05 13:56 
GeneralRe: How to insert a record into table in the oracle Pin
Christian Graus10-Jul-05 17:35
protectorChristian Graus10-Jul-05 17:35 
QuestionHow to put a button on the main window Pin
shfinfrock10-Jul-05 15:14
shfinfrock10-Jul-05 15:14 
AnswerRe: How to put a button on the main window Pin
Jose Lamas Rios10-Jul-05 16:26
Jose Lamas Rios10-Jul-05 16:26 
shfinfrock wrote:
I am trying to put a button on the main window of a simple SDI project. The button appears ok but it doesn't respond to the mouse. I am declaring the button in the CMainFrame class and creating it in OnCreate (see below). The same code works fine for a dialog but not for the main window.

[...]

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...
m_wndPushButton.Create(_T("test"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rect, this, 1);


In an SDI app, you'll always have a CView covering the entire client area. You see the button in the screen, because the view is painted before the button. However, the button is actually behind the view in the z-order, so it's not receiving any mouse message.

If you add the WS_CLIPSIBLINGS style to the button, you won't even see it. If you add the following line after the button creation, you'll see it and it will start receiving (and reacting to) mouse messages:

m_wndPushButton.SetWindowPos(&wndTop, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);

However, you should note this button will actually overlap with the view, obscuring some part of it. I'm not sure if that's what you want... Consider placing the button in a toolbar or dialog bar so that it doesn't overlap with the view.



--
jlr
http://jlamas.blogspot.com/[^]
Generalsend a GET, POST request to a HTTPS server Pin
surfman1910-Jul-05 10:22
surfman1910-Jul-05 10:22 
GeneralRe: send a GET, POST request to a HTTPS server Pin
Andrew Kirillov10-Jul-05 20:25
Andrew Kirillov10-Jul-05 20:25 
GeneralRe: send a GET, POST request to a HTTPS server Pin
surfman1917-Jul-05 4:55
surfman1917-Jul-05 4:55 
Generalerror code Pin
locoone10-Jul-05 3:07
locoone10-Jul-05 3:07 
GeneralRe: error code Pin
Gary R. Wheeler10-Jul-05 3:17
Gary R. Wheeler10-Jul-05 3:17 
GeneralRe: error code Pin
Alexander M.,10-Jul-05 3:21
Alexander M.,10-Jul-05 3:21 
GeneralException Handling. Pin
jerry1211a10-Jul-05 3:06
jerry1211a10-Jul-05 3:06 
GeneralRe: Exception Handling. Pin
jerry1211a10-Jul-05 3:10
jerry1211a10-Jul-05 3:10 
GeneralRe: Exception Handling. Pin
S. Senthil Kumar10-Jul-05 3:43
S. Senthil Kumar10-Jul-05 3:43 
GeneralRe: Exception Handling. Pin
jerry1211a10-Jul-05 3:59
jerry1211a10-Jul-05 3:59 
GeneralRe: Exception Handling. Pin
Nemanja Trifunovic10-Jul-05 16:44
Nemanja Trifunovic10-Jul-05 16:44 
Generaltiling dialogs(urgent) Pin
sayup10-Jul-05 1:08
sayup10-Jul-05 1:08 
GeneralRe: tiling dialogs(urgent) Pin
Gary R. Wheeler10-Jul-05 5:26
Gary R. Wheeler10-Jul-05 5:26 
Generaldirectshow:question about deadlock... Pin
stephen_young9-Jul-05 19:00
stephen_young9-Jul-05 19:00 
GeneralRe: directshow:question about deadlock... Pin
Alexander M.,10-Jul-05 3:20
Alexander M.,10-Jul-05 3:20 
GeneralRe: directshow:question about deadlock... Pin
stephen_young10-Jul-05 15:01
stephen_young10-Jul-05 15:01 
GeneralRe: directshow:question about deadlock... Pin
Toby Opferman10-Jul-05 17:05
Toby Opferman10-Jul-05 17:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.