|
Thanks for responding. Please see my response to Maximilien.
|
|
|
|
|
In general, it's a bad idea to let ordinary users modify something in the installation path ("c:\program files", ...)
What about using the path "CSIDL_COMMON_APPDATA" or "CSIDL_COMMON_DOCUMENTS" both can be fetch with the <code> SHGetFolderPath API.
There's also the "C:\Users\Public" folder, but I'm not certain about that one.
Watched code never compiles.
|
|
|
|
|
Thanks for both responses.
"CSIDL_COMMON_APPDATA" corresponds to "c:\ProgramData" which is a hidden folder in Win7.
The documentation says "CSIDL_COMMON_DOCUMENTS" corresponds to "... A typical path is 'C:\Documents and Settings\All Users\Documents' ...". What does that mean in Win7? There is no "c:\Documents and Settings" folder.
The "C:\Users\Public" seems the most promising, but how do I get the folder from code since I didn't see any CSIDL or FOLDERID that seemed to correspond?
|
|
|
|
|
I really have not much win7 experience yet (still running XP here), but isn't there also an "All Users" inside c:\users, althorough that might be also hidden.
You could try "trial and error" (if google doesn't help), just query for the special folder locations one by one, maybe c:\users\public turns up for one of those CSIDs...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
In Windows 7, Documents and Settings no longer exists...instead there is a folder named Users that has the indivudal user info. Either way, using the GetFolderPath method will return the proper name - Vista or Windows 7.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
|
Trying to rebuild our application with VS2010 (latest beta) ...
We get weird errors from atlbase.h.
...<br />
2> myfile.cpp<br />
2>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlbase.h(4957): error C3861: 'GetMessage': identifier not found<br />
2>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlbase.h(4957): fatal error C1903: unable to recover from previous error(s); stopping compilation<br />
...<br />
It does not happend on all files, but only a few, so that it's not something that should be in the settings (?) or the precompiled header (?)
Any idea what could be the cause of that weird error ? missing some "#include" on my side ?
and contrary to popular belief, this is not urgent... just exploratory.
Thanks.
Watched code never compiles.
|
|
|
|
|
Hi,
Could it be something related to using the beta release? The finished item's been out a while so it might be worth looking at a full release version first.
Cheers,
Ash
|
|
|
|
|
I want to load a dll library of mine before i trigger vs' debug menu?
In another word, i want to inject my dll to the new debugged process(and my dll should be loaded before any other dll except kernel32.dll). What should i do?
|
|
|
|
|
|
Dear All,
I am creating a SplitterWnd which consist of Three Views. One View is a Tree Control & other are Two Form Views. When Click the Tree Items i am deleting these tow Form Views.
From Tree View it is getting no Problem.
My Problme is When i select a Menu Item which is having same Items populated in TreeCtl Items. When i focus the Cursor to any one of the Form View and slect the Menu Item it is giving Assertion.
CSplitterwnd.DeleteView(1,0) //---> Second View is Getting Assertion from Menu selected.
Please help me out.
Thanks & Regards,
Uday.
|
|
|
|
|
Hi,
I am having cstring stringToBeConverted;
And,i trimmed the above string as
stringToBeConverted.Trim(stringToBeConverted[0]);
If i use std string instead of cstring how can i trim and succeeds the above functionality..
how to use boost::trim????
thanx
|
|
|
|
|
See this[^] SO thread. It contains both usage of trim from Boost's string algorithms and custom trim implementations.
|
|
|
|
|
I am tring to post a request to a http webserver. But server is getting null value.
my code is as:
DWORD dwHttpRequestFlags =
INTERNET_FLAG_RELOAD |
INTERNET_FLAG_EXISTING_CONNECT |
INTERNET_FLAG_NO_AUTO_REDIRECT |
INTERNET_FLAG_DONT_CACHE;
CString strHeaders = _T("Accept: text/*\r\nUser-Agent: Your Appliction\r\n");
CString strFormData = _T("appID=0001&seckey=Tq+jiIicN/");
CInternetSession session;
CString strServerName, theStringBuffer, strObject;
DWORD dwServiceType;
INTERNET_PORT nPort;
CString strURL = "http://10.105.157.150/FUS/GetVersion";
AfxParseURL(strURL, dwServiceType, strServerName, strObject, nPort);
CHttpConnection* pConnection = session.GetHttpConnection((LPCTSTR)strServerName, (INTERNET_PORT)nPort, (LPCTSTR)NULL, (LPCTSTR)NULL);
CHttpFile* pFile = pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, strObject,NULL, 1, NULL, NULL, dwHttpRequestFlags);
pFile->AddRequestHeaders(strHeaders);
BOOL result = pFile->SendRequest(strHeaders,(LPVOID)(LPCTSTR)strFormData), strFormData.GetLength());
CString fullbody;
CString strSentence;
while(pFile->ReadString(strSentence))
fullbody = fullbody + strSentence;
|
|
|
|
|
I recently observed that a call to the GetPrivateProfileSectionNamesA WinAPI function returned 0. Postings on the internet suggest to check file existence, Windows INI file mapping, etc. To make the story short: The call works reliably after a Windows restart, and eventually fails (using the same INI file, and file name) after several program runs, where "fails" means "returns 0."
The documentation does not indicate that GetLastError() returns anything useful in this case, but I called it nonetheless, and it returned 8 (ERROR_NOT_ENOUGH_MEMORY).
That was the first time ever I worked with Vista Home, so I am wondering whether Vista Home has any limitiations with respect to memory or other resources, compared to XP Pro or Vista Pro where this problem never appeared. It may be that some resources used by third-party software are not released after a program crash - and the program crashed rather often during my testing/debugging sessions.
Thanks for any suggestions - Hans
|
|
|
|
|
Could you please post the relevant code?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Tried to boil the code down to the relevant parts.
void ReadAllSections(const CString &sFileName, CStringArray &arrsSections)
{
static const DWORD k_dwBufferInc = 10;
DWORD dwBufferSize = 0, dwReturnedLength;
CString sBuffer;
do
{
dwBufferSize += k_dwBufferInc;
dwReturnedLength = GetPrivateProfileSectionNames(sBuffer.GetBuffer(dwBufferSize - 1), dwBufferSize, sFileName);
}
while (dwReturnedLength == dwBufferSize - 2);
arrsSections.RemoveAll();
if (dwReturnedLength == 0)
{
DWORD dwLastErr = GetLastError();
AfxDebugBreak();
return;
}
LPCTSTR pszCurrent = sBuffer;
while (*pszCurrent != _T('\0'))
{
arrsSections.Add(pszCurrent);
pszCurrent += _tcslen(pszCurrent) + 1;
}
}
Let me point out once more that the AfxDebugBreak(); statement is not always executed, although always the same file name (and absolute directory) is used, and the same file is used (and exists) all the time. The MSDN documentation does not mention that a return value of 0 means failure, nor that GetLastError() should be called in that case.
|
|
|
|
|
A call to CString::ReleaseBuffer must must follow each call to CString::GetBuffer .
As side note, way don't you use a more aggressive technique for the buffer (for instance, starting with 256 bytes and doubling at each cycle)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi CPallini, thanks for your input... this is demo code, the production code uses more aggressive memory allocation. Doubling seems a bit of overkill to me; I start with like 1024 bytes and add steps of 1024. The point of adding just 10 is to show that the algorithm works and is not the cause of the problem. About ReleaseBuffer() - omitting it, in my understanding, may confuse CString operations but should not make an API call fail should it?
|
|
|
|
|
hans.sch wrote: About ReleaseBuffer() - omitting it, in my understanding, may confuse CString operations but should not make an API call fail should it?
Nope, it shouldn't. However, any debugging should happen in the cleanest environment possible, I think (moreover, forgetting to call CString::ReleaseBuffer method can bring only troubles to you...).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi All
I haven't got any reply so i ask same question.Is it possible or not.
How can i open Ms PowerPoint password protected file through code?I know password but how to set password through code?. i haven't idea how to open through code.
Please help me
|
|
|
|
|
There is no straight forward way to do it.
The correct way would have been for power point to support a command line flag to supply the password.
But there isn't such an option.
The dirty way would be to install a CBT hook using SetWindowsHookEx just before invoking power point.
The hook function can then get notified when the password dialog pops up and can supply the password for it.
The hook can then be uninstalled using UnhookWindowsHookEx .
You could probably also use NotifyWinEvent instead of SetWindowsHookEx .
|
|
|
|
|
Thanks for reply
Can i pass password option in vba code like excel or word?
|
|
|
|
|
Hi ,
How to ping the http server, post command and download file from server in MFC?
|
|
|
|
|
MFC has a class called CHttpFile to read files on a server.
There is also an API called URLDownloadToFile which can download a file identified by a URL.
|
|
|
|