|
I have been playing around with ICopyHook, and have made a Shell Extension which implement ICopyHook, and it works perfect
The only problem is that ICopyHook only works with printers and folders. Is there any way to make something similar for files...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
My problem is:
I´m trying to replace my file name from the CString wich value is "C:\esContaX\Archivos\TblPols.dbf" to finish with something like this: "C:\esContaX\Archivos\" using the following code: m_strAppPath.TrimRight('\'); , but I get the following errors:
--------------------Configuration: esContaX - Win32 Debug--------------------
Compiling...
esContaX.cpp
C:\esContaX\esContaX.cpp(230) : error C2001: newline in constant
C:\esContaX\esContaX.cpp(232) : error C2143: syntax error : missing ')' before 'return'
C:\esContaX\esContaX.cpp(232) : warning C4305: 'argument' : truncation from 'const int' to 'char'
C:\esContaX\esContaX.cpp(232) : warning C4309: 'argument' : truncation of constant value
Error executing cl.exe.
esContaX.exe - 2 error(s), 2 warning(s)
Can somebody help me showing me how can I acomplish this.
|
|
|
|
|
|
"\" is an escape character in C-strings. Like "\n" for newline. Just double up the "\" to get a "\".
"C:\\esContaX\\Archivos\\TblPols.dbf"
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Ok this is the complete code
CString strSection = "Files";
CString strStringItem = "DataFiles";
m_strAppPath= theApp.GetProfileString(strSection, strStringItem);
// the value of m_strAppPath Now is = C:\esContaX\Archivos\TblPols.dbf
TRACE(m_strAppPath.GetBuffer(m_strAppPath.GetLength()));
//so trace shows C:\esContaX\Archivos\TblPols.dbf
m_strAppPath.TrimRight('\\');
TRACE(m_strAppPath.GetBuffer(m_strAppPath.GetLength()));
//Now trace shows the same value C:\esContaX\Archivos\TblPols.dbf
return TRUE;
|
|
|
|
|
TrimRight would trim only from Right and the first character found is 'f', so it cannot remove any '\' character. but if your path was: "C:\esContaX\Archivos\TblPols.dbf\", it would remove it!
Hope that helps!
ÿVOTD:19 "My dear brothers, take note of this: Everyone should be quick to listen, slow to speak and slow to become angry, 20for man's anger does not bring about the righteous life that God desires." - Jam 1:19
|
|
|
|
|
My release version is running fine with this:
xDontCare = "dontcare";
for (char* pc = xDontCare ; *pc ; pc++)
*pc ^= 0x30;
my debug version is crashing at the xor line. Why and how can I get past it? I rebuilt the project totally in debug version as well as release and its the xor....
help!
ns
|
|
|
|
|
Don't try to modify read only memory. This is an undefined operation.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Which part is read only memoery? Sorry to be so sense. how would you do it?
Thanks,
ns
|
|
|
|
|
Well it is a bit of an assumption on my part, but if xDontcare is just a char *, then the
xDontcare ="xxxxx";
sets xDontcare to point to a readonly string.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Okay> I can comprehend that. THanks. Now I have to rack my brains for an alternative...
ns
|
|
|
|
|
#define dontCare "dontcare";
char szDontCare [64];
strcpy (szDontCare, dontCare);
for (char* pc = szDontCare; (*pc != '\0'); pc++) {
*pc ^= 0x30;
} Please don't write code like this:
while (*pc) {
...
} It makes me weep. Do this instead:
while (*pc != '\0') {
...
} Why? Because it's easier to maintain. And maintenance costs about 4x development.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hey! Your'e back!!! Been a while.
Thanks for the resolution. I'll try it very soon - I see sort of why its not happy. Pretty tricky.
|
|
|
|
|
Heh.
How are you?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Okay I guess. Stuffs coming along so I cant complain. Lotsa little and big challenges every day. Missed you around -
Getting a new pc at work next month - hurray. I think I can spend upto 2500. Should be able to get a cool one. No XP allowed here though - so it will have to be (rolled back? ) to win2k. Oh well.
|
|
|
|
|
W2K is a good idea. For $2.5K you can get yourself a purty nice machine!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Oh, BTW - I need three different files to be able to see my xDontCare variable. I had it as an extern. If I do a #define as you say how do I make everyone see it? I'm doing the xoring in OnInitialUpdate so its set once and for all....
|
|
|
|
|
I keep my globals in a singleton Globals class. That way, from anywhere in the code, I can do stuff like:
Globals* pGlobals = Globals::getGlobals();
ASSERT (pGlobals != NULL);
printf ("%s\n", pGlobals->getDontCareString()); The Globals constructor contains all the one-time initialization code. This makes for safe coding and easy maintenance. All you need to do is #include "Globals.h" in every .cpp file that references it.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
The Globals constructor contains all the one-time initialization code.
Sorry, I lied! It's the getGlobals() method that lazily initializes the object.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Well, the strategy as stated crashed because for some odd reason (I had declared an extern xdontcare[64]), copied a blank string when I did strcpy(xdontcare,"dontcare"), so instead I did
extern char* xdontcare
and in OnInitialUpdate I did:
xdontcare = new char[64]
strcpy(...)
then it worked. Wondering why? Maybe it has to do with the positioning of my xdontcare as a global...
(and yes, I havent implemented the Globals.h idea yet... )
|
|
|
|
|
It's crashing because the compiler may store string literals in read-only memory, because you aren't supposed to modify literals. Write it like this instead:
char xDontCare[] = "dontcare";
--Mike--
Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
OK I have code that I thought I was ready to distribute - sadly it seems I "spoken" too soon.
I am compiling the code in release mode (code generation in Multithreaded DLL, no debug info), with linker settings havine debug info
I build all the code, run the installer - works fine on my system (Windows 2000 sp2, MSVC6 sp5, latest Win32 SDK)
I install the program on another Win2K box - bamm dialog complaining about missing MSVCRTD.dll - this is the debug version of the runtime !!! How can this be ? I run it through dependency checker (the latest version from the website) and get no mention of MSVCRTD.dll? WTF !!! All it shows is MSVCRT.dll links
Argggg!
|
|
|
|
|
use the dependency walker
WUSIWUG
|
|
|
|
|
Are you sure no other DLL dependency (may be loaded explicitly) is Debug build or is dependent of msvcrtd.dll?
C# is fundamentally broken. - Christian Graus
|
|
|
|
|
Well that's what I had hoped the newer version of dependency walker would show - if I open every node I see NO mention of MSVCRTD.dll
However i do see two warnings
APPHELP.dll had this:
Warning: At least one delay-load dependency module was not found.
MPR.dll had this
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
MPR has NO dependencies on MSVCRTD.dll according to dependency walker
|
|
|
|