RE: Button pops up!
Hi John,
Okay, I will start to strip off some code and try to bring it down to bare
bones.
I must be something so unsignificant !
But that's okay.... If I still don't see it, I will post a watered down and
compiable version of the problem!
You have yorself a nice..... and thanks for your feed back!
Later!
--
Best regards
Robert
"Robby" wrote:
Hello,
The weirdest thing and I don't know how I will explain this! None the less I
will try!
I have three (3) windows, and therefore it means I have 3 winProc's.
The first window is the main window with two(2) buttons which each open
their respective window. So, button#1 opens window #2 and button #2 opens
window #3. (Window#1 is the main window with the two buttons!)
So when I open the 2nd window by clicking on the first button, you do agree
that some space on the second window is right above some buttons of the main
window right underneath.... right! (lets call this space "space X"). So space
X is the space that is on my second window where it aligns directly with the
space containing a button on the opened main window right behind it.
If I click on space X in the 2nd window, nothing happens and that's what we
all expect right!
However, when I open the 3rd window and click on some of its space X, well,
the button from the underneath window, pops up in the top window currently
open. ???
I unfortunately have done a huge re-structuring of my code and obviously,
there is something I left out!
Does anyone have any I deas of what could be going on !
I cannot really post the whole program, but I can post some fragments of
code that are directly related to the window#3 stipulated above:
============================================Main
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInnstance,
PSTR szCmdLine, int iCmdShow)
{
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
wndclass.style = CS_HREDRAW |CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szMW_ClassName;
RegisterClass (&wndclass);
///////////////////////////////////////////////////////////////////////
//-CHILD WINDOW #1 //
//////////////////////////
wndclass.lpfnWndProc = WndProc_CW1;
wndclass.hIcon = LoadIcon (NULL, IDI_EXCLAMATION);
wndclass.hIcon = NULL;
wndclass.lpszClassName = szCW1_ClassName;
RegisterClass(&wndclass); //(RS232 Interface)
///////////////////////////////////////////////////////////////////////
//-CHILD WINDOW #2 //
//////////////////////////
//-CONFIGURATION
wndclass.lpfnWndProc = WndProc_CW2;
wndclass.hIcon = LoadIcon (NULL, IDI_EXCLAMATION);
wndclass.hIcon = NULL;
wndclass.lpszClassName = szCW2_ClassName;
RegisterClass(&wndclass); //Programming GUI
//CREATE MAIN WINDOW
hwnd = CreateWindow (szMW_ClassName,szMW_Name,
WS_OVERLAPPEDWINDOW ,
20, 20, 750, 550,NULL,NULL, hInstance, NULL);
ShowWindow(hwnd, iCmdShow);
UpdateWindow (hwnd);
while (GetMessage (&msg, NULL, 0, 0)) //Window's queue loop
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
====================================================
//Next is the cpp file that opens Window #3
======================================WinProc
... other code ...
case WM_COMMAND:
//IF EXIT BUTTON CLICKED THEN EXIT APPLICATION
if (LOWORD(wParam) == WindowButtons[0].MW_btC_ID)
{
DestroyWindow(hwnd); //End application
}
//CREATE CHILD WINDOW #3 WHEN BUTTON #2 PRESSED
else if (LOWORD(wParam) == WindowButtons[2].MW_btC_ID)
hdCWdws[2] = CreateWindow(
szCW2_ClassName,szCW2_Name,
WS_CHILD | WS_CAPTION | WS_SYSMENU,
10, 10, 700, 450,hwnd,(HMENU)CW2_ID,
(HINSTANCE) GetWindowLong(hwnd,GWL_HINSTANCE),NULL);
//SHOW CHILD WINDOW #3
ShowWindow(hdCWdws[2],SW_SHOW);
... othe r code...
==================================================
All ideas appreciated!
--
Best regards
Robert