|
Hi,
Well was that file open (while deleting ),check for the file attributes ( the file is a read-only file, the function fails with ERROR_ACCESS_DENIED.
),this is all i could think at the first shot .
Regards
FarPointer
|
|
|
|
|
conceptus wrote: Any idea what are the possible causes?
The file is in use. Use Handle to determine what process has it open.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I am creating an application where the user will need to define the location of two files. To make it easyer I want to give them the option to drag and drop the file onto the child window editbox system defined class. The problem is that the edit box will only handle the built in messages and passes all others onto DefWindowProc, including WM_DROPFILES. Any Ideas how I can make this work?
|
|
|
|
|
Has that window registered itself as a recipient of dropped files?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Yes it has, when run I can pick up a file and move it over the edit box and the curser changes to the drop file curser. The problem I am having is not being able to define the callback function for the system defined window class, or tell it to forward messages it doesnt handle someplace else where I can define what it does.
-- modified at 13:44 Monday 24th October, 2005
|
|
|
|
|
Do you have something like:
LRESULT CALLBACK WindowProc(...)
{
switch (uMessage)
{
case WM_DROPFILES:
HDROP hDrop = (HDROP) wParam;
char szDropName[MAX_PATH];
DragQueryFile(hDrop, 0, szDropName, sizeof(szDropName));
break;
default:
return DefWindowProc(hWnd, uMessage, wParam, lParam);
}
return 0;
}
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
|
http://www.ericphelps.com/batch/rundll/[^]
I came across this cool link that tells me how to run various control panel activities from the command line. I wonder how windows exlorer itself runs them? I dont see windows explorer doing "CreateProcess" for any of these. Any idea how windows explorer launches control panel or the run dialog box?
I am planning to use this in an application that will basically prevent kids from launching control panel while I take a break from the computer
thanks
--c
|
|
|
|
|
cgru1234 wrote: from the command line
"command line"
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
I think you did not get my point. I tried using a few api intercepting tools and I dont find windows explorer calling CreateProcess here. That is why I am wondering how it launches control panel?
Any shell experts around here?
thanks
/f
|
|
|
|
|
cgru1234 wrote: ...and I dont find windows explorer calling CreateProcess here.
Probably because it uses Control_RunDLL() instead.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
what is Control_RunDLL? I dont find it in MSDN index.
thanks
/f
|
|
|
|
|
cgru1234 wrote: what is Control_RunDLL?
It's a function used to run Control Panel applets.
cgru1234 wrote: I dont find it in MSDN index.
It's not advertised (that much, anyway). Look in shell32.dll.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
nice link, thanks for sharing.
He is like a one-legged man in a bum kicking competition. -Novjot Sidhu
--[v]--
|
|
|
|
|
cgru1234 wrote: I am planning to use this in an application that will basically prevent kids from launching control panel while I take a break from the computer
Can you not just move the .cpl files out of the way?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Can you not just move the .cpl files out of the way?
then I cannot open control panel either, right?, when my app is not running.
thanks
|
|
|
|
|
When your application closes, just move the .cpl files back to their rightful spot. Obviously this won't work if your application terminates abnormally.
Why are you wanting to restrict access to Control Panel when your application is running?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
how do i pass command line argument in MFC?
regards,
Rookie
|
|
|
|
|
Pass when and where ?
are you wanting to process the command line argument from within the application ?
if so, have a look at CCommandLineInfo and ParseCommandLine which should be placed in the InitInstance method ( I think they are placed there by default by the wizard when you create an application ).
are you wanting to add arguments to the executable when you launch it ?
if so, you can use the command tool ( dos shell ) to add arguments to the program name ( i'm not familiar with the format of the argument ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
thanks,i just tried CCommandLineInfo, but it returned nothing may be i've done wrong.
i just want to execute like,
myapp.exe "username","passwd"
then catch ihese inside the application.
in C , in the main() function ,we use argc and argv[] right?
in MFC ?
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
how about GetCommandLine();
AliR.
|
|
|
|
|
"An MFC application will typically create a local instance of this class in the InitInstance function of its application object. This object is then passed to CWinApp::ParseCommandLine, which repeatedly calls ParseParam to fill the CCommandLineInfo object. The CCommandLineInfo object is then passed to CWinApp::ProcessShellCommand to handle the command-line arguments and flags."
i really feel dumb, i dont understand anything. i'm really stupid
MSDN^
regards,
Rookie
Installing MFC...0% complete
|
|
|
|
|
(i really feel dumb)
If only I had a nickel for every time I felt dumb.... we ALL do it....
(i dont understand anything. i'm really stupid)
Uhm.... no you are not. One smart thing you did was join CP It is all about learning.
If a wizard fails to cast an enchantment correctly, is that a mis-spelling?
Never argue with an idiot. They will drag you down to their level where they are an expert.
-- modified at 16:56 Monday 24th October, 2005
|
|
|
|
|
|
You can pass arguments to the application your are running in the IDE by going to the project settings menu -> debug Tab -> program arguments edit box.
|
|
|
|