|
Add debug output using OutputDebugString to record what has happened.
User the Windows tool ProcessExplorer to examine File handles events etc that the exe is performing.
|
|
|
|
|
Hello to all,
right now i am trying to upload a file on the server in VC++(MFC), currently i can upload a file directly on the server but i want to upload a file in a perticular folder on the server that i am unable to do, bcoz whenever i add that folder name to the our server address in the code then after execution i get a message "server name or address can not be resolved" and so connetion with server can not be done. I am using CInternetSession and CFtpConnection classes and GetFtpConnection(),PutFile() and GetFile() functions of these classes for uploading and downloading. can anybody help me?
Anay Kulkarni
|
|
|
|
|
I believe you should add it to the 'pstrRemoteFile' parameter of the PutFile() / GetFile() calls instead of to the server address. Instead of asking for
myfile.txt
ask for
subdir1/subdir2/myfile.txt
See if that works for you.
|
|
|
|
|
yes, it worked fine. thanks a lot sir.
Anay
|
|
|
|
|
Are you calling the connection's SetCurrentDirectory() method before PutFile() ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I use VC2005.I found a new error I have never met before.
error C2220: warning treated as error - no 'object' file generated
How should I fixed it ?
Thanks.
GOOD LUCK
|
|
|
|
|
Try checking this[^] out.
Steve
|
|
|
|
|
kcynic wrote: How should I fixed it ?
Start by reading this.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
consider
<br />
class Car<br />
{<br />
int speed;<br />
doulbe engineSize;<br />
};<br />
<br />
I persoanlly dislike code like this. I tend to make all data members private and provide inlined get and set methods where appropriate. The main reason I like the get and set methods is its easier to debug code as you can put a break point in the set method for example and catch every change to the value. Also it prevents people taking the address of these variables and manipulating them through pointers which can also be hard to track down in a large project.
Im interested to hear the opinions of others on the use of public data members or getter and setter methods
|
|
|
|
|
I mostly use "get" and "set" methods to access data members which are private by default. However, there are rare special situations where I do access public fields directly.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
In my opinion it depends about what is being done. In my studies final project I was using GET and SET everywhere, but not with numbers or easy variables. I was using them with objects that holded more than hundred parameters (its sizeof (myObject) in some points were in KB). Because of that when I was searching elements of the third hierarchy (it means go in a collection of elements, where every element has a collections of other elements, and then search for the concrete parameter inside another collection), the program was f***ing slow and needed a lot of resources to get the object between classes.
I change it to public and worked with pointers/references and then all was fine.
I like to use Get and Set, but sometimes is impossible.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
A couple thoughts...
Inline getters and setters should work just as fast as direct access.
An advantage of getters and setters is you can change the implementation without
having to change code anywhere else. For example, if in the future you need to calculate
the "speed" member on the fly, all you'd have to do is implement that functionality in the getter
method. All code that uses it stays the same.
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all, quick question. I've read the MSDN library definition for this API and all i really want to know is can i use it to find a running program or not. Still searhing for a example of this API in use so its still very un-clear to me. Thanx in advance!
|
|
|
|
|
EnumProcesses shows each process on the system but what do you need exactly?
|
|
|
|
|
DWORD dwPID[16860];
DWORD dwRet;
DWORD dwNumProcesses;
if (TRUE == EnumProcesses(dwPID,sizeof(dwPID),&dwRet))
{
dwNumProcesses = dwRet / (sizeof(DWORD);
for(int i =0;i < dwNumProcesses;++i)
{
printf(_T("Process ID = %d"),dwPID[i];
}
}
Best Wishes,
-Randor (David Delaune)
|
|
|
|
|
This function can check if a process is running by checking the executable name. You may want to add additional checking such as window class enumeration or enumeration of known loaded modules.
BOOL IsExecutableRunning(TCHAR *lpszExe)
{
HANDLE hSnapShot=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
PROCESSENTRY32 processInfo;
processInfo.dwSize=sizeof(PROCESSENTRY32);
while(Process32Next(hSnapShot,&processInfo)!=FALSE)
{
if(processInfo.th32ProcessID > 12 && _tclen(processInfo.szExeFile) > 0)
{
if(_tcscmp(processInfo.szExeFile,lpszExe) == 0)
{
CloseHandle(hSnapShot);
return TRUE;
}
}
}
CloseHandle(hSnapShot);
return FALSE;
}
Best Wishes,
-Randor (David Delaune)
|
|
|
|
|
I am trying to get and set the following information from File/Open save dialog of Microsoft Office 2000/2003/2007
1.Retrieve the currently displayed/selected folder path and also the file name that is selected if any.
2. Retrieve the selected file path, when the user clicks the open or save button.
3.Set a pre-defined string path within the file-name combo box.
I have been able to do the above task in case of File Open/Save common controls dialog(used by WordPad ,Notepad,
Acrobat Reader etc.) by using the dialog functions depicted in MSDN. But it is not working with Microsoft Office Dialog and I have found no MSDN documentation that depicts the internal messages of Microsoft Office Dialogs.
Please help me if you can.
Thanks and regards,
|
|
|
|
|
Microsoft Office doesn't use the common dialog for file open/save AFAIK.
The Office dialogs may well be undocumented. From our point of view, the
MS Office suite of applications are proprietary 3rd-party applications, not part of the
operating system, so there's no reason the dialogs and their functionality should be
documented.
You may get a reply here from someone with the info you need.
In the meantime, here's a couple links you may or may not have been to already:
Office Developer Center[^]
MSDN Newsgroups: Office Solutions Development[^]
That's all the info I have
Good luck!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Sir,
Thank you for your effort to help me out.
I will check those links mentioned by you.
Thanks for this and the welcome message at the lounge.
Regards,
|
|
|
|
|
What's the difference between an "MFC extension DLL" and a "regular DLL with MFC dynamically linked" ?
What are the uses for each type?
I asked this question on codeguru and was met with an extraordinarily arrogant non-answer. If that's what you plan on posting, please keep it to yourself.
Thanks,
Sam.
|
|
|
|
|
an MFC Ext DLL is one that exports C++ classes using MFC as a base. a regular DLL exports C-style functions.
or, as MS puts it...
|
|
|
|
|
so then the "regular dll that uses MFC" can't contain classes? for instance, if i wanted to put a dialog and associated functions in a dll, i would use the extension dll whereas if i were only creating functions that say, operated on a CString, i could do that in a "regular dll that uses MFC" ?
|
|
|
|
|
USAFHokie80 wrote: so then the "regular dll that uses MFC" can't contain classes?
it can contain them, sure. you can even export them: (for example).
but if you want to export C++ classes, you'll really should use an MFC extension DLL. most importantly, this ensures that the app and the DLL are using the same heap for memory allocation - don't want to pass a CString which has allocated memory into a DLL which is looking at a different heap...
or, as MS puts it: "If you need to pass an MFC or MFC-derived object pointer to or from an MFC DLL, the DLL should be an extension DLL."
|
|
|
|
|
Ah. That makes more sense. I don't use DLLs really, so that's probably the problem here. Just trying to figure out the difference so that I can start using them correctly.
|
|
|
|
|
Here's another link (very close to Chris' first link)...
Kinds of DLLs[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|