Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
K

Krauze

@Krauze
About
Posts
39
Topics
17
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • application messaging
    K Krauze

    I'm currently coding on a project where I need to post a user-defined message together with a LPCWSTR parameter. But I don't know how to achieve that coz you know, PostMessage() only provides parameters typed as WPARAM and LPARAM. Anyone could help? Many thx in advance.

    C / C++ / MFC help tutorial question

  • a weird behavior
    K Krauze

    Yes, they turned out to be the same. BTW, I reckon I need use wchar_t instead of TCHAR......as you said... anyways, thank you all the same

    C / C++ / MFC help question announcement learning

  • a weird behavior
    K Krauze

    I've got the following file header structure with every field ending by '\0':

    struct CF_HEADER
    {
    TCHAR strIdentifier[7]; // "XXXXXX"
    TCHAR bHasPath[2];
    TCHAR bOrder[2];
    TCHAR nTime[4];
    TCHAR nEffect[2];
    TCHAR nNum[3];
    TCHAR nPos[3];
    };

    Then I initialized a UNICODE .txt file with this header. And in the file the following can be seen by Notepad:

    XXXXXX 0 0 000 0 00 00

    Of course there're times when these data should be updated. One of these functions to update the bOrder field is like this:

    CF_HEADER m_cfhdInfo;
    CFile file;
    ... // some other functions and reading the header into m_cfhdInfo
    void SetOrder(BOOL bOrder)
    {
    _itot_s(bOrder, &m_cfhdInfo.bOrder[0], sizeof(TCHAR), 10);

    updateHeader();
    

    }
    void updateHeader()
    {
    file.Seek(2, CFile::begin); // never overwrites 0xFEFF
    file.Write(&m_cfhdInfo, sizeof(CF_HEADER));
    }

    When I called SetOrder(TRUE), things proved weird. The following data can be seen in the file by Notepad:

    XXXXXX 01 000 0 00 00

    However, I had expected the results like this:

    XXXXXX 0 1 000 0 00 00

    Anyone could help? Thanks in advance.

    C / C++ / MFC help question announcement learning

  • resizing a dialog
    K Krauze

    I'm coding with VC++ 2008 and I've got a dialog with none border. Now I wanna resize it in some other message handlers, such as BTN_CLICKED, than CDialog::InitDialog(), using CWnd::MoveWindow(). But it won't work. So anyone could help? Many thanks in advance.

    C / C++ / MFC c++ help question

  • MoveWindow()
    K Krauze

    Under what circumstances will this function not work? I mean using it to change the width of the window. I find it kinda weird that this function sometimes works but sometimes not. Anyone could help? Many thx!

    C / C++ / MFC help question

  • LPSTR or something like that
    K Krauze

    many thx

    C / C++ / MFC question

  • LPSTR or something like that
    K Krauze

    thx for your detailed example

    C / C++ / MFC question

  • LPSTR or something like that
    K Krauze

    thx a lot

    C / C++ / MFC question

  • LPSTR or something like that
    K Krauze

    void getPath(LPSTR lpszPath)
    {
    CFile file;
    char pbuf[512];
    ...
    file.Read(pbuf, size);
    // here I wanna copy the first n chars of pbuf into lpszPath
    }

    So what can I do to manage it? Maybe what has confused me is the different string data types....

    C / C++ / MFC question

  • IKnownFolder
    K Krauze

    My current project needs to be supported by IKnownFolder. But I've never programmed with this kind of interfaces. So anyone could help? I'll really appreciate it if you could give some links or codes on what files should be introduced in and how and the initialization codes. Thanks in advance.

    C / C++ / MFC help question

  • how to simultaneously show 2 dialogs
    K Krauze

    I'm now coding with VC++2008. I wanna show 2 dialogs at the same time. So how to achieve it? Thanks in advance. In fact I've tried the following:

    BOOL CDlg1::OnInitDialog()
    {
    ...
    dlg2.Create(IDD_DIALOG2, this); // where dlg2 is defined as a private CDlg2 varibale of CDlg1 in its header file
    dlg2.ShowWindow(SW_SHOW);
    ...
    }

    But this doesn't work.

    C / C++ / MFC c++ tutorial question

  • WM_PAINT [modified]
    K Krauze

    Thank y'all!

    C / C++ / MFC question

  • WM_PAINT [modified]
    K Krauze

    In fact there're up to 30,000 coordinates. So it's kinda terrible to store all of them in a particular structure at runtime.

    C / C++ / MFC question

  • WM_PAINT [modified]
    K Krauze

    I'm coding a plotting app using coordinates data saved in a .txt file. So I need access files in CDialog::OnPaint(). But it seems not to work coz I find the file pointer doesn't move though CFile::Seek() and CFile::Read() are used. Or could a while loop be in CDialog::OnPaint()?

    modified on Tuesday, September 7, 2010 10:46 PM

    C / C++ / MFC question

  • prob with coordinates
    K Krauze

    thx a lot

    C / C++ / MFC c++ graphics question

  • prob with coordinates
    K Krauze

    thx a lot!

    C / C++ / MFC c++ graphics question

  • prob with coordinates
    K Krauze

    I'm coding with VC++2008. When designing the layout of the controls in the .rc file, we can see their coordinates in the bottomright of the screen. And now I have a control with (4,30) shown there and another one with (5,156). Then I wanna draw a line between these 2 controls using the coordinates by GDI.

    pDC->MoveTo(4,30);
    pDC->LineTo(5,156);
    

    But at runtime, the line doesn't correspond to those coordinates. I mean there is a big offset from the expected position. What's wrong? Thx in advance.

    C / C++ / MFC c++ graphics question

  • how to read a file continuously using CFile
    K Krauze

    Thx a lot.

    C / C++ / MFC tutorial question

  • how to read a file continuously using CFile
    K Krauze

    yep! In fact I wanna plot a range of x- and y-coordinates onto a graph while reading them in a txt file. So I used "continuously".

    C / C++ / MFC tutorial question

  • how to read a file continuously using CFile
    K Krauze

    Personally, it'd be like the following:

    char str\[3\];
    CFile file;
    .... // other preliminary codes before reading it
    while( !EOF() )
    {
        file.Read( &str, 3 );
    }
    file.Close();
    

    But IDK how to write the codes for "!EOF()". Or any other ways to read files continuously? Thx in advance! PS: .txt files

    C / C++ / MFC tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups