|
Your question is a little too vague. I'm assuming that since you have to wait, the initial attempt to rename/delete has failed. Whether you will now wait or not will entirely depend upon the reason of failure. For example if the failure is permissions, this could be a long wait. If there is a lock on the file, you could wait the file to be unlocked. But again this could be a very long wait.
The coffee answer might hold the best truth.
|
|
|
|
|
Do you want to have a progress bar?
|
|
|
|
|
Hi Experts,
i am writing a shell conext menu. When I click on .lnk file(Link file), I am getting the target file path. How can I get the link file path from target file path?
|
|
|
|
|
CString CDropEdit::ExpandShortcut(CString &inFile)
{
CString outFile;
ASSERT(inFile != _T(""));
IShellLink* psl;
HRESULT hres;
LPTSTR lpsz = inFile.GetBuffer(MAX_PATH);
hres = ::CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*) &psl);
if (SUCCEEDED(hres))
{
IPersistFile* ppf;
hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*) &ppf);
if (SUCCEEDED(hres))
{
WORD wsz[MAX_PATH];
::MultiByteToWideChar(CP_ACP, 0, lpsz, -1, wsz, MAX_PATH);
hres = ppf->Load(wsz, STGM_READ);
if (SUCCEEDED(hres))
{
WIN32_FIND_DATA wfd;
HRESULT hres = psl->GetPath(outFile.GetBuffer(MAX_PATH),
MAX_PATH,
&wfd,
SLGP_UNCPRIORITY);
outFile.ReleaseBuffer();
}
ppf->Release();
}
psl->Release();
}
inFile.ReleaseBuffer();
return outFile;
}
from CDropEdit[^]
|
|
|
|
|
Actually this code Resolve the link file path.
I want that can extract the link file path from target file path.
|
|
|
|
|
so, you have a file "Foo.exe" and you want to find all of the shortcuts that point to it ?
|
|
|
|
|
|
i'm 99% sure you can't do that. targets don't know about links to them.
|
|
|
|
|
But we can do a scan in the registry to find out all valid link files pointing to what, and sort the targets to group the identical target.
But ... err ... it takes long time.
WinASO[^] registry optimizer tool does this way (I guess) to remove invalid links (shortcuts and references in registry).
Maxwell Chen
|
|
|
|
|
right, that's the brute force way. (you could also scan all connected drives for .LNK files, resolve them and find those that point to your target!)
but AFAIK there's no simple way to do it, like there is in the standard direction.
|
|
|
|
|
Hi all,
I have written a code in vc6 in which i have written this code for getting a resource handle....
FindResource(NULL,MAKEINTRESOURCE(IDR_IDR_EXE_EXEEXTRACTOR),"IDR_EXE");
now when i am writing this same code in VC2005
it gives an error:-
error C2664: 'FindResourceW' : cannot convert parameter 3 from 'const char [8]' to 'LPCWSTR'
but error is resolved when i add prefix 'L' to my third parameter
FindResource(NULL,MAKEINTRESOURCE(IDR_IDR_EXE_EXEEXTRACTOR),L"IDR_EXE");
now my problem is...
it compiles correctly but at runtime its giving debug assertion failed error.
Is there any other way to Find my resource in VC2005
|
|
|
|
|
It's because UNICODE is enabled by default in VC2005, which was not the case with VC6.
neha.agarwal27 wrote: it compiles correctly but at runtime its giving debug assertion failed error.
Well, you don't provide a lot of usefull information do you ? What is the exact problem ? Where does your code crashes ? Use your debugger to locate the problem more precisely and inspect the state of the different variables before the crash.
|
|
|
|
|
Try
FindResourceA(NULL,MAKEINTRESOURCEA(IDR_IDR_EXE_EXEEXTRACTOR),"IDR_EXE");
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
|
|
|
|
|
CPallini wrote: MAKEINTRESOURCEA()
eurk, that's pretty awful
|
|
|
|
|
toxcct wrote: CPallini wrote:
MAKEINTRESOURCEA()
eurk, that's pretty awful
Nope. That's pretty Awful
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
|
|
|
|
|
Thanks for your solution it implemented correctly.
now i am having same problem with UpdateResource
VERIFY(UpdateResource(hUpdateRes,L"IDR_EXE",MAKEINTRESOURCE(IDR_IDR_EXE_EXEEXTRACTOR),MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
buff,nSize));
same error if i remove it
error C2664: 'UpdateResourceW' : cannot convert parameter 2 from 'const char [8]' to 'LPCWSTR'
how can i use it in VC2005
|
|
|
|
|
I think you can go on using the same approach, i.e.
VERIFY(UpdateResourceA(hUpdateRes,"IDR_EXE",MAKEINTRESOURCEA(IDR_IDR_EXE_EXEEXTRACTOR),MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buff, nSize));
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
|
|
|
|
|
dear all
anyone can help me to explain code below?
m_hbmp=m_vicImg.hBitmap;
CStatic *pImgPicture=(CStatic*)GetDlgItem(IDC_staImg1);
pImgPicture->SetBitmap(m_hbmp);
i am not good in VC++, i know this is fundamental things.
thanks a lot
Li Zhiyuan
|
|
|
|
|
what don't you understand in this actually ?
this is C code in Win32...
|
|
|
|
|
toxcct wrote: this is C code in Win32...
Actually it's C++ code in MFC
|
|
|
|
|
well there's nothing to see the difference here ^^
|
|
|
|
|
CStatic is a MFC class (WIN32 doesn't have wrapper classes). And C doesn't have classes neither.
So CQFD
|
|
|
|
|
oops, i didn't watch further, and i only saw a pointer to a "user defined type"...lol
CQFD
|
|
|
|
|
li zhiyuan wrote: m_hbmp=m_vicImg.hBitmap;
Assigns to this object's (a CDialog derived class?) m_hbmp member (probably a HBITMAP, i.e. a Bitmap handle) the value of m_vicImg.hBitmap (i.e. the member hBitmap of the m_vicImg object (that you only know and probably is another member of this object).
li zhiyuan wrote: CStatic *pImgPicture=(CStatic*)GetDlgItem(IDC_staImg1);
Gets a pointer to a CStatic object representing the dialog static control having ID equal to IDC_staImg1 .
li zhiyuan wrote: pImgPicture->SetBitmap(m_hbmp);
Calls the SetBitmap method of the CStatic object. This should change the bitmap represented by the dialog static control.
BTW You can also get some information reading MSDN documentation.
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
|
|
|
|
|
You can declare a variable for static control instead make a pointer.
|
|
|
|