Click here to Skip to main content
Licence 
First Posted 16 May 2003
Views 32,106
Downloads 357
Bookmarked 11 times

A Progress-iner Message System

By kuhx1980 | 16 May 2003 | Unedited contribution
A Progress-iner Message System
14 votes, 82.4%
1
2 votes, 11.8%
2
1 vote, 5.9%
3

4

5
1.13/5 - 17 votes
1 removed
μ 1.45, σa 0.98 [?]

Introduction

When we write a program, maybe we need several modules, but how a module worked with each other? We always export some funcion, and maybe we need some callback function or virtual function deal with user input. Sometimes it is very anoying to do that, so I wrote this code for it.

Using the code

Before you using this code, you must insert all files in the path KUCMD, and include the file KuCOMMAND.h

Every class you want it can sent or get message must like this:

    class CSend
    {
        DECLARE_COMMAND(CSend)
    public:
        CSend();
    };

now, this class can get a message. and you must add this function:

    bool CPost::OnKuCmd(UINT msgID, DWORD hParam, DWORD lParam)
    {
        switch(msgID) {
        case TEST_SEND:
            ::MessageBox(NULL, (LPCSTR)hParam, "TEST_SEND", MB_OK);
            return true;
        }
        return false;
    }

Now, in any class that like CPost, you can send message TEST_SEND by this code

    KUMSG msg;
    msg.msgID = TEST_SEND;
    msg.hParam = (DWORD)(LPCSTR)strMessage;
    SendCmd(msg);

The sent message will return when it has be deal or

    KUMSG msg;
    msg.msgID = TEST_POST;
    msg.hParam = (DWORD)(LPCSTR)strMessage;
    SendCmd(msg);

To post the message. post message will return immediately. The message could define in KuCOMMAND.h, like this:

    // ============================================================
    #define TEST_SEND        0x01        
    #define TEST_POST        0x02        

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

kuhx1980

Web Developer

China China

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralI got it Pinmemberdharani4:07 2 Sep '04  
Generalsorry Pinmemberkuhx19807:04 17 May '03  
GeneralRe: sorry Pinmemberdog_spawn6:49 18 May '03  
GeneralRe: sorry Pinmemberkuhx198016:09 18 May '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120209.1 | Last Updated 17 May 2003
Article Copyright 2003 by kuhx1980
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid