Thread: What is It?

  1. #1
    Mitchell
    Guest

    Unhappy What is It?

    hi,buddy
    i have a problem with this question.i really don't understand what it wants? but,i just stopped coding already.i just need some help from guys out there. This where i stopped.i have posted out the code that i am half away doing it. i hope u guys can help me out. Thanks !!

    here is the question
    create a program that displays a button control on the program's client area at the location where the user clicks the right mouse button.The button must be destroyed and recreated at the cursor location every time the right mouse button is clicked.
    hope can solved it for me!!it's really make me nuts!

    #include<windows.h>

    long FAR PASCAL WndProc(HWND ,UINT, WPARAM,LPARAM);

    int PASCAL WinMain(HANDLE hInst,HANDLE hPrevInstance,LPSTR lpszCmdLine,int nCmdShow)
    {
    HWND hWnd;
    MSG msg;
    WNDCLASS wndclass;



    if(!hPrevInstance)
    {
    wndclass.style=0;
    wndclass.lpfnWndProc=(WNDPROC)WndProc;
    wndclass.cbClsExtra=0;
    wndclass.cbWndExtra=0;
    wndclass.hInstance=hInst;
    wndclass.hIcon=LoadIcon(hInst,IDI_APPLICATION);
    wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
    wndclass.hbrBackground=GetStockObject(WHITE_BRUSH) ;
    wndclass.lpszMenuName=MAKEINTRESOURCE(NULL);
    wndclass.lpszClassName="MyClass";
    if(!RegisterClass(&wndclass))
    return 0;
    }
    hWnd=CreateWindow("MyClass","Student Pre-App Form",WS_OVERLAPPEDWINDOW,10,10,300,300,NULL,NULL, hInst,NULL);
    ShowWindow(hWnd,nCmdShow);

    while(GetMessage(&msg,0,0,0))
    {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    }
    return(msg.wParam);
    }

    long FAR PASCAL WndProc(HWND hWnd ,UINT wMessage,WPARAM wParam,LPARAM lParam)
    {

  2. #2
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    I am not going to solve the problem for you, but you could try using SetWindowPos to the button's hWnd whenever a WM_MOUSEDOWN (or something like that) message comes in..

    Oskilian

Popular pages Recent additions subscribe to a feed