|
Send that window (e.g., Notepad) a WM_CLOSE message.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Interesting..question and a more interesting answer...But how to get the window handle for the opened file using shellexecute?
|
|
|
|
|
ArtiGujare wrote: But how to get the window handle for the opened file using shellexecute?
First you'll need to use ShellExecuteEx() . Then, see here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi all,
i want to print the Contents of the Feilds of the Form into the Printer into the Required Alignment.
my approach.
CPringDialog dlg;
dlg.DoModal();
CDC dc;
dc.Attach(dlg.GetDC()) int h, v;
h = dc.GetDeviceCaps(HORZRES);
v = dc.GetDeviceCaps(VERTRES);
dlg.BeginDocument();
dlg.BeginPrint();
dc.TextOut("Some Text"); //Printing towards the Printer.
dlg.EndPrint();
dlg.EndDocument();
// This works fine but With GetDeviceCaps(...) i am getting the Horizontal and Verticals Coordinates of the Computer. But How to align Top,Width,Height,Bottom of the Page to Print in Correct Alignment.
please help me out.
thanks,
uday.
uday kiran
|
|
|
|
|
|
I'm in the process of writing a 'winzip' style tool.
I want to enable drag and drop so the user can drag files from my tool and drop them into win explorer.
The problem is I need to extract the files before the final 'drop' can take place.
I'm using COleDataSource::DoDragDrop to do the job but as it's a single function that does the drag and the drop I cannot extract the files to a temp folder before the process finishes!
Basiclly, I make a list of the files the user has dragged, create 0 byte files in a temp folder to fill in the DROPFILES struct but when I drop the function simply copies the 0 byte files before I can replace them with the extracted ones!
Any help would be appriciated as I've been pulling my hair out and dont have much left!
Thanks
|
|
|
|
|
|
I have a button control on a dialog. The caption is quite long, so I set the multiline property to true. The caption is centered in the button at design time, but at run time, if the display is set to Windows Classic theme, the caption appears left aligned, regardless of what value I put for the Horizontal Alignment property. What could be the problem?
|
|
|
|
|
Shree wrote: What could be the problem?
no problem, it's how the CButton class is designed.
how do you want it to behave like ?
|
|
|
|
|
Since the text appears centered during design time, I would naturally expect it to appear centered during run time. Why does it become left aligned, and only when the text does not fit in one line, and only in the Windows classic theme?
Or if the text should appear left aligned by design, how can I get it to appear centered?
|
|
|
|
|
I have an active control which is published. Now I want to add two new methods to this control to provide new functionality. Just like COM is the activex immutable ? If yes, how do I achieve it. I mean we declare new interfaces in COM when providing new functionality and QueryInterface determines whether the new functionality exists or not. How can I achieve this in activex control.
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup
|
|
|
|
|
Well, an ActiveX control IS a COM component that exposes one or more interfaces inherited from IDispatch, AKA an Automation interface.
The IDispatch interface is built on providing an index for the method or property that is used from the client side and the virtual table only contains the IDispatch methods, in short terms. There's more to it but that's irrelevant at this moment.
When creating an ActiveX you the possibility to declare the Automation interface as dual. This means that the interface has a virtual table which contains the methods that are specific to the interface derived from IDispatch and hence is immutable. Clients can use both v-table calls and the index style as desired. V-table calls are usually preferred when using C++.
Now to your question whether you can declare new methods in an existing Automation interface or not.
As you might have guessed you cannot modify an Automation interface that is a dual interface since it uses v-table calls, exactly like ordinary COM interfaces.
If, and only if, the interface is not a dual interface it is possible to add methods and properties to an existing Automation interface, given that the already existing properties and methods are unchanged and always keep their original index. Otherwise existing clients will fail to work properly.
However, even though this is technically possible, I wouldn't encourage anyone to do this.
I've seen this done at a customer of mine with all the good intentions, but later they found it difficult to tell whether the client or the server actually supported the extended interface or not.
In other words: they found themselves in similar dilemma as if they would have changed an ordinary COM interface.
If this situation is acceptable for you, or anyone that is suppose to use you ActiveX control is for you to decide. Personally I would go nuts if I was to create clients to this server.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Thanks for the detailed reply. I was wondering if instead of making changes to the original interface, is it possible to define and use a new interface. So the new clients can use the new interface while the old ones continue to use the old interface ? Thanks again.
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup
|
|
|
|
|
Identity Undisclosed wrote: I was wondering if instead of making changes to the original interface, is it possible to define and use a new interface. So the new clients can use the new interface while the old ones continue to use the old interface
This would be the correct (distributable, controlled) way of doing it.
Clients that want to use the new functionality should ask for the new interface with QueryInterface().
--
Roger
It's suppose to be hard, otherwise anybody could do it!
|
|
|
|
|
Hi all,
I have to create a custom control to show html files. I need to process the link click inside that also.
Is CHtmlView is suitable for this purpose? Or is there any other useful class to do so?
Thank you.
- NS -
|
|
|
|
|
|
Thank you.
Let me try...
- NS -
|
|
|
|
|
I have a dialog with 2 radio buttons (beside many others).
Both buttons appear OK in the .h, .rc and .clw files, but the class wizard shows only one (even after deleting the .clw file and rebuilding).
MFC.
thanks
alex
'Architecture is music frozen in space.'
|
|
|
|
|
Class wizard shows radio buttons with group property set. If you want these radio to be a group, you have to set the group property only for the first ctrl. If you set it for both, class wizard will show both the ctrls, but you will lose the auto selection switching property.
- NS -
|
|
|
|
|
Thank You.
Does that mean that if i .SetCheck() for one of them, the other is automatically unchecked?
alex
'Architecture is music frozen in space.'
|
|
|
|
|
I meant that if the user clicks one of the radio then the other will not be automatically unchecked.
- NS -
|
|
|
|
|
damn, how did you understand his question ?!
lol, well done anyway...
|
|
|
|
|
Thank you. Actually I went in your same way for a while...
- NS -
|
|
|
|
|
Sorry about the 'understandability'.
Maybe it's my English.
alex
'Architecture is music frozen in space.'
|
|
|
|
|
I have a dialog with 2 radio buttons (beside many others).
Both buttons appear OK in the .h, .rc and .clw files, but the class wizard shows only one (even after deleting the .clw file and rebuilding).
MFC.
???
thanks
alex
'Architecture is music frozen in space.'
|
|
|
|