Retrieves a C string containing the value of the environment variable whose name is specified as argument. If the requested variable is not part of the environment list, the function returns a NULL pointer.
The string pointed by the pointer returned by this function shall not be modified by the program.
you are appending to (altering) the contents of the memory pointed to by the return from getenv(). You need to use a temporary location to copy the data and only then start appending. Remember that strcat does not do additional allocation, it just blindly appends to memory.
Lastly, you have both char * and string copies of these environment variable contents. You should use the string versions which will do the copying for you and remove the use of the char * versions.
Hi. So, i got my custom static control (class which inherits from CStatic), which displays a text on a dialog window and thats it. Now i am trying to determine its style, which was sat in resource editor. For example, center image was sat, SS_CENTERIMAGE, so i am doing this:
I build an app w/VC++6 . I design a window with an EDIT CONTROL (IDD_MYEDIT), associate a CEdit control (m_myedit). I switched on the PASSWORD style of the control.
Can be triggered this style on or off during the program running?
36. When you surround an army, leave an outlet free.
Do not press a desperate foe too hard.
Why would you want a modeless CFileDialog? I can't think of any case where a user would select some sort of open/save button and have the software not wait for an input or a cancel.
Regardless of that though, if you really want it, just make your own class derived from CFileDialog (you'll have to replace DoModal() with a call to Create()). Override the virtual methods OnOK() and OnCancel() and you have your own modeless CFileDialog.
Although that product is not free, this is probably the best solution (Active-X control) if you want to uses it from a MFC application and do not want to uses .NET framework and you still want to support XP (or even older OS).
My light bulb turned on when you mentioned about the CFile::shareExclusive flag. In my code to open file for reading, I didn't have CFile::shareDenyNone, I guess it defaults to shareExclusive when I don't specify it? After I set the flag, the program works. It looks like my program was stepping on its own foot.
I'm just still puzzled as to why it works for one file, but not the other when I don't use the shareDenyNone flag. Any ideas?
Thank you for helping me out, I feel so relief now that the problem is solved!!