|
If you just want posted and input messages you could overide PreTranslateMessage in your view class. If you want all messages, not just those dispatched by the message loop, it will be harder. One option would be to subclass the control and have the new WindowProc delegate the work to your view class.
Steve
|
|
|
|
|
Hi there.
I have two projects in a solution (VS8.0) and the first has a dependency on the other. Both projects produce dlls. Now I want to define a simple singleton and use it from both dlls. So the code is easy:
<br />
class _MyProject_Export BuilderFactory :<br />
public util::DllFactory<Builder><br />
{<br />
public:<br />
static BuilderFactory& Instance(void)<br />
{<br />
static BuilderFactory singleton;<br />
return singleton;<br />
}<br />
};<br />
Ok we have a BuilderFactory class that it inherits from another class and just define a static member Instance to get reference to my singleton. Of course having such a code you are going to templatize the code in the following fashion:
<br />
template <class T><br />
class Singleton<br />
{<br />
public:<br />
typedef T SingletonType;<br />
<br />
static T& Instance(void)<br />
{<br />
static T singleton;<br />
return singleton;<br />
}<br />
<br />
private:<br />
Singleton(void) {}<br />
Singleton(const Singleton&);<br />
Singleton& operator =(const Singleton&);<br />
virtual ~Singleton(void) {}<br />
};<br />
<br />
typedef Singleton<<br />
util::DllFactory<Builder><br />
> BuilderFactory;<br />
Both example compile successfully, however the latter doesn't work! Just can't understand why.
I came to believe that in the latter case two different instances exist in my program. As I'm registering builders in the factory from on dll and the second doesnt have any. I suspect that something has to do with exporting of symbols as I don't export anything in the latter case, but what am I supposed to export, the typedef?
Any ideas?
|
|
|
|
|
Is it possible to remove the minimize/maximize/close buttons from a non-dialog application. I'm working on an application where we don't want them displayed. I believe you can disable their functionality by removing their corresponding menu commands, but that still leaves the buttons visible.
|
|
|
|
|
rentzk wrote: Is it possible to remove the minimize/maximize/close
Remove WM_SYSMENU style from the concerned window's style.
Jesus Lives Forever - Amen <marquee direction="up" height="40" scrolldelay="10" step=".5" scrollamount="1" style="background:#99ccff;border-bottom:thin solid 1px #6699cc">
--Owner drawn
--An eye for an eye makes the whole world blind.
--If you find my post helpful then do rate it.
--Jesus is Lord
|
|
|
|
|
Owner drawn wrote: rentzk wrote:
Is it possible to remove the minimize/maximize/close
Remove WM_SYSMENU style from the concerned window's style.
Any sugestions about how to do this to the main window? I've done this before with dialogs in an application, but this is the first time I've ever attempted doing it for the entire program.
|
|
|
|
|
|
I am using a dialog based application. I try to maximize it the dialog to whole screen. but the buttons I add it can not set to the bottom. Anybody please give me a hint or methodes.
In addition, I want to add a connection to the datebase. Is it possible to add it to the dialog?
Thanks in advance!
|
|
|
|
|
HI
Your first part of the question is not that clear.What do you want to do . What I figured is that you want to add Maximized button to the dialog????
As far as Database connection is considered :
Derive a class from CRecordSet
Override method GetDefaultConnect , GetDefaultSQL.
Now include this derived class into your project , Create an object of CDatabaseX(if this is the class that you derived from CRecordSet) and use its function.
You need to know the details of the driver and how are you going to connect through it.(DSN etc...)
Wishes.
Anshuman Dandekar
Dare to Dream,
Care to Achieve.............
|
|
|
|
|
I really want to do is that I try to get white screen with only one status bar. The white screen while display a image.
because I do not want title bar and menu, I think use dialog based application is easier. Am I right?
|
|
|
|
|
I try to hide the menu and only show the toolbar in MFC application? Can somebody tell me how to do it?
|
|
|
|
|
Call SetMenu(NULL) on your main frame, followed by DrawMenuBar() to update the screen
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
i have read what i could find and even looked at a few programs from here but i just cant figure out how to get them to change when i press one of them first what event do i use ? a keydown or a keyup or ??? i know VK_CAPITAL is for caps lock and VK_NUMLOCK is num lock and VK_SCROLL is scroll lock but thats about all i know on how to do it. i am very very
EDIT - I figured it out use PreTranslateMessage and
if (GetKeyState(VK_SCROLL) && 0x8000 == 0x8000)<br />
{<br />
m_bar.SetPaneText(3, "SCRL", TRUE);<br />
} works for me anyway
-- modified at 20:05 Tuesday 31st January, 2006
|
|
|
|
|
Yep, but use '&', not '&&'
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
im a noob what can i say
|
|
|
|
|
I am currently porting an MFC app from VC++ 6.0 to
VS 2005 (MFC8). So far I have noted the following MFC8 bugs.
01) AfxIsValidAddress
No longer properly validates the memory block:
In MFC6: (OK)
BOOL AFXAPI AfxIsValidAddress(const void* lp, UINT nBytes,
BOOL bReadWrite /* = TRUE */)
{
// simple version using Win-32 APIs for pointer validation.
return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
(!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));
}
In MFC8: (bad)
BOOL AFXAPI AfxIsValidAddress(const void* p, UINT_PTR nBytes,
BOOL bReadWrite /* = TRUE */)
{
return ATL::AtlIsValidAddress(p, nBytes, bReadWrite);
}
// Verify that a pointer points to valid memory
inline BOOL AtlIsValidAddress(const void* p, size_t nBytes,
BOOL bReadWrite = TRUE)
{
(bReadWrite);
(nBytes);
return (p != NULL);
}
02) CFont::CreatePointFontIndirect
Calculates the font lfHeight incorrectly. In MFC6 it used simple division
to convert nPointSize to LOGFONT::lfHeight. In MFC8 it uses ::MulDiv which
rounds the result giving a different font size.
In MFC6: (OK)
BOOL CFont::CreatePointFontIndirect(const LOGFONT* lpLogFont, CDC* pDC)
{
....
pt.y = ::GetDeviceCaps(hDC, LOGPIXELSY), logFont.lfHeight;
pt.y /= 720; // truncates
In MFC8: (bad)
BOOL CFont::CreatePointFontIndirect(const LOGFONT* lpLogFont, CDC* pDC)
{
....
pt.y = ::MulDiv(::GetDeviceCaps(hDC, LOGPIXELSY), logFont.lfHeight, 720); // rounds
J. Yates
-- modified at 18:48 Tuesday 31st January, 2006
|
|
|
|
|
|
01) See here[^]. In non-debug builds, AfxIsValidAddress() only checks for non-null. Debug builds perform the full check.
02) This is a bug fix. MFC6 was doing the wrong thing (as mentioned previously).
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan
AfxIsValidAddress behaves the same (test for NULL only) on both debug and release builds. The bug is in the debug build which doesnt fully test the mem block.
J Yates
|
|
|
|
|
You've stepped through it in the debugger?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
Hi,
I am using Visual C++ version 6.0. I created a dialog based application using the MFC app wizard. Using the resource editor I placed a Tab Control in the dialog box and used the class wizard to give a variable name to the control. I can run the application and create the tab control with the tab text of my coice on the five tabs that I have. It seems I can select each tab. Where I am falling short is how to put other controls into each pane. I can only access and look at the properties for IDD_TAB1. How do I access the other panes and how do I put controls into the panes? If I try to put a control into IDD_TAB1 it is simply put "behind" the tab control as part of the dialog box.
Thanks,
Buck
|
|
|
|
|
This is where Windows .RC files let the team down - They don't support a hierarchy of windows so there is no direct way to place windows on (should I say in) the tab control. I create the tab contents programmatically and place it in the tab control. The contents is often a single control or perhaps a modeless dialog.
Steve
|
|
|
|
|
you can place the control in a separate dialog box.
then put the dialog box as a whole on the tab pane.
|
|
|
|
|
Didn't I say that? ("or perhaps a modeless dialog").
Steve
|
|
|
|
|
Sorry for being misplaced the reply,
actually I should reply to the questions but by mistake I did it to you.
Sorry.
|
|
|
|