|
tagopi wrote: is there anyway to solve this issue?
Seeing as how that file cannot be created outside of code (e.g., right-click desktop, new text document, type name), I doubt it.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I think everyone here missed the real issue here.
"c:\test_1/2.txt"
There is a \t in the filename, which is converted to a tab character by the compiler. The file path getting passed into fopen is "c: est_1/2.txt"
You need to escape this backslash with another backslash, so your filename becomes "c:\\test_1/2.txt".
as for the forward slash, windows will interpret this as a path slash too, but you don't need to escape it because the compiler wont change it.
So, the path you are accessing is C: > test_1 > 2.txt
Additionally, fopen will not create the folder "test_1" if it does not exist, it will just fail to open it and return NULL.
|
|
|
|
|
That however wouldn't cause a crash.
Whereas not testing the return value of the method probably does.
|
|
|
|
|
OK, you are correct. The return value should always be checked for success, but if the filename was valid (and this is where the real issue is) the OP probably would have never noticed that, because it wouldn't be returning NULL.
|
|
|
|
|
Hi,
You are not able to create file name having special characters like "/,\,*" etc. If you want to confirm, just go on your desktop and try to create file having name "test_1/2", OS will not even allow to type '/' in file name.
Happy Programming.
Regards
|
|
|
|
|
Thanks everybody for your replies.
will give a try to replace "/" with some other.
Thanks again.
A. Gopinath.
|
|
|
|
|
If any folder is open in window explorer then how to refresh its contents.
Say c:/xyz is open, it contains some files and folders, i want to progratically refresh the children.
|
|
|
|
|
Are you working on mfc?? if yes then, i think you can just redraw whatever it is that you want on the screen.
Every new day is another chance to change your life.
|
|
|
|
|
How exactly do you mean "programmatically"? With an external program or an explorer addin?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
My program hides a file say from c: drive. If window explorer is open (c drive) i found file still display. If i refresh window explorer manually then file disappear.
|
|
|
|
|
Here you go.
HWND hExplorer = FindWindowEx(GetDesktopWindow(), NULL, L"ExploreWClass", NULL);
while(hExplorer != NULL)
{
EnumChildWindows(hExplorer, RefreshFolderSelectionCB, (LPARAM)&packet);
hExplorer = FindWindowEx(GetDesktopWindow(), hExplorer, L"ExploreWClass", NULL);
}
...
...
...
BOOL CALLBACK RefreshFolderSelectionCB(HWND hWnd, LPARAM lParam)
{
WCHAR sBuffer[MAX_PATH] = {0};
::GetClassName(hWnd, sBuffer, MAX_PATH);
if (wcscmp(L"SysTreeView32", sBuffer) == 0)
{
RefreshFolderSelectionPacket* pPacket = (RefreshFolderSelectionPacket*)lParam;
RefreshSelection(pPacket);
}
return TRUE;
}
...
...
static void UpdateItem(IShellFolder* pDesktop, const std::wstring& rsFullPath)
{
PIDLIST_RELATIVE pIDL;
if (SUCCEEDED(pDesktop->ParseDisplayName(NULL, NULL, (LPWSTR)rsFullPath.c_str(), NULL, &pIDL, NULL)))
{
SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_IDLIST|SHCNF_NOTIFYRECURSIVE|SHCNF_FLUSH, pIDL, NULL);
ILFree(pIDL);
}
}
|
|
|
|
|
http://social.msdn.microsoft.com/Forums/en/windowssdk/thread/cc4a702f-1b2f-4d19-bf68-c88967544172[^]
Where do RefreshFolderSelectionPacket and RefreshSelection() come from?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
uh huh, I ripped that code from there
|
|
|
|
|
I get compile error for RefreshFolderSelectionPacket
how to call UpdateItem
|
|
|
|
|
In my CFormView drived class, why OnInitialUpdate() is not getting executed?
|
|
|
|
|
Could you please post code from your header definition and source file, only relevant parts please.
At a guess tho, I would say it is because you didn't declare it as a virtual function.
In the header file it should be declared as virtual void OnInitialUpdate();
|
|
|
|
|
Andrew Brock wrote: At a guess tho, I would say it is because you didn't declare it as a virtual function.
In the header file it should be declared as virtual void OnInitialUpdate();
Not likely since once virtual, always virtual. You don't need to declare an overridden virtual function virtual. However good it might be for readability, it's not necessary.
|
|
|
|
|
Hi,
I have changed the background colour of one of my dialogs by handling the WM_CTLCOLOR message. This works OK but the child controls are still painted using the original dialog background colour. I have set the transparent property of the child controls but this makes no difference.
Is there something else I need to do?
Thanks
Tony
|
|
|
|
|
What are your child controls? Static text?
Typically you would need to override the WM_ERASEBKGND (OnEraseBkgnd in MFC) in the child controls to stop it painting the background or to copy the parent background (depending on what you are doing). Check out some of the transparent controls[^] in the articles section.
|
|
|
|
|
My dialog contains a mixture of control types, including CStatic, CEdit etc. I have discovered that if I call pDC->SetBkMode(TRANSPARENT) in my dialog's OnCtlColor() handler then all of the child static controls have a transparent background - GREAT! - but unfortunately, so do my edit controls.
So close but yet so far
I was hoping that I would be able to create a generic dialog class which would allow me to set the background colour without me having to fiddle with the child controls on an individual basis.
|
|
|
|
|
Ok, great start. Check out the MSDN page[^] for OnCtlColor().
Notice the nCtlColor parameter? Only do pDC->SetBkMode(TRANSPARENT) if it is equal to CTLCOLOR_STATIC and you should be set.
EDIT:
If you only want to set specific controls as transperent, rather than all controls of a type, check if pWnd is the instance you want to set instead.
|
|
|
|
|
Thanks Andrew - works a treat
|
|
|
|
|
hi i need source genetic algorithm function sphere,schwefel, rosenberg, Ackley, Giewank with languages c++
|
|
|
|
|
I would suggest a Google search, this forum does not provide code on demand.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Do your own homework.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|