|
To use ShellExecute on .cpl you simple do this
ShellExecute(NULL, _T("open"), _T("cplfile.cpl"), NULL, NULL, SW_SHOW);
The API will take care of finding out the command for it.
You do not need to do this yourself.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
that's the issue
cplfile does not have shell command named Open
it has Open with Control Panel shell command
now even with above both items, it is not invoking the control panel item
//ShellExecute(NULL, _T("Open with Control Panel"), _T("c:\\windows\\system32\\main.cpl"), NULL, NULL, SW_SHOW);
ShellExecute(NULL, _T("Open"), _T("c:\\windows\\system32\\main.cpl"), NULL, NULL, SW_SHOW);
it seems
it would require
control.exe to be passed in with open and pass the cpl file as parameter
|
|
|
|
|
it works as given below
ShellExecute(NULL, _T("Open"), _T("control.exe"), _T("main.cpl"), NULL, SW_SHOW);
however
that does not make it generic
|
|
|
|
|
I don't know if this will help you but using FindExecutable() you can get the program that is associated with a file without looking in the registry
Rozis
|
|
|
|
|
hey buddy
thanks a lot, yes that function sound promising, will give a try and will post results here.
regards
|
|
|
|
|
Hello,
After i start a new EXE by calling the ShellExecute function, is it possible
for me to close or destroy that process by using another function?
Is there a function that does that?
Thanks
|
|
|
|
|
Use ShellExecuteEx[^] instead of ShellExecute, as you can get a process handle using that function.
You can then manipulate the process with that handle - to destroy it, call TerminateProcess[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I'm using CArray - derived classes in my app. I have bug somewhere I cannot reproduce, I think it could be accessing CArray by index out of range (but I'm not sure). When I do so, default implementation CWinApp::ProcessWndProcException() displays the "An invalid argument was encountered." and after confirming program continues which is bad.
What I need to do is to make my program to crash, because I have exception handler in my app which creates and sends crash dump to me and I need to see which access to array caused the exeption. How can I disable default CException* handler?
I've overriden my ProcessWndProcException() and put THROW_LAST and also just "throw" but it didn't help. Message box was not displayed but nothing happened, program does not crash. Putting "int 3" into handler does not help, because it crashes but I cannot see in stack trace where was bad access to the array, just useless exception hadler. Any idea what could I do?
I don't want to add try/catch to each array access, there are dozens of that in program
Thank you.
|
|
|
|
|
What you want to do is to run your app under the debugger and get the debugger to break when an exception is thrown (the Debug->Exceptions menu item (IIRC) opens a dialog that allows you to do this.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I do not want to run it in debugger, I want it to run at customer's computer and send me the correct crash report (currently working for unhandled non-CException exceptions)
|
|
|
|
|
OK - here's a thought...
I'm presuming you're using CArray code in afxtempl.h. This calls AfxThrowInvalidArgException() to throw the exception you're seeing.
Why not use a #define to change what AfxThrowInvalidArgException means?
If we use this articles[^] code to provide a stackwalker, you could do something like this #define (put it in your code BEFORE you #include afxtempl.h)
#define AfxThrowInvalidArgException() { StackWalker sw; sw.ShowCallstack(); AfxThrowInvalidArgException(); }
You'd need to add something to change how the stack trace is displayed, and also distribute dbghelp.dll with your app, but I think it could help you?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you for idea, I was now going to create some CArrayEx template which would derive from carray and add AfxThrowInvalidArgException() as member function which would just throw -1 or something. Macro approach is faster so I'm going to give it a try.
Still it looks to me weird why rethrowed CException just disappeared and didn't crash the app. When I was tracing my (re)throw in debugger, it wanted to go to some throw.cpp file but didn't have a source.
|
|
|
|
|
#define approach does not work. It is ignored and I'm still getting old exception. I'm afraid I'll have to create my own template for CArray or redesign all the code to std::vector
|
|
|
|
|
rrrado wrote: redesign all the code to std::vector
Not such a bad idea - I gave up on CArray over 10 years ago, when I was using VC5 (which was even shonkier with templates than VC6).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
If I'd thought a bit more, I'd have realised that could never work for various reasons. However, this suggestion does let you intercept AfxThrowInvalidArgException:
- BEFORE you #include any MFC headers (so put this in your stdafx.h), add this:
#define AfxThrowInvalidArgException MyThrowInvalidArgException - Now add this code at the end of one of your .cpp files, changing the body to suit what you want to do
void __stdcall MyThrowInvalidArgException()
{
#undef AfxThrowInvalidArgException
OutputDebugString(_T("WHOOPS"));
void __declspec(noreturn) AFXAPI AfxThrowInvalidArgException();
AfxThrowInvalidArgException();
}
I've tried this under VS2008 with a simple MFC app and MyThrowInvalidArgException was called when I executed this code:
CArray<int, int> arr;
arr.GetAt(100);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you very much for your time. I've made it to work with macro, but modified, I hope it will help me.
|
|
|
|
|
Hi iam working on LotusNotes, plz let me know how to get created date from a Document,. i can able to retrieve PostedDate by using. date.GetDateSent(), plz let me know which function is helpful for me to retrieve CreatedDate.
|
|
|
|
|
GetCreated(); function may be help full to get the created date for a message
|
|
|
|
|
I have a Problem when coverting System time to file time and assigning it to a Mail in Mapi, My problem is i dont have control on setting AM,Pm of a time and which is adding 5:30 hrs extra to a time how to control AM and PM and assign a correct time i need the conversion compulsory,
Any help is highly appreciated
SYSTEMTIME systemtime;
FILETIME filetime;
systemtime.wYear=2009;
systemtime.wMonth=3;
systemtime.wDay=1;
systemtime.wDayOfWeek=5;
systemtime.wHour=5;
systemtime.wMinute=30;
systemtime.wSecond=17;
systemtime.wMilliseconds=39;
SystemTimeToFileTime(&systemtime,&filetime);
prop.ulPropTag = PR_CREATION_TIME;
prop.Value.ft=filetime;
pNewMessage->SetProps(1,&prop,NULL);
|
|
|
|
|
Pardhu_M wrote: My problem is i dont have control on setting AM,Pm of a time
Ummm - you've heard of the 24 hour clock[^]? AM times in SYSTEMTIME have hour =0-11, PM times have hour=12-23. So 5PM is hour 17.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Actually my problem is when i assign values to system time and convert it into file time it is adding 5.30 GMT which i dont need it i need actual time which i assigned to system time.
|
|
|
|
|
What timezone are you in? Is it possibly India, which is 5 hours 30 minutes ahead of GMT?
That's where the delta's coming in, I would suggest. You need to learn the difference between UTC times (which is how FILETIMEs are interpreted) and local times. There are functions that can help you convert between local and UTC times, but FILETIMEs are always interpreted as UTC.
[edit]The reason you see the conversion to FILETIME as adding 5.5 hours is that when you see the presentation of the filetime, it's through a function that applies a timezone offset (GMT -> India), adding 5.5 hours.
What you need is to use TzSpecificLocalTimeToSystemTime[^] to convert your original, local SYSTEMTIME to a UTC SYSTEMTIME. Then use SystemTimeToFileTime to convert the UTC SYSTEMTIME to a FILETIME.[/edit]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks Buddy I got It........
|
|
|
|
|
Hi every one
There is one application on my system that it’s opened my Clipboard and Empty it. but didn’t close Clipboard until closing the application .
I want attach to application by my application and send closeclipboard api to it.
Its my code but don’t work . how can i empty clipboard when it has been opened by another program?
Plz help me.
CWnd *pWnd=new CWnd();
BOOL bo,be,bc;
pWnd= GetOpenClipboardWindow();
pWnd=FindWindow("Application class name","Application title");
if(pWnd)
{
bo=pWnd->OpenClipboard();
be=EmptyClipboard();
bc=CloseClipboard();
}
modified on Saturday, July 11, 2009 8:01 AM
|
|
|
|
|
How to Get the installer path of Internet Explorer using C++
|
|
|
|