|
Nemanja Trifunovic wrote:
If you must use raw pointers, before every new put a comment like: "Who is responsible for deleting this?" and make sure that a matching delete is called in all scenarios.
Or do what I do - as soon as you write a new statement, immediately write the corresponding delete statement. Same with any other memory allocation.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi All,
Iam not able to delete a directory, which has more than three dot(.)s in its name using SHFileOperation. But iam able to delete directory will two dot(.)s. Why this happens?
Eg. Iam able to delete directory named "1212.1212". But, Iam not able to delete directory named "192.168.1.133".
I get message as
"Cannot delete file: cannot read from source file or disk".
but the directory is present.
How can i delete this directory??
Is this due to Dos Name problem??
With Best Regards,
A.Ilamparithi
|
|
|
|
|
At a guess, it looks like the directory name is being interpreted as an IP address. You may need to prepend additional information ro fully qualify the actual location of the directory.
e.g.
"C:\192.168.1.133"
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
Hi
I tried with full pathname only like the one you mentioned above.
eg.
SHFILEOPSTRUCT shFileOp;
ZeroMemory(&shFileOp, sizeof(SHFILEOPSTRUCT));
_TCHAR *p="c:\\temp\\temp1\\192.168.1.133";
shFileOp.hwnd=NULL;
shFileOp.wFunc=FO_DELETE;
shFileOp.pFrom=p;
//shFileOp.fFlags=FOF_SILENT/*|FOF_NOCONFIRMATION*/;
SHFileOperation(&shFileOp);
Regards,
A.Ilamparithi
|
|
|
|
|
Isn't the filename supposed to be double null termainated. That may cause a problem...
Address of a buffer to specify one or more source file names. These names can be either fully qualified paths, or standard DOS wild cards such as "*.*". Although this member is declared as a null-terminated string, it is used as a buffer to hold multiple file names. Each file name must be terminated by a single NULL character. An additional NULL character must be appended to the end of the final name to indicate the end of pFrom.
John
|
|
|
|
|
the windows explorer can view files as thumbnails. i have image files with my very special format, and i would like that the explorer shows also thumbnails for this files. how does this work? atl? com? ...
|
|
|
|
|
Hi everyone,
I have a DLL with some classes in it. Header file have dllexport feature on class.
This class has some methods, several of them are virtual.
So, the problem is that my test app looking for Foo method in DLL, but can't find it because in DLL it's defined as FooA, but not Foo.
Can somebody tell me what's wrong?
In this [post^] I describe situation in detailes with some code examples.
Thanks in advance,
va'Lery.
|
|
|
|
|
I'm not positive on this, but I believe the A specifies that the function is cdecl. I'd double-check the calling conventions.
--
Joel Lucsy
|
|
|
|
|
Thanks for an idea.
I tried all three possible conventions, but result is still the same.
So that's not it.
va'Lery
|
|
|
|
|
I suspect that in the DLL, the function has the same name as a Windows function whose header you have included, while you haven't included the same header in the application.
Example: the Windows header WinBase.h defines the functions DeleteFileA and DeleteFileW . It also maps the name DeleteFile via a macro to DeleteFileA or DeleteFileW depending on whether the UNICODE symbol is defined. This allows you to switch between using the ANSI and Unicode versions of the functions simply by defining or undefining UNICODE .
Unfortunately the macro processor has no idea of scope and doesn't realise that you actually wanted to refer to a class member function rather than to refer to the Windows function, so it replaces your Foo with FooA.
Solutions: either rename the function, or #undef the macro. If you #undef the macro, consider using #pragma push_macro and #pragma pop_macro to store and retrieve the macro value (supported in VC 6.0, even though undocumented).
Using #undef in this way is a real hassle, though, so I'd simply rename the offending function.
|
|
|
|
|
That's it!
You're absolutely right.
Thanks a lot!
|
|
|
|
|
Hello!
use UndName.Exe and pass full decorated function name to see it's full undecorated name.
|
|
|
|
|
//......... struct for passing info to Escape........
struct Buff
{
DWORD BufLength;
char str[256];
};
//..............This is the code snippet................
char* outPut=(char*)malloc(sizeof(char)*256);
CString sControlCode;
CDC cdc;
cdc.CreateDC(NULL, m_cmbPrinters, NULL, NULL);
DOCINFO di;
::ZeroMemory(&di, sizeof(DOCINFO));
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = "My Doc";
cdc.StartDoc(&di);
cdc.StartPage();
sControlCode.Format("%x%x",27,'E');
cdc.TextOut(12,34,"Hello Test Out here .... ");
Buff b;
int index=0;
char *p=sControlCode.GetBuffer(256);;
while(*p!='\0')
{
b.str[index++]=*p;
p++;
}
b.str[index++]='\0';
b.BufLength = sControlCode.GetLength();
int s=PASSTHROUGH;
if(cdc.Escape( QUERYESCSUPPORT, sizeof(int) , (const char*)&s , strlen(outPut) , outPut ))
{
cdc.Escape( PASSTHROUGH, 0 , (LPCSTR) &b , strlen(outPut) , outPut );
}
cdc.TextOut( 0, 150, "PASSTHROUGH Escape Function" );
cdc.EndPage();
cdc.EndDoc();
cdc.DeleteDC();
//..................
The printer code "ESC E" for the Epson LX 1050+ enables emphasized printing.
When i use the WritePrinter Api i pass the printer code as '\x1b\x45' and it works fine.The next line gets printed in bold.The WritePrinter Api needs handle to printer device but i need to do the printing through the device context.So the only way to pass printer code is via Escape.But when i pass the string via "Escape" the printer doesn't see it as a command,it just sees it as some non-printable character.So,how do i give printer commands via escape.Please,can someone help me out?
|
|
|
|
|
I suspect that your buffer b does not contain the two bytes of value x1B and E. Try hardcoding the Escape call to pass "\x1BE" and a length of 2.
EX: cdc.Escape(PASSTHROUGH,2,"\x1BE",NULL);
onwards and upwards...
|
|
|
|
|
I tried this code.
EX: cdc.Escape(PASSTHROUGH,2,"\x1BE",NULL);
But i'm getting the following compile time error.
: error C2022: '446' : too big for character.
i tried this code in this manner also.
EX: cdc.Escape(PASSTHROUGH,2,"\x1B\x45",NULL);
now the complie time error gone but it's gives a "memory could not be read" run time error.
Hope you will be able to nail it down.
|
|
|
|
|
Are you compiling with unicode?
onwards and upwards...
|
|
|
|
|
Hi !
I'd like to know if it's possible to have a template class being friend of another template class to access it's private members.
For example, I'd like the class CTreeNode<T> to be friend of CTree<T>.
I tried several syntaxes :
friend class CTree;
friend class CTree<T>
but it didn't work and I cannot think of another syntax.
How can I do this ?
Thanks !
Jerome
|
|
|
|
|
if parameter T is the same in both case, typing that would be good :
<font style="color:blue">template class</font> CTree<<font style="color:blue">typename</font> T> {
<font style="color:green">
<font style="color:blue">public</font>:
<font style="color:green">
<font style="color:blue">friend class</font> CtreeNode<T>;
};
TOXCCT alias Nicolas C.
|
|
|
|
|
hi all,
i'm ashamed to ask such questions, but i can't even figure it out how i can form a query to search for this on the web site or the internet...
1. i need to mimic standard menu items from user-defined ones... let me explain, MFC - standard MDI app (made by the wizard) has few standard menu items (File->Open... for example). Now i made a dilog, which has a button in it, and if the user clcks that button, the handler must act like it's a standard CDocument::OnOpenDocument(...) method. I know, I can construct CFileDialog myself, show it to the user and call CMyDoc::OnOpenDocument(string)... but this will defeat Doc-View approach... What can i do? Just send the message ID_FILE_OPEN... to what window than??
2. right button click and a popup menu appears. what's it name? where can read more about it?
thanks for your time!
alex
debug - is my life style
|
|
|
|
|
lobanovski wrote:
2. right button click and a popup menu appears. what's it name? where can read more about it?
It is called a "context menu". MSDN and CodeProject have information on them.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
I'm trying to design some generic callbacks, which works well enough (using similar techniques to Andrescu's ScopeGuards[^]), except for the return value of the callback function.
for void, it#s simple:
struct CCallback { virtual void Call() = 0; }
template <class T>
struct CCallbackFunc_0 : public CCallback
{
T func;
CCallbackFunc_0(T func_) : func(func_) {}
void Call() { func(); }
};
template <class T>
CCallback * CreateCallback(T func_)
{
return new CCallbackFunc_0<T>(func_);
}
Now I figure I could have two separate branches, one templatized over the return type, but this makes a lot of code, and breaks the nice syntax for using CreateCallback.
Any ideas? Suggestions? Other approaches?
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
Have you tried using a template, specifying void as the return type? The compiler will spit out a warning (not an error) if a void function returns a value, which you can safely ignore.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I'd like to be able to receive the return value when I do the "Call" through the base class (hence the idea of templating the base class over return type)
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
i would like to build an application to communicate with the Proxy. hw to do it
Thank You
|
|
|
|
|
I cant give you direct solution, but can give you pointers.
you need to know which proxy you are targeting,
HTTP 1/1 proxy, or sock, etc
mostly it is HTTP 1/1 proxy, so if you could refer the RFC for HTTP you will know how to do it.
regards,
Prakash.
Toughest Steel Comes From Hottest Furnance
|
|
|
|