|
Hi there, I´ve looked through the Shell API doc´s and searched through the MSDN, but cannot find any doc´s about programmatically using the "open with" dialog box. Here´s my problem...
Using ::ShellExecuteEx(...) I´m opening a file (with the path, filename etc.),
I get notification from ::ShellExecuteEx if the associated program was successfully started, or an error if no application is asscoiated with the particular file. On recieving this error, I woukd like to show the "Open with" dialog. Anyone got any ideas?
Thanks in advance
Phil
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
it's shell32.dll!OpenAs_RunDLL, but i don't know the parameters...
i hope this will help!
|
|
|
|
|
When a date field mapped to the CDateTimeCtrl has no data, the DateTime controls pops up with 12/31/1969 instead of system date. Can this be fixed so that it pops up with current system date?
-Elizabeth
Eilzabeth
|
|
|
|
|
dtCtrl.SetTime();
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
I tried this, but it will not work. The time will get saved to the database even with no user interaction to the control. I don't want to save if no change.
-Elizabeth
Eilzabeth
|
|
|
|
|
Elizabeth Chang wrote:
The time will get saved to the database even with no user interaction to the control.
I don't understand. How is it that your date control is tied to a field in the database?
Without knowing anything about what you have there, I'll venture to say that the underlying code detects changes to the controls and sets the record's flag to "Modified" or "Dirty", or something like that.
There's gotta be a way for you to do something like this:
bool bModified = GetModified();
if (date field in database is Null)
dtCtrl.SetTime();
SetModified(bModified);
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
I map the field to the control in DoDataExchange(). When an UpdateData(TRUE) is sent, the field is marked as dirty because of SetTime function. The value from the control is saved to the database.
-Elizabeth
Eilzabeth
|
|
|
|
|
In that case, you can do the same thing I explained, but use IsFieldDirty and SetFieldDirty instead of GetModified/SetModified.
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
I am not sure if I get it all. I created a class CDateTimeCtrlEx (drived from CDateTimeCtrl) and created a public member variable BOOL m_modified. I have Date fields in almost every form. Am I going to have to do this for each Date field?
--------------begin program code--------------------
void CDateTimeCtrlEx::OnDatetimechange(NMHDR* pNMHDR, LRESULT* pResult)
{
m_modified = TRUE;
*pResult = 0;
}
void CDateTimeCtrlEx::DisplayNullDate()
{
SetTime(&CTime::GetCurrentTime());
SetFormat("''");
}
void CDateTimeCtrlEx::ResetFormat()
{
SetFormat("M'/'dd'/'yyyy");
}
-----------------end program code-------------------
In my application OnDataExchange event:
--------------begin program code--------------------
void CTest_dateView::DoDataExchange(CDataExchange* pDX)
{
CRecordView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTest_dateView)
DDX_Control(pDX, IDC_DATETIMEPICKER_END, m_dtEnd);
DDX_Control(pDX, IDC_DATETIMEPICKER_BEGIN, m_dtBegin);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER_END, m_pSet->m_DATE_END);
DDX_FieldText(pDX, IDC_EDIT_NAME_1, m_pSet->m_NAME_1, m_pSet);
DDX_FieldText(pDX, IDC_EDIT_NAME_2, m_pSet->m_NAME_2, m_pSet);
//}}AFX_DATA_MAP
m_dtBegin.ResetFormat();
if (!m_dtBegin.m_modified && m_pSet->m_DATE_BEGIN == 0)
{
m_dtBegin.DisplayNullDate();
}
else
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER_BEGIN, m_pSet->m_DATE_BEGIN);
m_dtBegin.m_modified = FALSE;
}
-----------------end program code-------------------
Eilzabeth
|
|
|
|
|
I am trying to write some code that will loop in a specified directory to check for some file extentions and then delete them. I Know how to open , delete and so on. But i do not know if there is a way to get the directory list of file names so that i can then Iterate through that.
Any help would be great!
|
|
|
|
|
Take a look at the CFileFind class in MFC - it is designed to do exactly that. Alternatively if you are just using the Windows API, you can use the FindFirstFile() and FindNextFile() API functions.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
|
Use the CFileFind object.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Look at the class CFileFind. And specifically the FindFile and FindNextFile member functions.
Good luck.
Always remember the building blocks of the universe:
Electrons, protons, neutrons, morons.
|
|
|
|
|
I've write a program that can build a decision tree model, so training
rules are made. But now, i dunno how to feedback the instances to the
model in order to calculate the training and testing errors. My
program is written in c++.
hkbeckham
|
|
|
|
|
I haven't got a clue what you're talking about ...
This is not a simple problem to diagnose without understanding the domain, the algo and the code
Can you be really more precise as to what is not working ? is it the code, is it the design, is it the specs, is it the algorithm ?
Thanks.
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
I have two or more non-window objects (doesn't matter what kind...generic). The objects can be instances of different classes. I want one of the objects to signal the other objects when a change has occured in its state. (such as the change in one of the member variables...modified thru a Set function).
How is the best way to signal the other objects that a change event has occured?
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
give each object a pointer to the other object, so that each can call a member function on the other when the 'event' occurs. maybe you could derive them both from a common "event handler" class with methods for singalling events.
(off the top of my head)
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
Chris Losinger wrote:
give each object a pointer to the other object
I wanted to avoid doing that.
Chris Losinger wrote:
maybe you could derive them both from a common "event handler" class with methods for singalling events.
That has posibilites...I'll have to think about it.
Thanks
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Have a look at the Observer Pattern.
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Maximilien wrote:
Observer Pattern
Those are new to me...what are they? The only reference I find to Observer in msdn is Java related.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
|
Thanks...will give it a look
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Thanks for the links!
I decided to follow them, and whadayaknow, I learned about the Observer pattern. And they say you can't teach an old dog new tricks. I guess I do my best learning when I'm not forcing myself to learn something.
It's a nice pattern. I'm trying to remember if I've ever used it without being aware of its name, and no, I can't say I have. It's usually a lot simpler and more efficient to link classes directly. Still, I really liked that 1st implementation you gave. I'll keep it in mind for future projects.
Say, what other patterns do you readily use? I know there's lots of them, but what else besides Singleton and Observer do you use on a regular basis?
Thanks again,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|