|
MFC Supports Print preview only for applications with Document/View Architecture. I'd like to print from the Modal dialog and also want to have Preview Dialog. Any Samples already there?
|
|
|
|
|
There sure is. Take look in the printing section. I have presented a base class to use instead of CDialog there which gives a CDialog the same interface as a standard CView for printing
If you vote me down, my score will only get lower
|
|
|
|
|
If C++ already supports the C Standard Library, why do
we need to declare extern "C" when using C-linkage?
When do we use extern "C"? Is this compiler-specific
feature? Or is it defined in the standard ANSI C++?
On MSDN, it says Microsoft C++ supports the strings
"C" and "C++" in the string-literal field. However,
I have never seen something like extern "C++". Has
anyone seen it? Will we ever need to use extern "C++"?
Thanks
|
|
|
|
|
Hello Alex,
The extern "C" declaration is used to tell the C++ compiler not to mangle the symbol which is being declared.
When the C++ compiler encounters a function name like "DisplayCurrentThreadId()" which has not been declared as extern "C", it will emit a symbol for it which will look like the following :
?DisplayCurrentThreadId@@YAXXZ
The actual symbol produced depends on the compiler used (the above was produced by VC++ 6.0). This symbol will be used in the resulting OBJ file for linking purposes.
C++ has a variety of reasons for symbol name mangling, of course. But the reason for the mangling of function name (both class functions and global ones) is to enable function name overloading (i.e. using the same function name with different parameter types).
If extern "C" was used to declare the function, the symbol produced for it could be :
_DisplayCurrentThreadId
This depends on the compiler used. But the bottom line is that no function name overloading will be allowed (since the C language does not support this, hence extern "C").
Hope this helps.
Best Regards,
Bio.
|
|
|
|
|
Bio,
Thanks for your reply. I have one more question, does
the term extern "C" has anything to do with the storage
specifier extern?
Now that I understand name mangling, I wonder if extern "C"
is a C++ language feature, or is it compilers' feature?
|
|
|
|
|
Alex Ngai wrote:
does
the term extern "C" has anything to do with the storage
specifier extern?
no, not at all.
Alex Ngai wrote:
I wonder if extern "C"
is a C++ language feature, or is it compilers' feature?
C++ standard specification.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
extern C++ is defined in the standard to mean do whatever the compilers default C++ is.
since this is the default it is almost never used.
|
|
|
|
|
Hello!!
Can anyone suggest source code/article on how to read/view multi-page TIFF files..
Thanks?
|
|
|
|
|
what is a "multi-page TIFF" ????
isn't a TIFF file a picture ? this way, how can a picture be multi-page ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
i already got CxImage to read/view TIFF files... i searched it here in codeproject..
TIFF is a file format for handling fax images.. Its multi-page because, one .tif file can have 1 or more bitmap( frames) on it....
|
|
|
|
|
How can I find out if the window with input focus belongs to a certain process?
I do have a process handle, basically, I want to know if a child process has input focus.
we are here to help each other get through this thing, whatever it is Vonnegut jr. boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
You can call GetWindowThreadProcessId() to get the process and thread IDs that created a window. Not sure how you convert from a process ID to a process handle, but hopefully that'll help.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Magnae clunes mihi placent, nec possum de hac re mentiri.
|
|
|
|
|
Michael Dunn wrote:
how you convert from a process ID to a process handle
I think This Api Will Help OpenProcess ,it return Process Handle based on PID
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi All,
i am new to networking . I am trying to make a client server chat system. I need some help to start with , like tutorials on socekt programming.
can anybody help me with this?
Thanks
bye
elec
|
|
|
|
|
|
In the Win32 API (or atleast I think it's in the Win32 API), the AsyncKeyState function can be used to see if a keyboard button is pressed.
Does anyone know the code for the buttons on the keyboard? I arleady know that the arrow keys are VK_UP, VK_DOWN, VK_LEFT, and VK_RIGHT, and the "Enter" button is VK_RETURN.
Thanks!
|
|
|
|
|
|
I see. But what about the letter keys. All the list says is, for example: (48) H Key; (4D) M Key
How would you use that in code when trying to do something like this:
if (GetAsyncKeyState(VK_LEFT) < 0)
{
//result of key press here
}
Instead of using VK_LEFT, how would I use the letter "M" or the letter "H"?
Thanks again!
|
|
|
|
|
(48) H is an example of the value of the constant. All the VK_* are is constants defined for a particular value.
I suppose Microsoft didn't think it was necessary to define VK constants for printable ASCII characters, especially since the values are the same as the ASCII character code. So, the key constant for "A" is 0x41 (65), as well as the ASCII value. This makes it easy to translate key codes to printable ASCII characters.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have a problem with the combination of ModifyStyle and DoModal :
ModifyStyle(0, WS_MINIMIZE, SWP_HIDEWINDOW);<br />
dlg_whatever.DoModal();
(only these both together pose the problem)
at this point. i.e. after the subdialog ended with EndDialog , the keyboard's ALT status is "toggled", even though the keyboard has not been touched all the time.
This poses a problem for me, so I carry out a SetKeyboardState , clearing the ALT status (testwise clearing the status of ALL keys too). This works so far, that a subsequent GetKeyboardState showsn that the ALT key is not toggled any more.
However, when any key gets pressed now, PreTranslateMessage shows WM_SYSKEYUP (i.e. ALT status).
Does anyone know
1. the reason for this behaviour,
2. how to clear the ALT state more effectively than by SetKeyboardState?
|
|
|
|
|
I have trouble believing that ModifyStyle() will alter the Keyboard state. What makes you believe the Alt key status has been toggled?
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
As I posted, not ModifyStyle, nor DoModal, but these two in combination achieve that.
In the meantime I found out, what's happening. I have to note, that I have noticed and tested this issue only in XP.
Every time, when no control has the focus in the dialog, ALT mode will be entered - and that is happening after ModifyStyle, DoModal.
I inserted a SetFocus() after DoModal, and the problem is cleared. Then I tested around, and found, that in other cases, when no control is focused on (for example, when the currently focused control becomed disabled), ALT mode will be entered.
The ALT status was easy to notice, because a PreTranslateMessage handler processes certain Alt-key combinations, like AltReturn, AltRight, etc., and these functions showed up without having touched the Alt key before.
Thanks anyway.
|
|
|
|
|
Vancouver wrote:
Every time, when no control has the focus in the dialog, ALT mode will be entered - and that is happening after ModifyStyle, DoModal.
I think you will find that if no control has focus the Dialogs System Menu will get focus, which will then process keys as SystemKeys (ALT style).
The first control with a Tab Stop style will automatically get focus so shouldn't normally need to use SetFocus().
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
1. I DID find, that PreTranslateMessage received the ALT key combinations in this situation (where the ALT has been simulated).
Btw, this is a dialog-based application, there is no system menu. I realize I should have written that in the first post.
2. The first non-disabled tab-stop button DOES receive the focus automatically, but not always.
One case is after the ModifyStyle + DoModal, another case was when the focus was on a CEdit control, which became disabled and the focus has not been assigned.
As soon as the focus will be assigned explicitely when disabling the control, the problem is gone.
Now I am assigning the focus to the dialog, i.e. with "this", which then gives the focus automatically to the first control in the TAB sequence.
|
|
|
|
|
I have a small problem with bolding text using RichEditView. I have tried using this code:
CRichEditCtrl &RichCtrl = GetRichEditCtrl();
CHARFORMAT cf;
cf.dwEffects = CFE_BOLD;
cf.dwMask = CFM_BOLD;
RichCtrl.SetSelectionCharFormat(cf);
I have used the same code for underline, italic, strikeout and link (changing the attributes to match the type) and the code works for them.
Any ideas?
|
|
|
|