|
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
|
|
|
|
|
Hi,
I created the CFromView dynamically, Form is having CListCtrl where should set the style for CListCtrl?
the below code is giving error as m_ListDriveis is NULL .
bool CRecoverDriveDlg::CreateView(UINT Style, CRect rect,CWnd *Parent)
{
Create(NULL,NULL,Style,rect,Parent,0x10,NULL);
m_ListDrive.SetExtendedStyle(LVS_EX_FULLROWSELECT);
return 1;
}
|
|
|
|
|
What is m_ListDrive supposed to be and where is it initialised?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I'm guessing what you mean is m_ListDrivis.m_hwnd is null. The variable somehow needs to be attached to the dialog control.
This can be done with Dynamic Data eXchange (DDX) or the SubclassDlgItem[^] function, which must be called before m_ListDrive.SetExtendedStyle(LVS_EX_FULLROWSELECT); .
You could also make it into a pointer in the class definition, and then use
m_ListDrive = (CListCtrl *)GetDlgItem(IDC_MY_LIST); m_ListDrive->SetExtendedStyle(LVS_EX_FULLROWSELECT);
|
|
|
|