problem

Discussion in 'C Programming' started by gtalk server, Mar 20, 2012.

  1. gtalk server

    gtalk server Guest

    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)
    gtalk server, Mar 20, 2012
    #1
    1. Advertising

  2. On Tue, 20 Mar 2012 07:22:22 -0700 (PDT), gtalk server
    <> wrote:

    >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.

    --
    Remove del for email
    Barry Schwarz, Mar 20, 2012
    #2
    1. Advertising

  3. Barry Schwarz <> writes:
    > On Tue, 20 Mar 2012 07:22:22 -0700 (PDT), gtalk server
    > <> wrote:
    >
    >>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.


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

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Will write code for food.
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Mar 20, 2012
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Suurkuusk
    Replies:
    0
    Views:
    3,942
    Andreas Suurkuusk
    Jul 27, 2003
  2. Ted Miller
    Replies:
    0
    Views:
    5,133
    Ted Miller
    Sep 13, 2003
  3. Merek
    Replies:
    0
    Views:
    1,937
    Merek
    Dec 3, 2003
  4. Scott Meddows
    Replies:
    1
    Views:
    375
    John Saunders
    Jun 8, 2004
  5. Mike

    Problem problem problem :( Need Help

    Mike, May 7, 2004, in forum: ASP General
    Replies:
    2
    Views:
    520
    Bullschmidt
    May 11, 2004
Loading...

Share This Page