problem

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)
 
B

Barry Schwarz

hello i have one problem this is my code

snip Windows specific code
problem in this how can i use sendmessage() fuction for send message
from main window proc(mwpm) to pop up window proc(mwpp)

Try asking in a group that discusses Windows programming.
 
K

Keith Thompson

Barry Schwarz said:
snip Windows specific code


Try asking in a group that discusses Windows programming.

Such as comp.os.ms-windows.programmer.win32.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top