G
gtalk server
hello i have one problem this is my code
//
#include<windows.h>
#define WM_DRAWL (WM_USER+11)
LRESULT CALLBACK mwpm(HWND hwnd,UINT message,WPARAM wparam,LPARAM
lparam)
{
switch(message)
{
case WM_COMMAND:
{
WORD id,nid;
HWND hwndp;
id = LOWORD(wparam);
nid = HIWORD(wparam);
if (nid == BN_CLICKED)
{
switch(id)
{
case 1:
{
SendMessage(hwndp,WM_DRAWL,1,0);
break;
}
case 2:
{
MessageBox(hwnd,"CIRCLE","WINDOW",MB_OK);
break;
}
case 3:
{
MessageBox(hwnd,"MESSAGE","WINDOW",MB_OK);
break;
}
}
}
}
default:
{
return DefWindowProc(hwnd,message,wparam,lparam);
}
}
}
LRESULT CALLBACK mwpp(HWND hwnd,UINT message,WPARAM wparam,LPARAM
lparam)
{
switch(message)
{
case WM_DRAWL:
{
switch(wparam)
{
HDC hdc;
case 1:
{
hdc = GetDC(hwnd);
TextOut(hdc,0,0,"RECTANGLE",9);
ReleaseDC(hwnd,hdc);
break;
}
}
}
case WM_RBUTTONDOWN:
{
MessageBeep(0xFFFFFFFF);
DestroyWindow(hwnd);
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
default:
{
return DefWindowProc(hwnd,message,wparam,lparam);
}
}
}
int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hprvinstance,LPSTR
cmdtail,int cmdline)
{
WNDCLASS wc;
ATOM clsatom;
HWND hwndm,hwndp;
MSG msg;
wc.style = 0;
wc.lpfnWndProc = mwpm;
wc.cbClsExtra = wc.cbWndExtra = 0;
wc.hInstance = hinstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL,IDC_UPARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = "mwcm";
clsatom = RegisterClass(&wc);
if (!clsatom)
{
MessageBox(NULL,"CLS NOT REGISTER","CAUTION",MB_OK);
}
hwndm = CreateWindow("mwcm","WINDOW MAIN",WS_OVERLAPPEDWINDOW |
WS_VISIBLE,100,100,400,400,NULL,NULL,hinstance,NULL);
if (!hwndm)
{
MessageBox(NULL,"WND NOT CREATED","CAUTION",MB_OK);
}
wc.style = 0;
wc.lpfnWndProc = mwpp;
wc.cbClsExtra = wc.cbWndExtra = 0;
wc.hInstance = hinstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL,IDC_HELP);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = "mwcp";
clsatom = RegisterClass(&wc);
if (!clsatom)
{
MessageBox(NULL,"CLSP NOT REGISTER","CAUTION",MB_OK);
}
hwndp = CreateWindow("mwcp","WINDOW POP",WS_POPUPWINDOW |
WS_VISIBLE | WS_CAPTION,
300,300,300,300,hwndm,NULL,hinstance,NULL);
if (!hwndm)
{
MessageBox(NULL,"WNDP NOT CREATED","CAUTION",MB_OK);
}
CreateWindow("BUTTON","RECT",WS_CHILD | WS_VISIBLE,10,10,50,25,hwndm,
1,hinstance,NULL);
CreateWindow("BUTTON","CIRC",WS_CHILD | WS_VISIBLE,10,50,50,25,hwndm,
2,hinstance,NULL);
CreateWindow("BUTTON","MSGE",WS_CHILD | WS_VISIBLE,10,90,50,25,hwndm,
3,hinstance,NULL);
CreateWindow("EDIT","MESSAGE",WS_CHILD | WS_VISIBLE | ES_LOWERCASE,
10,130,200,25,hwndm,4,hinstance,NULL);
while(GetMessage(&msg,NULL,0,0) > 0)
{
DispatchMessage(&msg);
}
return 0;
}
//
problem in this how can i use sendmessage() fuction for send message
from main window proc(mwpm) to pop up window proc(mwpp)
//
#include<windows.h>
#define WM_DRAWL (WM_USER+11)
LRESULT CALLBACK mwpm(HWND hwnd,UINT message,WPARAM wparam,LPARAM
lparam)
{
switch(message)
{
case WM_COMMAND:
{
WORD id,nid;
HWND hwndp;
id = LOWORD(wparam);
nid = HIWORD(wparam);
if (nid == BN_CLICKED)
{
switch(id)
{
case 1:
{
SendMessage(hwndp,WM_DRAWL,1,0);
break;
}
case 2:
{
MessageBox(hwnd,"CIRCLE","WINDOW",MB_OK);
break;
}
case 3:
{
MessageBox(hwnd,"MESSAGE","WINDOW",MB_OK);
break;
}
}
}
}
default:
{
return DefWindowProc(hwnd,message,wparam,lparam);
}
}
}
LRESULT CALLBACK mwpp(HWND hwnd,UINT message,WPARAM wparam,LPARAM
lparam)
{
switch(message)
{
case WM_DRAWL:
{
switch(wparam)
{
HDC hdc;
case 1:
{
hdc = GetDC(hwnd);
TextOut(hdc,0,0,"RECTANGLE",9);
ReleaseDC(hwnd,hdc);
break;
}
}
}
case WM_RBUTTONDOWN:
{
MessageBeep(0xFFFFFFFF);
DestroyWindow(hwnd);
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
default:
{
return DefWindowProc(hwnd,message,wparam,lparam);
}
}
}
int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hprvinstance,LPSTR
cmdtail,int cmdline)
{
WNDCLASS wc;
ATOM clsatom;
HWND hwndm,hwndp;
MSG msg;
wc.style = 0;
wc.lpfnWndProc = mwpm;
wc.cbClsExtra = wc.cbWndExtra = 0;
wc.hInstance = hinstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL,IDC_UPARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = "mwcm";
clsatom = RegisterClass(&wc);
if (!clsatom)
{
MessageBox(NULL,"CLS NOT REGISTER","CAUTION",MB_OK);
}
hwndm = CreateWindow("mwcm","WINDOW MAIN",WS_OVERLAPPEDWINDOW |
WS_VISIBLE,100,100,400,400,NULL,NULL,hinstance,NULL);
if (!hwndm)
{
MessageBox(NULL,"WND NOT CREATED","CAUTION",MB_OK);
}
wc.style = 0;
wc.lpfnWndProc = mwpp;
wc.cbClsExtra = wc.cbWndExtra = 0;
wc.hInstance = hinstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL,IDC_HELP);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = "mwcp";
clsatom = RegisterClass(&wc);
if (!clsatom)
{
MessageBox(NULL,"CLSP NOT REGISTER","CAUTION",MB_OK);
}
hwndp = CreateWindow("mwcp","WINDOW POP",WS_POPUPWINDOW |
WS_VISIBLE | WS_CAPTION,
300,300,300,300,hwndm,NULL,hinstance,NULL);
if (!hwndm)
{
MessageBox(NULL,"WNDP NOT CREATED","CAUTION",MB_OK);
}
CreateWindow("BUTTON","RECT",WS_CHILD | WS_VISIBLE,10,10,50,25,hwndm,
1,hinstance,NULL);
CreateWindow("BUTTON","CIRC",WS_CHILD | WS_VISIBLE,10,50,50,25,hwndm,
2,hinstance,NULL);
CreateWindow("BUTTON","MSGE",WS_CHILD | WS_VISIBLE,10,90,50,25,hwndm,
3,hinstance,NULL);
CreateWindow("EDIT","MESSAGE",WS_CHILD | WS_VISIBLE | ES_LOWERCASE,
10,130,200,25,hwndm,4,hinstance,NULL);
while(GetMessage(&msg,NULL,0,0) > 0)
{
DispatchMessage(&msg);
}
return 0;
}
//
problem in this how can i use sendmessage() fuction for send message
from main window proc(mwpm) to pop up window proc(mwpp)