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
Z

zengkun100

@zengkun100
About
Posts
76
Topics
17
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to open a file with UNICODE filename on Windows?
    Z zengkun100

    Thanks for your reply again :) We have called our partner this afternoon.

    A Chinese VC++ programmer

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

  • How to open a file with UNICODE filename on Windows?
    Z zengkun100

    Richard MacCutchan wrote:

    Only by changing its source code. You will have to go to the suppliers of the library to get it changed if you do not have the source.

    I think so. In theory, char* cant only be used to point to a UTF8 UNICODE string, however, you cannot give a UTF8 filename to fopen or some other file functions. But if I transfer this UNICODE filename to char* using CP_ACP, some of the characters cannot be changed.

    A Chinese VC++ programmer

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

  • How to open a file with UNICODE filename on Windows?
    Z zengkun100

    Fareed Rizkalla wrote:

    If your app is UNICODE! Their is a function to change UNICODE string to CHAR! wcstombs[^] But I guess that won't fix it either if your filenames are in UNICODE.

    Yes, even if I transferred the UNICODE filename to a char*(using CP_ACP or CP_UTF8), the 3rd lib don't accept this filename and returns a "file not found" error code.

    A Chinese VC++ programmer

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

  • How to open a file with UNICODE filename on Windows?
    Z zengkun100

    There is a 3rd lib only accept char* filename e.g.

    3rdlib_func_name(char* file_name)

    . Every things get wrong when I provide a filename in Chinese or Japanese. Is there any way to make this lib open UNICODE filename? The program is running on Windows. Thanks for your reply.

    A Chinese VC++ programmer

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

  • Windows Live Skydrive Rocks!
    Z zengkun100

    So, are you Chinese or Iranian? :-D Just a joke, easy plz:)

    A Chinese VC++ programmer

    The Lounge

  • How much coffee or tea do you drink per day?
    Z zengkun100

    4 cups of tea per day, no coffee.

    A Chinese VC++ programmer

    The Lounge com question

  • How to enumerates media types on a given pin
    Z zengkun100

    Thank you Iain. ;) As I commentted in the code, everything looks finely.The filter can be created; the pins can be enumerated; and the direction of the pins can be queried too, but when it comes to the media types of a given pin, IEnumMediaTypes::Next always returns S_FALSE. So I can't numerates media types on a given pin.

    A Chinese VC++ programmer

    C / C++ / MFC c++ help tutorial announcement

  • How to enumerates media types on a given pin
    Z zengkun100

    I want to enumerates ac3filter's preferred media types, I suppose this process should be very easy, but I can't get this work. PLZ help!

    int _tmain(int argc, _TCHAR* argv[])
    {
    CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    CLSID clsid;
    //ac3filter's clsid
    ::CLSIDFromString(_T("{A753A1EC-973E-4718-AF8E-A3F554D45C44}"), &clsid);
    IBaseFilter* pFilter = NULL;
    HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IBaseFilter), (void **)&pFilter);
    IEnumPins* pEnumPins = NULL;
    hr = pFilter->EnumPins(&pEnumPins);
    if (SUCCEEDED(hr))
    {
    IPin* pPin = NULL;
    while (pEnumPins->Next(1, &pPin, NULL) == S_OK)
    {
    PIN_DIRECTION pinDir;
    //the pin direction can be queried
    pPin->QueryDirection(&pinDir);
    IEnumMediaTypes* pEnumMediaTypes = NULL;
    HRESULT hr = pPin->EnumMediaTypes(&pEnumMediaTypes);
    if (SUCCEEDED(hr))
    {
    AM_MEDIA_TYPE* pMediaType = NULL;
    //hr always S_FALSE, so the media type can not acquired
    hr = pEnumMediaTypes->Next(1, &pMediaType, NULL);
    pEnumMediaTypes->Release();
    }
    pPin->Release();
    }
    pEnumPins->Release();
    }
    return 0;
    }

    A Chinese VC++ programmer

    C / C++ / MFC c++ help tutorial announcement

  • Is this a bug of VC2005?
    Z zengkun100

    Thank you! :-D

    A Chinese VC++ programmer

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

  • Is this a bug of VC2005?
    Z zengkun100

    Naveen wrote:

    #undef max

    Maybe you are right! When I choose the "Go To Definition" menu item in the context menu, the ide open "windef.h", not STL's limit. It does work when I undef max. :laugh:

    A Chinese VC++ programmer

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

  • Is this a bug of VC2005?
    Z zengkun100

    sorry, I mean std::numeric_limits::max(); the "" part was ripped. A Chinese VC++ programmer

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

  • Is this a bug of VC2005?
    Z zengkun100

    int nmaxint = std::numeric_limits::max();

    this line generates two compile errors when I built in vs2005 sp1. error C2589: '(' : illegal token on right side of '::' error C2059: syntax error : '::' I don't think there are something wrong in this line. PLZ help :)

    A Chinese VC++ programmer

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

  • How to create an XML document dynamically using MSXML?
    Z zengkun100

    How to created a well-formatted xml document like this using MSXML(I'm using MSXML6)? <?xml version="1.0" encoding="utf-8"?> <!--there are some comments--> <root> <node1>...</node1> </root> I found no way to add a CRLF after the ProcessInstruction and the first comment, but I do know how to add a CRLF in root node——Just createTextNode and add to the root element. So my program will always create a xml document like this <?xml version="1.0" encoding="utf-8"?><!--there are some comments--><root> <node1>...</node1> </root> Please help. Thanks :)

    A Chinese VC++ programmer

    C / C++ / MFC c++ xml help tutorial question

  • OnInitDialog giving debug assertion failure
    Z zengkun100

    I think reinstall your vc or repair may work :-D

    A Chinese VC++ programmer

    C / C++ / MFC debugging help

  • A quesion about Asynchronous Device I/O
    Z zengkun100

    I blindly believe that if FILE_FLAG_OVERLAPPED flag was set, then all the i/o operation will be processed asynchronously, but it seems that not quite right. Thank you! :)

    A Chinese VC++ programmer

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

  • A quesion about Asynchronous Device I/O
    Z zengkun100

    Thank you! I'll read this article :)

    A Chinese VC++ programmer

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

  • A quesion about Asynchronous Device I/O
    Z zengkun100

    Hello, this is a very simple program to test asynchronous device io. But when this program runs on Vista, io is always asynchronous; when it is XP, io is always synchronous. I don't know why? Does Vista's io more efficient than XP? Thank you! :)

    int _tmain(int argc, _TCHAR* argv[])
    {
    HANDLE g_hIOCP = ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
    if (g_hIOCP == NULL)
    {
    cout<<"can not create io completion port"<<endl;
    return 1;
    }
    // open file with FILE_FLAG_OVERLAPPED flag to ensure that io is asynchronous
    HANDLE hFile = CreateFile(L"d:\\test.abc", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
    if (hFile == NULL)
    {
    cout<<"can not open file"<<endl;
    }
    HANDLE hTest = ::CreateIoCompletionPort(hFile, g_hIOCP, (ULONG_PTR)hFile, 0);
    if (hTest != g_hIOCP)
    {
    cout<<"failed to associate file to completion port"<<GetLastError()<<endl;
    return 0;
    }
    for(int i = 0; i < 5; ++i)
    {
    OVERLAPPED ov = {0};
    char szBuf[128];
    DWORD lpNumberOfBytesRead = 0;
    BOOL b = ::ReadFile(hFile, szBuf, 128, &lpNumberOfBytesRead, &ov);
    // when run on Windows Vista, ReadFile always returns FALSE, and GetLastError returns ERROR_IO_PENDING
    if (b == FALSE)
    {
    cout<<"ReadFile failed,last error code is:"<<::GetLastError()<<endl;
    if (::GetLastError() == ERROR_IO_PENDING)
    {
    cout<<"read file asynchronously"<<endl;
    }
    }
    // when run on Windows XP, ReadFile always returns TRUE
    else
    {
    cout<<"read file synchronously"<<lpNumberOfBytesRead<<"bytes"<<endl;
    }
    }
    return 0;
    }

    A Chinese VC++ programmer

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

  • Strange problem about IOCP
    Z zengkun100

    The same file is opened in 3 threads with FILE_FLAG_OVERLAPPED, then these 3 file handles associated to the same i/o completion port respectively. In each thread, ReadFile was called in overlapped mode(the lpOverlapped parameter is not NULL). It is strange that in WinXP, these ReadFile always return TRUE, means they complete synchronously, but in Vista, these ReadFile always return FALSE,and GetLastError returns ERROR_IO_PENDING. Can I get these ReadFile asynchronously in XP? Thanks :-D

    A Chinese VC++ programmer

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

  • Hello, Gurus, I need your suggestion about VC and BCB.
    Z zengkun100

    Thank you! :) Yes, I learned that different compilers will generate different binary even if they compile the same c++ class. So I object to mix IDE.

    A Chinese VC++ programmer

    C / C++ / MFC c++ delphi design business collaboration

  • Hello, Gurus, I need your suggestion about VC and BCB.
    Z zengkun100

    These days, our team will launch a new project. one of our team members suggested that we should use Borland's C++ builder to write the UI(because it's easier than VC), and Visual C++ to implement business logic code. I'am not sure whether this is a reasonable suggestion. I always think those two compilers will generate different C++ object layout in memory , so they can't work together. Want your ideas, very urgent. Plz :)

    A Chinese VC++ programmer

    C / C++ / MFC c++ delphi design business collaboration
  • Login

  • Don't have an account? Register

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