|
It sounds like you've got a unicode string, so use the wcslen() function instead. It performs the same function is strlen() but on unicode strings.
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 want to get a notification to my program, whenever some one copies a file to my folder, I tried ICopyHook, but I get alert only when someone copies a folder, but not on file.
http://www.priyank.in/
|
|
|
|
|
Please try ReadDirectoryChangesW .
|
|
|
|
|
vikrams wrote:
Please try ReadDirectoryChangesW .
I don't want my program to be always run in background and should be able to stop the copy operation, if I wish.
http://www.priyank.in/
|
|
|
|
|
Without running at least a service in the background this is not possible.
[EDIT]
And then there is always the possibility for the user to take the disk to another machine or use partition magic or ghost and copy at will...
[/EDIT]
John
|
|
|
|
|
Hello Sir,
Little clarification needed, What about ICopyHook , which detect Folder Operation, run as InProcess ATL DLL. i.e. no need of External EXE
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
But what if I use taskmanager to kill explorer and do the copy from the file the command line?
John
|
|
|
|
|
Hello Mr John,
I am not pulling you Leg,i just want to ask as there is ICopyHook for Folder,is there is anything similiar to FILES too
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
ICopyHOOK:
MSDN says
ICopyHook is a COM-based interface used to create a copy hook handler. A copy hook handler is a Shell extension that determines if a Shell folder or printer object can be moved, copied, renamed, or deleted. The Shell calls the ICopyHook::CopyCallback method prior to performing one of these operations.
No use for files.
|
|
|
|
|
|
|
Ya, but that is part of the shell, no separate executable is running only explorer.exe will do the job for that.
http://www.priyank.in/
|
|
|
|
|
There is one other thing even if this worked for files. It would not stop or detect someone from writing a 15 line program that read the file and saved it to disk.
John
|
|
|
|
|
John M. Drescher wrote:
not stop or detect someone from writing a 15 line program
Who said this software is for CP members, its just for my client
http://www.priyank.in/
|
|
|
|
|
Priyank Bolia wrote:
its just for my client
My guess is the file contains some type of code that will unlock the features of your program for one pc and you don't want him/her to copy the file to other computers violating the license. If this is so you could hide this in a hidden file in some folder that it not expected (several levels from the root) or better yet hide it in the registry as the average user would not find it there unless you name you name it something obvious...
John
|
|
|
|
|
John M. Drescher wrote:
My guess
Times Out......
You guess wrong, the problem is the original one only, I software "FileSecure" that makes a folder safe, you can read, edit, delete, copy, etc. on that folder on any Win platform and file system and also it should work in safe work.
http://www.priyank.in/
|
|
|
|
|
Hi,
I am developping a new CORBA application from Visual C++.
I reach to create new objects into a server and link their reference, i.e IOR, from a cliente in order to make calls to methods from its remote interface. I do all this using a text tile that the server writes and the client reads in order to get the IOR.
I would like to use a NameService in order to not using that text file and start developping a real remote distrubited application.
My code is the following one, and is the same as described for example by Omni distribution:
--------------------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////
static CORBA::Boolean
bindObjectToName(CORBA::ORB_ptr orb, CORBA::Object_ptr objref)
{
CosNaming::NamingContext_var rootContext;
try {
// Obtain a reference to the root context of the Name service:
CORBA::Object_var obj;
obj = orb->resolve_initial_references("NameService");
// Narrow the reference returned.
rootContext = CosNaming::NamingContext::_narrow(obj);
if( CORBA::is_nil(rootContext) ) {
cerr << "Failed to narrow the root naming context." << endl;
return 0;
}
}
catch(CORBA::ORB::InvalidName& ex) {
// This should not happen!
cerr << "Service required is invalid [does not exist]." << endl;
return 0;
}
try {
// Bind a context called "test" to the root context:
CosNaming::Name contextName;
contextName.length(1);
contextName[0].id = (const char*) "test"; // string copied
contextName[0].kind = (const char*) "my_context"; // string copied
// Note on kind: The kind field is used to indicate the type
// of the object. This is to avoid conventions such as that used
// by files (name.type -- e.g. test.ps = postscript etc.)
CosNaming::NamingContext_var testContext;
try {
// Bind the context to root.
testContext = rootContext->bind_new_context(contextName);
}
catch(CosNaming::NamingContext::AlreadyBound& ex) {
// If the context already exists, this exception will be raised.
// In this case, just resolve the name and assign testContext
// to the object returned:
CORBA::Object_var obj;
obj = rootContext->resolve(contextName);
testContext = CosNaming::NamingContext::_narrow(obj);
if( CORBA::is_nil(testContext) ) {
cerr << "Failed to narrow naming context." << endl;
return 0;
}
}
// Bind objref with name Echo to the testContext:
CosNaming::Name objectName;
objectName.length(1);
objectName[0].id = (const char*) "Echo"; // string copied
objectName[0].kind = (const char*) "Object"; // string copied
try {
testContext->bind(objectName, objref);
}
catch(CosNaming::NamingContext::AlreadyBound& ex) {
testContext->rebind(objectName, objref);
}
// Note: Using rebind() will overwrite any Object previously bound
// to /test/Echo with obj.
// Alternatively, bind() can be used, which will raise a
// CosNaming::NamingContext::AlreadyBound exception if the name
// supplied is already bound to an object.
// Amendment: When using OrbixNames, it is necessary to first try bind
// and then rebind, as rebind on it's own will throw a NotFoundexception if
// the Name has not already been bound. [This is incorrect behaviour -
// it should just bind].
}
catch(CORBA::COMM_FAILURE& ex) {
cerr << "Caught system exception COMM_FAILURE -- unable to contact the "
<< "naming service." << endl;
return 0;
}
catch(CORBA::SystemException&) {
cerr << "Caught a CORBA::SystemException while using the naming service."
<< endl;
return 0;
}
return 1;
}
//////////////////////////////////////////////////////////////////////
int
main(int argc, char **argv)
{
try {
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
Echo_i* myecho = new Echo_i();
PortableServer::ObjectId_var myechoid = poa->activate_object(myecho);
// Obtain a reference to the object, and register it in
// the naming service.
obj = myecho->_this();
CORBA::String_var x;
x = orb->object_to_string(obj);
cerr << x << "\n";
if( !bindObjectToName(orb, obj) )
return 1;
myecho->_remove_ref();
PortableServer::POAManager_var pman = poa->the_POAManager();
pman->activate();
orb->run();
}
catch(CORBA::SystemException&) {
cerr << "Caught CORBA::SystemException." << endl;
}
catch(CORBA::Exception&) {
cerr << "Caught CORBA::Exception." << endl;
}
catch(omniORB::fatalException& fe) {
cerr << "Caught omniORB::fatalException:" << endl;
cerr << " file: " << fe.file() << endl;
cerr << " line: " << fe.line() << endl;
cerr << " mesg: " << fe.errmsg() << endl;
}
catch(...) {
cerr << "Caught unknown exception." << endl;
}
return 0;
}
.....................................................................................................
I run the application omniNames.exe with parameters:
omniNames.exe -start 12345 .. . . . .
That seems to work. It runs in console mode, not as a service.
If I execute my server, with the code descrive on top, I get the following exception error:
catch(CORBA::SystemException&) {
cerr << "Caught CORBA::SystemException." << endl;
}
Otherwise, If I replace the following line
obj = orb->resolve_initial_references("NameService");
for that one:
obj = orb->resolve_initial_references("corbaloc:iio:localhost:12345/NameService");
Now, I don't get the same error, I get other one:
catch(CORBA::ORB::InvalidName& ex) {
// This should not happen!
cerr << "Service required is invalid [does not exist]." << endl;
return 0;
Does anybody have any idea what is happening?
Must I run omniNames as a service? and if so, Why?
Do I need other configuration?
I would like to use Omni CORBA distrubution.
Thanks, and pardon for my english ( I am spanish... )
.
|
|
|
|
|
I think that you have trouble locating your nameming server. Did you start up a naming server?
Blog[^]
|
|
|
|
|
Thanks for answering...
Yes, I think.
I started NameService as follows:
"C:\omni\bin\x86_win32\omniNames.exe -start 12345 -logdir C:\omni -errlog C:\omni\errlog"
It seems I have initialized my NameService at port 12345
I have created my NameService.bat on it and It seems to work. I runs.
The problem is when I run my Server.
Is there anything more I have to do?
.
|
|
|
|
|
Yes, the following things should always be done (with every code you write)
<list> Write code that handles errors where errors can be expected (you did this)
If you find an error don't just print "ERROR" Print as much information as you can. This information often is found in the caugth exception, or can be obtained through some api's
Without that information, many things could be happening. Maybe you run a firewall that blocks your namingserver, etc...
Blog[^]
|
|
|
|
|
Hi everyone,
in your resources you can set resources for different language. The appropriate language is loaded according to you windows language. Therefor in your resource file you have to add e.g. '#if defined(AFX_TARG_NLB)' for you dutch resources.
Now, I have a database containing a field with strings in dutch in it and a field with its english translations. If the dutch resources are loaded I want to take the dutch field. I no dutch resources are loaded I want to take the english field.
Therefor I want to do this in my cpp file:
#if defined(AFX_TARG_NLB)<br />
m_iLanguage = Dutch;<br />
#else<br />
m_iLanguage = English;<br />
#endif
And use the m_iLanguage variable in my database query for fetching the right language.
I guess AFX_TARG_NLB is defined if the windows version has dutch language, AFX_TARG_ENG when windows has english language. These macros seem to be only defined in .rc files.
So the problem is: the AFX_TARG_... are not defined in my cpp files. How comes and does someone know how to solve it?
µAnother thing, does someone has a solution for this: http://www.codeproject.com/script/comments/forums.asp?forumid=1647&XtraIDs=1647&searchkw=afx_targ_enu&sd=2%2F26%2F2001&ed=5%2F27%2F2005&select=463413&df=100&fr=92935.5#xx463413xx[^]
thx
|
|
|
|
|
I’m about to insert a Win32 window in a CWnd (or more specific an COleControl). I’m an old MFC-coder and not really good att Win32 API. After what I understand I should take care of the HWND instance of CWnd…
How do I make the sole Win32 window to stretch over my CWnd… ?
Thanks in advance…
_____________________________
...and justice for all
APe
|
|
|
|
|
I'm having a problem with the CreateControl method of the CWnd object.
I can create the ActiveX but it seems that the Ctrl-c and Ctrl-v is not forwarded to the Active X but all the general key press works.
When i insert the ActiveX in the OLE test container the Ctrl-c and Ctrl-v works fine.
Please help me.
Thanks
|
|
|
|
|
Johan Odin wrote:
I can create the ActiveX but it seems that the Ctrl-c and Ctrl-v is not forwarded to the Active X but all the general key press works.
Have you got an accelerator table loaded which has those combinations as a shortcut? If so, you'll have to disable it or remove the combinations you want the control to handle.
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"
|
|
|
|
|
A very big thanks to you Ryan, now it works!
|
|
|
|