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
P

pcname

@pcname
About
Posts
8
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to correctly pass a LPCSTR type parameter to a thread in DLL?
    P pcname

    I didn't realize that string variable was destroyed after the function creating the thread returns. Now my DLL works great. Frankie, thank you so much.

    C / C++ / MFC tutorial question

  • How to correctly pass a LPCSTR type parameter to a thread in DLL?
    P pcname

    no compiler error. when I calling the DLL from VBA, the function just cannot pass a file path to the thread. File path in thread displayed as "s", "c", etc.

    C / C++ / MFC tutorial question

  • How to correctly pass a LPCSTR type parameter to a thread in DLL?
    P pcname

    "flt" is the file path from VBA. it's "C:\Downloads\HornSound.wav." Sorry, it's my mistake. the "loct" in MessageBox should be replaced with "flt". I spent some time try to figure it out. So as I said, I added " MessageBox(NULL, flt, "Message1", NULL); " before "CloseHandle(hThread);". both messagebox can correctly display my file path "C:\Downloads\HornSound.wav." I also found if I replaced "MessageBox" with "Sleep(3000)" before "CloseHandle(hThread);" MessageBox in thread can correctly display my file path "C:\Downloads\HornSound.wav." if I add nothing and just removed "CloseHandle(hThread);", MessageBox in thread can also correctly display my file path "C:\Downloads\HornSound.wav." It seems I cannot close handle right after CreateThread. but that can cause memory leak?

    C / C++ / MFC tutorial question

  • How to correctly pass a LPCSTR type parameter to a thread in DLL?
    P pcname

    No, my function is not a Unicode function. my file path is C:\Downloads\HornSound.wav. I found if I added the following " MessageBox(NULL, loct, "Message1", NULL); " before "CloseHandle(hThread);". Both MessageBoxes (both in the function and in the thread) can correctly display the file path. But if I removed "MessageBox" in the function, then the MessageBox in the thread cannot correctly display the file path. What is the problem?

    C / C++ / MFC tutorial question

  • How to correctly pass a LPCSTR type parameter to a thread in DLL?
    P pcname

    MessageBox display is not file path, instead it showed something "s" or "c", "7". this is what I don't understand.

    C / C++ / MFC tutorial question

  • How to correctly pass a LPCSTR type parameter to a thread in DLL?
    P pcname

    I wrote a DLL with VC6.0. I want to pass a LPCSTR type parameter (file path) to a thread. Here is the code: DWORD WINAPI ThreadFunc(LPVOID lpParam) { char* fileLoct = (char*)lpParam; MessageBox(NULL, fileLoct, "Message", MB_OK | MB_ICONINFORMATION); return 0; } void __stdcall StartThread(LPCSTR flt) { HANDLE hThread; hThread = CreateThread(NULL, 0, ThreadFunc, (void *)flt, 0, NULL); CloseHandle(hThread); } I tested it with MessageBox and found the path was not correct at all. How to correctly pass a LPCSTR type parameter to a thread in DLL? Thank you.

    C / C++ / MFC tutorial question

  • Is there another ways to get file date stamp?
    P pcname

    Thanks. I used GetFileTime. But I got another problem.Following is my code: TCHAR FilePath[MAX_PATH]; TCHAR NewPath[MAX_PATH]; WIN32_FIND_DATA fd; FILETIME mtime, local; SYSTEMTIME st; sprintf(FilePath, "%s\\*.*", strpath); HANDLE hFind = FindFirstFile(FilePath, &fd); if (hFind == INVALID_HANDLE_VALUE) return; do { if (fd.cFileName[0] != '.') { if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { sprintf(NewPath, "%s\\%s", strpath, fd.cFileName); Findfiles(NewPath); } else { GetFileTime(hFind, NULL, NULL, &mtime); FileTimeToLocalFileTime( &mtime, &local ); FileTimeToSystemTime(&local, &st); CString time; time.Format("%02d/%02d/%04d", st.wMonth, st.wDay, st.wYear); AfxMessageBox(time); } } } while (FindNextFile(hFind, &fd)); FindClose(hFind); But my file last modofied time is 9/5/2006. The Time always dispalyed as 12/24/18186. what is wrong? Thanks a lot.

    C / C++ / MFC question

  • Is there another ways to get file date stamp?
    P pcname

    I used the following code to get file date time stamp. CFileFind ff; CFileStatus status; xxxxxx; xxxxxx; CString strFilePath = ff.GetFilePath(); CFile::GetStatus(strFilePath, status); CTime Ftime = status.m_mtime; Ftime is CTime object. But CTime has limit (Year <=2037 or so) is there another ways to get file date time stamp except CFile::GetStatus? Thanks

    C / C++ / MFC 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