|
Hi,
I have a Dialog Based appl made in VC6 and i'd like to detect the Windows Version of the computer where my appl is running... How can i do that.
Thank u very much,
Dirso.
|
|
|
|
|
|
|
How do I delete a directory and its contents? I've tried DeleteFile and SHFileOperation, but with no luck
|
|
|
|
|
|
|
bool SHCopyFile(CString ExistingFile,CString NewFile)<br />
{<br />
bool RetVal = false;<br />
SHFILEOPSTRUCT FileOp;<br />
ZeroMemory ( &FileOp, sizeof ( FileOp ) );<br />
FileOp.hwnd = theDlg->m_hWnd;<br />
FileOp.wFunc = FO_COPY;<br />
<br />
FileOp.pFrom = new char[300];<br />
strcpy((char*)FileOp.pFrom,ExistingFile.GetBuffer());<br />
ExistingFile.ReleaseBuffer();<br />
<br />
FileOp.pTo = new char[300];<br />
strcpy((char*)FileOp.pTo,NewFile.GetBuffer());<br />
NewFile.ReleaseBuffer();<br />
<br />
if(SHFileOperation(&FileOp) == 0)<br />
RetVal = true;<br />
else<br />
RetVal = false;<br />
<br />
delete FileOp.pFrom;<br />
delete FileOp.pTo;<br />
return RetVal;<br />
}
This is the copy code, but the delete code is just like it (except for wFunc and pTo). Actually, I can't get this function to work, either; am I doing something wrong with allocating pFrom and pTo?
|
|
|
|
|
|
If I do FileOp.pFrom = "d:\\testdir", it works, but if I do FileOp.pFrom = Dir.GetBuffer() it doesn't work, even though Dir=d:\testdir!
Also, I've been fiddling with the copy operation:
bool SHCopyFile(CString ExistingFile,CString NewFile)<br />
{<br />
bool RetBool = false;<br />
SHFILEOPSTRUCT FileOp;<br />
ZeroMemory ( &FileOp, sizeof ( FileOp ) );<br />
if(theDlg != NULL)<br />
FileOp.hwnd = theDlg->m_hWnd;<br />
FileOp.wFunc = FO_COPY;<br />
<br />
FileOp.pFrom = "d:\\test.zip";
ExistingFile.ReleaseBuffer();<br />
<br />
FileOp.pTo = NewFile.GetBuffer();<br />
NewFile.ReleaseBuffer();<br />
<br />
int RetVal = SHFileOperation(&FileOp);<br />
if(RetVal == 0)<br />
RetBool = true;<br />
else<br />
RetBool = false;<br />
<br />
return RetBool;<br />
}
If FileOp.pFrom ="d:\\test.zip", it works, but if I use ExistingFile, it doesn't. It works fine with FileOp.pTo = NewFile.GetBuffer(), though, if pFrom = "d:\\test.zip"!
|
|
|
|
|
Read the SHFileOperation() docs carefully, pFrom and pTo have to be double null terminated strings. Fill the arrays you allocate for pFrom and pTo with zeros.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
Ok, that works, but now I can't call delete on anything because of "HEAP[FLModManager.exe]: Heap block at 003F2CB8 modified at 003F2E10 past requested size of 150"
My code:
bool SHCopyFile(CString ExistingFile,CString NewFile)<br />
{<br />
bool RetBool = false;<br />
SHFILEOPSTRUCT FileOp;<br />
ZeroMemory ( &FileOp, sizeof ( FileOp ) );<br />
if(theDlg != NULL)<br />
FileOp.hwnd = theDlg->m_hWnd;<br />
FileOp.wFunc = FO_COPY;<br />
<br />
FileOp.pFrom = new char[300];<br />
strset((char*)FileOp.pFrom,0);<br />
strcpy((char*)FileOp.pFrom,ExistingFile.GetBuffer());<br />
ExistingFile.ReleaseBuffer();<br />
<br />
FileOp.pTo = new char[300];<br />
strset((char*)FileOp.pTo,0);<br />
strcpy((char*)FileOp.pTo,NewFile.GetBuffer());<br />
NewFile.ReleaseBuffer();<br />
<br />
int RetVal = SHFileOperation(&FileOp);<br />
if(RetVal == 0)<br />
RetBool = true;<br />
else<br />
RetBool = false;<br />
<br />
return RetBool;<br />
}
|
|
|
|
|
Use memset() instead of strset()
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
|
why????????
|
|
|
|
|
Hi, I get an error when i want to compile an empty C# form...
C:\C++\WindowsApplication1\licenses.licx Could not transform licenses file 'licenses.licx' into a binary resource. The format of the file 'lc.exe' is invalid.
What is that???
|
|
|
|
|
I'm not sure but I did a search on Yahoo / Google and found someone with the same problem, they said that they deleted the license file then rebuilt and it fixed their problem.. maybe try renaming the file to .old or something like that and try to re-compile..
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Found this too.. http://support.dundas.com/Articles/ArticleBody.asp?ArticleID=713
It also says to delete the file from the project..
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
I want to create some checkboxes dynamicaly from code and I want them tranparent. The problem is that I tried to create them from resource with the trasparent atribute (WS_EX_TRASPARENT) but it still didn't work. Anyway my problem is to create them dynamically. Any ideas, sugestions ?
|
|
|
|
|
WS_EX_TRASPARENT style does not make it transparent, just tells window to paint control after children. I am sure you can find plenty custom draw samples on this and others websites.
brian
|
|
|
|
|
Handle WM_CTLCOLORBTN and in your handler, call SetBkMode(TRANSPARENT) on the HDC that is passed in the message's wParam .
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
hi,
How can I check if the mouse cursor is leaving a child-window? (using api)
bye
chris
|
|
|
|
|
Hmm, same as everywhere else SetCapture(HWND);
|
|
|
|
|
yes, but I need a "onMouseOver" effect for a button (sees if the mouse is leaving the child window with no mousebutton pressed) which always works. But I can't always have the capture. SetCapture only works fine when I have a "onMouseClick" effect.
bye
chris
|
|
|
|
|
I believe WM_MOUSEMOVE is what you need.
|
|
|
|
|
You did not post very good description....
TrackMouseEvent is what you want.
|
|
|
|