jackba / wy-internal-system

Automatically exported from code.google.com/p/wy-internal-system
0 stars 0 forks source link

MFC CMenu #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

BOOL CPicturedButtonDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
//
//...
//
    m_menu.CreatePopupMenu();
    m_menu.AppendMenuW(MF_STRING, WM_MOVE, L"a");
    m_menu.AppendMenuW(MF_STRING, WM_MOVE, L"b");
    m_menu.AppendMenuW(MF_STRING, WM_MOVE, L"c");
}

void CPicturedButtonDlg::OnDestroy()
{
    CDialog::OnDestroy();

    Shell_NotifyIcon(NIM_DELETE, &notifyIconData);
    m_menu.Detach();
    m_menu.DestroyMenu();
}

void CPicturedButtonDlg::OnRButtonDown(UINT nFlags, CPoint point)
{
    ::ClientToScreen(m_hWnd, &point);
    m_menu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);

    CDialog::OnRButtonDown(nFlags, point);
}

Original issue reported on code.google.com by Giggs...@gmail.com on 23 Feb 2012 at 9:26

GoogleCodeExporter commented 9 years ago
//menu item event invoked!

    #define IDM_CHANGMENUITEM WM_USER + x
    m_menu.AppendMenuW(MF_STRING, IDM_CHANGMENUITEM, L"b");
    ON_COMMAND(IDM_CHANGMENUITEM, OnMenuItemClicked)

void CPicturedButtonDlg::OnMenuItemClicked()
{
    AfxMessageBox(L"");
}

Original comment by Giggs...@gmail.com on 23 Feb 2012 at 9:35

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi,This is Steven ,,

Original comment by rjjste...@gmail.com on 9 Mar 2013 at 1:38

GoogleCodeExporter commented 9 years ago

Original comment by Giggs...@gmail.com on 2 Jun 2013 at 1:45

Attachments:

GoogleCodeExporter commented 9 years ago
// WCLaoServerWin32.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include "Core/Network/Net.h"
#include "Core/Console/Console.h"
#include "Core/Network/Manager.h"
#include "Core/Protocol/Inc/Header.h"
#include "Core/Protocol/Protocol.h"
#include "Core/Common/Log.h"
#include "Core/Common/Leak.h"
#include "Core/MM/BufferList.h"

static const char * const CMD_LIST = "<cmd> -start -stop -exit -com -cs -ci 
-ltf -sl -esl -eltf \n";
static const char * const PRE = "\nWCLaoServer~$";

static bool ParseCommand(char *pCommand)
{
    if (strncmp(pCommand, "exit", 4) == 0)
    {
        return false;
    }
    else if (strncmp(pCommand, "cs", 2) == 0)
    {
        manager_connectionStatistics();
    }
    else if (strncmp(pCommand, "ci", 2) == 0)
    {
        manager_connectionInfo();
    }
    else if (strncmp(pCommand, "sl", 2) == 0)
    {
        if (strlen(pCommand) < 3 || *(pCommand + 2) != '-')
        {
            printf("\n Wrong parameter.\n");
        }
        else
        {
            printf("Show log...\n");
            int index = 3;
            while(*(pCommand + index) != '\n' && *(pCommand + index) == '-') ++index;

            Log_Show(USER_BEHAVIOUR, pCommand + index);
            Log_Show(MODULE_BEHAVIOUR, pCommand + index);
        }
    }
    else if (strncmp(pCommand, "esl", 3) == 0)
    {
        Leak_Show();
    }
    else if (strncmp(pCommand, "ltf", 3) == 0)
    {
        printf("Log to file...\n");
        Log_ToFile(true);
    }
    else if (strncmp(pCommand, "eltf", 4) == 0)
    {
        printf("Leak to file...\n");
        Leak_ToFile();
    }
    else if (strncmp(pCommand, "start", 5) == 0)
    {
        StartDebugConsole();

        int headerSize = 0;
        int lengthPos = 0;
        CB_FuncSendText cb = SendText;//protocol can send data
        BufferList *pblBusinessNode;
        Protocol_Init(headerSize, lengthPos, cb, pblBusinessNode);//connect to Protocol module
        CB_FuncBusinessHandler cbDispatch = (CB_FuncBusinessHandler)Protocol_Dispatcher;//network data handler
        Net_Init(headerSize, lengthPos, cbDispatch, pblBusinessNode);

        Net_StartServer();//start server
    }
    else if (strncmp(pCommand, "stop", 4) == 0)
    {
        //stop server
        Net_StopListen(); 
        Net_Fini();
        StopDebugConsole();
    }
    else if (strncmp(pCommand, "com", 7) == 0)
    { 
        printf(CMD_LIST); 
    }
    else
    {
        printf("invalid command.Type com for lists.\n");
    }
    return true;
}

int _tmain(int argc, _TCHAR* argv[])
{
    //init
    //
    Leak_Init("C:\\Giggs\\HP\\Lao\\WCLaoServerWin32\\Debug\\logs");
    if (!Log_Init("C:\\Giggs\\HP\\Lao\\WCLaoServerWin32\\Debug\\logs", 1024))
    {
        printf("Failed to initialize log module.\n");
        return -1;
    }
    //
    bool bExit = false;
    char command[20];
    //start / stop 
    printf(CMD_LIST); 
    printf(PRE);
    while (!bExit)
    {
        memset(command, 0, 20);
        scanf("%s", command);
//      printf("<cmd:%s>\n", command);
        if (!ParseCommand(command))
        {
            bExit = true;
        }
        else
        {
            printf(PRE);
        }
    }
    //fini
    //
    Log_Fini();
    Leak_Fini();

    getchar();
    getchar();

    return 0;
}

Original comment by Giggs...@gmail.com on 21 Jun 2013 at 2:28