Click here to Skip to main content
15,887,267 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: About Cursor Blinking : Plz Help Pin
Nishad S14-Sep-05 0:12
Nishad S14-Sep-05 0:12 
GeneralRe: About Cursor Blinking : Plz Help Pin
parims14-Sep-05 0:38
parims14-Sep-05 0:38 
Questionproblem getting imported function name Pin
gamitech13-Sep-05 23:38
gamitech13-Sep-05 23:38 
QuestionRefreshing Dialog Window(more explanation) Pin
a_david12313-Sep-05 23:38
a_david12313-Sep-05 23:38 
AnswerRe: Refreshing Dialog Window(more explanation) Pin
khan++14-Sep-05 0:09
khan++14-Sep-05 0:09 
QuestionDrag and Drop Pin
Hachaso13-Sep-05 23:32
Hachaso13-Sep-05 23:32 
QuestionProblem with FileIOCompletionRoutine ??? Pin
HumanOsc13-Sep-05 23:08
HumanOsc13-Sep-05 23:08 
AnswerRe: Problem with FileIOCompletionRoutine ??? Pin
cmk14-Sep-05 12:08
cmk14-Sep-05 12:08 
Off the top of my head (i.e. untested) do something like this:

#define  IOOP_READ     1
#define  IOOP_WRITE    2
 
#define  CK_CONTAINING_RECORD( PTR, TYP, FLD ) \
	( (TYP*)( (byte*)(PTR) - (byte*)(&((TYP*)0)->FLD) ) )
 
class  MyFile;    // forward reference
 
class  MyOL : public OVERLAPPED {
public:
    virtual  ~MyOL( void ) {
        if( Buff )  delete [] Buff;
    }
 
    MyFile  *File;
    DWORD    Op;
    DWORD    Cnt;
    char    *Buff;
 
    // go around vtable
    OVERLAPPED  Ptr( void )  { return(&Internal); }
};
 
class  MyFile {
protected:
    HANDLE  hnd;
 
    static  void CALLBACK  iocr( DWORD ERR, DWORD CNT, OVERLAPPED *OL ) {
        if( !OL )  return;
        MyOL  *ol = CK_CONTAINING_RECORD(OL, MyOL, Internal);
        ol->Cnt = CNT;
        ol->File->OnIOC(ol);
        delete ol;
    }
 
    void  onIOC( MyOL *OL ) {
        switch( OL->Op ) {
            case IOOP_READ  : ...
            case IOOP_WRITE : ...
        }
    }
 
public:
    bool  ReadEx( DWORD SZ ) {
        if( !SZ )  return(false);
        MyOL *ol = new MyOL();
        ol->Op   = IOOP_READ;
        ol->File = this;
        ol->Buff = new  char[SZ];
        return( ReadFileEx(hnd, ol->Buff, SZ, ol->Ptr(), iocr) );
    }
    bool  WriteEx( DWORD SZ, void *BUFF ) {
        if( !SZ || !BUFF )  return(false);
        MyOL *ol = new MyOL();
        ol->Op   = IOOP_WRITE;
        ol->File = this;
        ol->Buff = new  char[SZ];
        memcpy(ol->Buff, BUFF, SZ);
        return( WriteFileEx(hnd, ol->Buff, SZ, ol->Ptr(), iocr) );
    }
};


...cmk

Save the whales - collect the whole set
GeneralRe: Problem with FileIOCompletionRoutine ??? Pin
HumanOsc14-Sep-05 22:14
HumanOsc14-Sep-05 22:14 
QuestionDownload web pages Pin
Daniel Strigl13-Sep-05 22:44
Daniel Strigl13-Sep-05 22:44 
AnswerRe: Download web pages Pin
ThatsAlok13-Sep-05 23:07
ThatsAlok13-Sep-05 23:07 
QuestionPls Help how to read from windows(edit box) Pin
tejaswi-teja13-Sep-05 22:35
tejaswi-teja13-Sep-05 22:35 
AnswerRe: Pls Help how to read from windows(edit box) Pin
toxcct13-Sep-05 22:39
toxcct13-Sep-05 22:39 
GeneralRe: Pls Help how to read from windows(edit box) Pin
tejaswi-teja13-Sep-05 23:43
tejaswi-teja13-Sep-05 23:43 
GeneralRe: Pls Help how to read from windows(edit box) Pin
toxcct14-Sep-05 0:50
toxcct14-Sep-05 0:50 
JokeRe: Pls Help how to read from windows(edit box) Pin
ThatsAlok14-Sep-05 1:39
ThatsAlok14-Sep-05 1:39 
GeneralRe: Pls Help how to read from windows(edit box) Pin
toxcct14-Sep-05 1:46
toxcct14-Sep-05 1:46 
JokeRe: Pls Help how to read from windows(edit box) Pin
ThatsAlok14-Sep-05 18:05
ThatsAlok14-Sep-05 18:05 
GeneralRe: Pls Help how to read from windows(edit box) Pin
14-Sep-05 0:55
suss14-Sep-05 0:55 
GeneralRe: Pls Help how to read from windows(edit box) Pin
ThatsAlok14-Sep-05 1:39
ThatsAlok14-Sep-05 1:39 
AnswerRe: Pls Help how to read from windows(edit box) Pin
ky_rerun14-Sep-05 16:22
ky_rerun14-Sep-05 16:22 
GeneralRe: Pls Help how to read from windows(edit box) Pin
ThatsAlok14-Sep-05 17:59
ThatsAlok14-Sep-05 17:59 
QuestionVisual Studio function comments Pin
MartinWA13-Sep-05 22:28
MartinWA13-Sep-05 22:28 
AnswerRe: Visual Studio function comments Pin
Anonymous13-Sep-05 23:20
Anonymous13-Sep-05 23:20 
Questionerror LNK2001 Pin
momer13-Sep-05 22:00
momer13-Sep-05 22:00 

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

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