|
Assuming you have a valid IDL pointer:
LPITEMIDLIST idl;
TCHAR szPath[MAX_PATH];
SHGetPathFromIDList(idl, szPath);
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
CrocodileBuck wrote: how to use this function
See here[^].
|
|
|
|
|
I am making web Crawler. I can get hard coded URL but not able to get dynamic generated URL (URL contain ? mark ). Can you tell me, how can i get this in C++.
|
|
|
|
|
sumit.durg wrote: but not able to get dynamic generated URL (URL contain ? mark ).
From where do you want to get this "dynamically generated URL"
and where do you get the hard code URL from?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
while parsing HTML code itself.
|
|
|
|
|
Hello I have a little big problem that drive me crazy for 3 hours.
I have a function that browse the content of a folder (with subfolders).
After that operation is done I want to delete the folder. The function is recursive.
All the files in the route folder are deleted ok. But I cannot delete the subFolders and their content.
I use this code for retrieve information about files and folders:
WIN32_FIND_DATA FindFileData;
HANDLE hFind=INVALID_HANDLE_VALUE;
hFind= FindFirstFile(aux,&FindFileData);
FindNextFile(hFind, &FindFileData);
I guess that it is us
How can I remove the file/folder in use tag?
I tried with
delete &FindFileData it doesn't work. There must be a way out there ...
I tried to delete the folder without browse it first and it works fine.
The weird thing is that I can delete the files that are in the root.
|
|
|
|
|
Did you use FindClose(hFind) ?
|
|
|
|
|
Why don't you use
DeleteFile(FindFileData.cFileName); ?
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
|
|
|
|
|
Can you use of _rmdir or SHFileOperation without this code?
|
|
|
|
|
|
|
I used this to erased a folder and it works
SHFILEOPSTRUCT op;
op.pFrom = szStoreFolder;
op.wFunc = FO_DELETE;
op.fFlags = FOF_SILENT | FOF_NOCONFIRMATION;
op.fAnyOperationsAborted = false;
op.hNameMappings = NULL;
SHFileOperation(&op);
only if you do not have the files in that folder in used...
if you have that you should FindClose(handleFile) if you used previous a function that searched for file in that folder
|
|
|
|
|
I am capturing image and saving that to a file. it is working fine. But one of other requirement is when user presses clt+alt+del, i should be able to do that (saving the image in to a bitmap file). But bitblt is failing when i press ctl+alt+del. it is returing zero.
Any suggestions ?
Thanks, Subramanyeswari
|
|
|
|
|
subramanyeswari wrote: Any suggestions ?
Yes: 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
|
|
|
|
|
This is my code
RECT rc;
HDC hdcMem, hdcOld;
BYTE* m_pDrawingSurfaceBits=NULL;
BITMAPINFOHEADER bmpInfoHeader = {0};;
HBITMAP hbmDIBSection = NULL;
HWND hParent,hChild=NULL;
char* szAppName = "view.exe";
BOOL bRet = IsProcessRunning(szAppName);
if (!bRet)
{
::MessageBox(hWnd,"Application is not running",NULL,NULL);
}
hParent = FindWindow("WindowViewer", NULL);
if (!hParent)
{
::MessageBox(hWnd,"not able to find WindowViewer class",NULL,NULL);
}
if(hParent)
hChild = FindWindowEx(hParent,NULL,"ViewPU",NULL);
if (!hChild)
{
::MessageBox(hWnd,"not able to find ViewPU class",NULL,NULL);
}
::SendMessage(hChild, WM_SYSCOMMAND, SC_HOTKEY, (LPARAM) hChild);
::SendMessage(hChild, WM_SYSCOMMAND, SC_RESTORE, (LPARAM) hChild);
GetWindowRect(hChild, &rc);
hdcOld = ::GetDC(hParent);
if(hdcOld == NULL)
::MessageBox(hWnd,"hdcOld null",NULL,NULL);
// Create a compatible DC.
hdcMem = CreateCompatibleDC(hdcOld);
if(hdcMem == NULL)
::MessageBox(hWnd,"hdcMem null",NULL,NULL);
// Create a DIBSection big enough for our client rectangle.
long width = rc.right-rc.left;
long height = rc.bottom-rc.top;
if(hdcMem != NULL)
{
bmpInfoHeader.biSize = sizeof(BITMAPINFOHEADER);
bmpInfoHeader.biBitCount = 24;
bmpInfoHeader.biPlanes = 1;
bmpInfoHeader.biCompression = BI_RGB;
bmpInfoHeader.biWidth =width;
bmpInfoHeader.biHeight = height;
bmpInfoHeader.biSizeImage = ((((bmpInfoHeader.biWidth * bmpInfoHeader.biBitCount) + 31) & ~31) >> 3) * bmpInfoHeader.biHeight;
hbmDIBSection = CreateDIBSection(hdcMem, (CONST BITMAPINFO*)&bmpInfoHeader, DIB_RGB_COLORS, (void**)&m_pDrawingSurfaceBits, NULL, 0);
}
// Select the bitmap into the off-screen DC.
HBITMAP hbmOld = (HBITMAP) SelectObject(hdcMem, hbmDIBSection);
bRet = BitBlt(hdcMem,0,0,width,height,hdcOld,0,0,SRCCOPY);//here it saying invalid handle
if (bRet ==0)
{
DWORD d=::GetLastError();
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
::MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );}
BITMAPFILEHEADER bfh = {0};
bfh.bfType = 0X4D42;
bfh.bfOffBits = sizeof(BITMAPINFOHEADER)+sizeof(BITMAPFILEHEADER);
bfh.bfSize = bfh.bfOffBits+bmpInfoHeader.biSizeImage;
bRet = SetCurrentDirectory("c:\\testBitmap");
DWORD ret = GetLastError();
char filename[200];
char *dir= "c:\\testBitmap\\";
int j;
j = sprintf(filename,"%s",dir);
j+= sprintf(filename+j,"%s",temp);
j+= sprintf(filename+j,"%d",counter);
j+= sprintf(filename+j,"%s",".bmp");
HANDLE hFile = CreateFile(filename,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if (!hFile)
{
return ;
}
DWORD dwWritten = 0;
bRet = WriteFile(hFile,&bfh,sizeof(bfh),&dwWritten,NULL);
bRet = WriteFile(hFile,&bmpInfoHeader,sizeof(bmpInfoHeader),&dwWritten,NULL);
bRet = WriteFile(hFile,m_pDrawingSurfaceBits,bmpInfoHeader.biSizeImage,&dwWritten,NULL);
bRet = CloseHandle(hFile);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
Regards, Subramanyeswari
|
|
|
|
|
Please use the code block button to post code snippets.
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
|
|
|
|
|
ok i will do that now
This is my code
RECT rc;
HDC hdcMem, hdcOld;
BYTE* m_pDrawingSurfaceBits=NULL;
BITMAPINFOHEADER bmpInfoHeader = {0};;
HBITMAP hbmDIBSection = NULL;
HWND hParent,hChild=NULL;
char* szAppName = "view.exe";
BOOL bRet = IsProcessRunning(szAppName);
if (!bRet)
{
::MessageBox(hWnd,"Application is not running",NULL,NULL);
}
hParent = FindWindow("WindowViewer", NULL);
if (!hParent)
{
::MessageBox(hWnd,"not able to find WindowViewer class",NULL,NULL);
}
if(hParent)
hChild = FindWindowEx(hParent,NULL,"ViewPU",NULL);
if (!hChild)
{
::MessageBox(hWnd,"not able to find ViewPU class",NULL,NULL);
}
::SendMessage(hChild, WM_SYSCOMMAND, SC_HOTKEY, (LPARAM) hChild);
::SendMessage(hChild, WM_SYSCOMMAND, SC_RESTORE, (LPARAM) hChild);
GetWindowRect(hChild, &rc);
hdcOld = ::GetDC(hParent);
if(hdcOld == NULL)
::MessageBox(hWnd,"hdcOld null",NULL,NULL);
hdcMem = CreateCompatibleDC(hdcOld);
if(hdcMem == NULL)
::MessageBox(hWnd,"hdcMem null",NULL,NULL);
long width = rc.right-rc.left;
long height = rc.bottom-rc.top;
if(hdcMem != NULL)
{
bmpInfoHeader.biSize = sizeof(BITMAPINFOHEADER);
bmpInfoHeader.biBitCount = 24;
bmpInfoHeader.biPlanes = 1;
bmpInfoHeader.biCompression = BI_RGB;
bmpInfoHeader.biWidth =width;
bmpInfoHeader.biHeight = height;
bmpInfoHeader.biSizeImage = ((((bmpInfoHeader.biWidth * bmpInfoHeader.biBitCount) + 31) & ~31) >> 3) * bmpInfoHeader.biHeight;
hbmDIBSection = CreateDIBSection(hdcMem, (CONST BITMAPINFO*)&bmpInfoHeader, DIB_RGB_COLORS, (void**)&m_pDrawingSurfaceBits, NULL, 0);
}
HBITMAP hbmOld = (HBITMAP) SelectObject(hdcMem, hbmDIBSection);
bRet = BitBlt(hdcMem,0,0,width,height,hdcOld,0,0,SRCCOPY);
if (bRet ==0)
{
DWORD d=::GetLastError();
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL
);
::MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );}
BITMAPFILEHEADER bfh = {0};
bfh.bfType = 0X4D42;
bfh.bfOffBits = sizeof(BITMAPINFOHEADER)+sizeof(BITMAPFILEHEADER);
bfh.bfSize = bfh.bfOffBits+bmpInfoHeader.biSizeImage;
bRet = SetCurrentDirectory("c:\\testBitmap");
DWORD ret = GetLastError();
char filename[200];
char *dir= "c:\\testBitmap\\";
int j;
j = sprintf(filename,"%s",dir);
j+= sprintf(filename+j,"%s",temp);
j+= sprintf(filename+j,"%d",counter);
j+= sprintf(filename+j,"%s",".bmp");
HANDLE hFile = CreateFile(filename,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if (!hFile)
{
return ;
}
DWORD dwWritten = 0;
bRet = WriteFile(hFile,&bfh,sizeof(bfh),&dwWritten,NULL);
bRet = WriteFile(hFile,&bmpInfoHeader,sizeof(bmpInfoHeader),&dwWritten,NULL);
bRet = WriteFile(hFile,m_pDrawingSurfaceBits,bmpInfoHeader.biSizeImage,&dwWritten,NULL);
bRet = CloseHandle(hFile);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
|
|
|
|
|
subramanyeswari wrote: bRet = BitBlt(hdcMem,0,0,width,height,hdcOld,0,0,SRCCOPY);//here it saying invalid handle
The above line should be
bRet = BitBlt(hdcOld,0,0,width,height,hdcMem,0,0,SRCCOPY);
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
|
|
|
|
|
I tried that. But it did not work
|
|
|
|
|
What was the error?
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
|
|
|
|
|
it is saying invalid handle.
|
|
|
|
|
Does hdcOld support BitBlt ? You may check it with GetDeviceCaps .
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
|
|
|
|
|
Next time you should say "Please EDIT your message and use the code block button to post code snippets" :P:P:P:P
Regards.
--------
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?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
No matter what you say the universe is entropic, my friend.
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
|
|
|
|
|
Is it possible? I've been trying to send the object for some hours but I dont think it is possible since as far as I've read, the device context data lies on a different part of the memory.
What I am trying to achieve is to send a CDC object from one application, to another almost every 200ms (the application which sends the CDC is hidden btw). I currently have 2 solutions so far (Use of 1. Clipboard, 2. Shared DLL) but I want to make sure first if there are other better ones out there. Hoping for your suggestions.
Thank you.
|
|
|
|
|