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
S

sw thi

@sw thi
About
Posts
87
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • It is Friday!
    S sw thi

    I'm going to Hyderabad (AP, India), to meet my brother and his family. ill also meet a friend of mine and do some shopping.

    The Lounge question com learning

  • How to create new folder in VC++ MFC?
    S sw thi

    http://msdn2.microsoft.com/en-us/library/aa365522.aspx there you go.

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

  • We're 8!
    S sw thi

    Congrats Chris! it's an amazing site helping a lot of people around the world. I've come here lot of times to seek answers and was never disappointed. Great site Great Job done. We all appreciate your efforts. Hope this goes on for many more years. Congrats once again. :-)

    The Lounge c++ php com sysadmin linux

  • Any alternative for IsBadReadPtr / IsBadWritePtr
    S sw thi

    I'll look forward to that article. We are not doing anything special with that ptr. just check for that pointer and then if its valid then call one more member from that ptr. i gave a full explanation in reply to cedric moonen's message above yours. Thanks for your reply.

    C / C++ / MFC help question

  • Any alternative for IsBadReadPtr / IsBadWritePtr
    S sw thi

    Thanks for your reply. here is why i think i need to check for bad ptr: theres this function in a class that would return a pointer. something like this CMyWnd *GetMyWnd(){ return m_myWnd}; now when this object is destroyed m_myWnd is delete and the pointer is set to NULL, but after the object is destroyed in someother function somewhere this function is again called then GetMyWnd retunrs a CMyWnd* with a junk value. when this pointer is set to NULL in the destructor, it should return NULL but it doesnt, it returns something like 0xcdcdcdcd in the calling function say we do something like this GetMyWnd()->SetSomeFunc(); // the application crashes here, in VS2005 where as in 2003 it works fine. this happens because the pointer that GetMyWnd returns is not a valid pointer and once it tries to acces any member of CMyWnd the application crashes. i've changed the above statement to something like this: CMyWnd *pWnd = GetMyWnd(); // i also tried CMyWnd *pWnd = NULL; pWnd = GetMyWnd(); if(pWnd) { pWnd->SetSomeFunc(); } to see what GetMyWnd returns. It returns a Junk value, and the if condition is evaluated to true and it enters inside and crashes. this is the reason that i thought i should check for NULL as well as Bad Ptr. how do i solve this?? is there anyother way??

    C / C++ / MFC help question

  • Any alternative for IsBadReadPtr / IsBadWritePtr
    S sw thi

    i need to check whether a pointer is valid or not ie., whether its NULL or Bad Ptr. I've searched the net and found these functions IsBadReadPtr or IsBadWritePtr, but they also say that its not good practice to use these functions. Can anyone please tell me are there any alternatives for these function? if there are no alternatives then what are the problems that i might face if i use these function?? Thanks for any help.

    C / C++ / MFC help question

  • Application crashes when CoCreateInstance is called in VS 2005 in Vista machine
    S sw thi

    Here is the code that causes problem: CComPtr m_pMyComp; IUnknown* pUnkOuter = GetControllingUnknown(); HRESULT hRes = CoCreateInstance(CLSID_MyComp, pUnkOuter, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&m_pMyComp.p); if (hRes != S_OK) return hRes; This code was ported from VS2003, it works in VS2003 but it crashes only in VS 2005 release mode. Any idea where the problem is??

    COM visual-studio help question announcement

  • Templates
    S sw thi

    After 4 painful days?? It's only been 30 mins :~

    C / C++ / MFC visual-studio wpf help question

  • How to delete my profile ?
    S sw thi

    That was fast thanks :-)

    Site Bugs / Suggestions tutorial question

  • File handling issue
    S sw thi

    I guess you will have to find the file name at runtime and then read it?!! There is a class called CFileFind MFC, you can use that, CFileFind finder; finder.FindFile("C:\\Design Docs\\temp*.txt"); // this will find your file finder.FindNextFile(); // it is compulsory to call this function before you call GetFilePath CString filename = finder.GetFilePath(); // this will get the file name along with the path, so you can use this to open the file and read. finder.Close(); Hope this solves your problem. Happy weekend.

    "What's on your mind, if you will allow the overstatement?"

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

  • File handling issue
    S sw thi

    What are you trying to do exactly?? you have to open files separately you can't open them in a bunch.

    "What's on your mind, if you will allow the overstatement?"

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

  • File handling issue
    S sw thi

    Isn't it CStdioFile?? And you can just include the path also with the file name. saptxt.Open("C:\\My Folder\\temp.txt",CFile::modeRead); But you can’t open a bunch of files using *, if that’s what you meant by generic file name.

    "What's on your mind, if you will allow the overstatement?"

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

  • How to delete my profile ?
    S sw thi

    How to delete my profile here at code project? I searched in my profile page and also in my settings page I couldn’t find any option to do this. Could someone tell me how to do this?!!

    Site Bugs / Suggestions tutorial question

  • 'WCHAR' to 'LPCWSTR'
    S sw thi

    WCHAR is a wide character and LPCWSTR is a pointer to a string of WCHARs. You can use CString::Format to convert any datatype to string and pass that CString to OutputDebugString.

    "What's on your mind, if you will allow the overstatement?"

    C / C++ / MFC tutorial

  • Active window holding problem
    S sw thi

    You are passing NULL as the first parameter to GetWindow, you have to provide a valid window handle to GetWindow then only it gets the next window or any window thats related to the window that you provide. Use GetForegroundWindow function to get the handle to the current active window, then you can use GetWindow to get the next windows. Remember you always have to pass a valid HWND to GetWindow.

    "What's on your mind, if you will allow the overstatement?"

    C / C++ / MFC help

  • Active window holding problem
    S sw thi

    Your GetWindow() is returning an HWND and you are trying to assign that directly to a CWnd*. Do the following instead: HWND hWnd = GetWindow(NULL,cmd); CWnd *pTopWnd = CWnd::FromHandle(hWnd);

    "What's on your mind, if you will allow the overstatement?"

    C / C++ / MFC help

  • How to detect which is a COM dll and which a regular dll file? [modified]
    S sw thi

    Try and register the dll using Regsvr32. If it is a com dll you would get a success message saying the dll is registered successfully. If it is not a com dll it would give you and error message saying that the entry point DllRegisterServer was not found, which means that the dll is not a com dll.

    "What's on your mind, if you will allow the overstatement?"

    C / C++ / MFC com tutorial question

  • whats the result of this ...
    S sw thi

    You shoudln't mix new and realloc.

    "What's on your mind, if you will allow the overstatement?"

    C / C++ / MFC question performance

  • What would you choose?
    S sw thi

    Hiding a dirty shirt is terrorism?? I didn’t know that!! :rolleyes:

    "What's on your mind, if you will allow the overstatement?"

    The Lounge question

  • convert char* to double and back
    S sw thi

    You can use atoi and itoa functions to achieve this. atoi - converts string to int. itoa - converts int to string.

    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