|
I don't know of any callback function that notifies you when the screen resolution changes, but why not saving the current resolution (x, y, bpp) and checking in an infinite loop if it changes? (Perhaps with a Sleep delay of 1 sec and in a thread)...
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
I believe that the system broadcasts a WM_SETTINGCHANGE message to all top level windows when the screen resolution has changed. So, in your main top-level window, simply add a handler for this message.
|
|
|
|
|
Another approach is the following:
<br />
int iScreenWidth = ::GetSystemMetrics( SM_CXSCREEN );<br />
int iScreenHeight = ::GetSystemMetrics( SM_CYSCREEN );<br />
But I'm not sure if it's win32...
|
|
|
|
|
It works without MFC yes.
MSDN says:
Width and height, in pixels, of the screen of the primary display monitor. These are the same values you obtain by calling GetDeviceCaps(hdcPrimaryMonitor, HORZRES/VERTRES).
So exactly the same as in my post above
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
This method is good if you are using GDI for drawing (for consistency in using device context handles), however I prefer ::GetSystemMetrics for use with DirectX/OpenGL projects because I want to get away from GDI completely when using these technologies (its also the example given in the DX SDK documentation).
|
|
|
|
|
Here is my code...
How can I display my Icon to the toolbar?
Thanks
Patrick
~~~~~~~~~~~~~~~~~ SOURCE CODE ~~~~~~~~~~~~~~
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME)| !m_wndToolBar.LoadBitmap(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
Patrick
|
|
|
|
|
Make up your mind, do you want your app's status bar, your app's toolbar, or Windows' taskbar?
|
|
|
|
|
in the app's toolbar.
from explorer I want to see my application witn the icon of my project.
Thanks
|
|
|
|
|
This solves the toolbar icon, but I also want to have it showing with explorer which currently shows an "MFC icon"
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
SetIcon(m_hIcon, FALSE); // Set small icon
~~~~~~~
Halfway there.
|
|
|
|
|
The icon is contained in your project's res folder. Replace the MFC .ico file with one of your own, recompile, and you're done.
|
|
|
|
|
Hi,
I have a thread that needs to update a dialog.
When I use UpdateData(false) from the thread I will get an exception.
Any idea why ?
Thanks,
Shay
|
|
|
|
|
Ideas Why:
1) Not a UI Thread
2) Not the thread that owns the dialog
Possible Solutions:
1) shared memvar, updated by the thread and monitored by the dialog.
2) PostThreadMessage()
|
|
|
|
|
What kind of thread is it? If it is a worker thread, one solution is messages. Send a message to main frame and have it update the control.
Kuphryn
|
|
|
|
|
hello
i have add a DIALOGBAR and i have add in SLIDER. i want to attach one variable to this
SLIDER but when i go to the ClassWizard and i choice classename:CMainFrame i can't find
the the obectID IDC_SLIDER1 but i find it in the Classname :CAboutDlg.and i want to use
it in the calss CMainFrame.
and when i click on MessageMaps and choice class CMaiframe i can't add any variable??
|
|
|
|
|
Hi,
I'm not sure of what you trying to explain here. You use somebody else app? If it's an app that you have created with the wizard then the first "dialogbar" that is created is not a "dialogbar" but it is a toolbar. You have the choice not to use it into your app in the MFC wizard.
Everything's beautiful if you look at it long enough...
|
|
|
|
|
I have been given a VC++ 6 dll which has no documentation and no code. I need to find out what functions are available in this dll. Does anyone know of a utility somewhere that can show you the public functions of a dll?
Something similar to Lutz Roeder's .NET Reflector[^], but for a VC++ 6 dll.
Thanks,
Mark Sanders
|
|
|
|
|
|
or the Dependency Walker tool that comes with VC 6
|
|
|
|
|
How would I force an Edit box or MSFlexgrid Cell/ Cells to be in currency format in VC ++ ?
|
|
|
|
|
A formatted edit control is something you'd have to create, or use one of the many available here at CP.
|
|
|
|
|
Hi,
I am trying to create a program that will prevent a user from closing an external application (i.e. Word).
I am not sure what approach I can take as I have little control over this app.
Trying to hook and trap messages seems like a good idea but not all apps use WM_CLOSE and by the time they receive WM_DESTROY it is too late.
If anyone has seen this done or have any idea of how it can be done please let me know.
|
|
|
|
|
Hi,
Can anybody help me with my problem?
How to load RTF file with pictures in CRichEditCtrl?
I know how to insert picture (BMP) file in my CRichEditCtrl.
I also know how to save the contents of the CRichEditCtrl as RTF file.
I need to load a RTF file with pictures (BMP) in it, in my CRicheEdit control,
but I don't know how to do that.
Can you help me?
Thanks!
Yasen
|
|
|
|
|
I have a dialog in which i create buttons dynamically, i have derived my own class called CBokningsButton from CButton... here's the problem, i get an assertion error when i try to do: m_tooltip.AddTool(GetDlgItem(9001 ,"hey"));
the assertion error is: ASSERT(::IsWindow(m_hWnd));
the wierd part (or the part I find wierd) is that i can do this if i double create the buttons. it hard for me to explain exactly how i mean but ill try:
When i run the prog it creates some buttons then if the user change some stuff it deletes the buttons and create new ones. each button represents a different time in a day, depending on which day the users select the buttons can have a different layout depending in the information i get from a mysql database.
So before i create buttons i delete the old ones like this:
CBokningsButton* ptrButton;
for(int t=0;t<200;t++)
{
if( (ptrButton = (CBokningsButton*)GetDlgItem(9001+t)) != NULL)
{
// button exists
ptrButton->DestroyWindow();
}
}
now i know this i like the worst solution ever to delete buttons but never mind that now, the thing is that if i replace the DestroyWindow() line with my AddTool line i get the tooltips to work the second time i create the buttons (rember that now the old ones hasnt been deleted so the new are just printed on top of the old ones).
If i try to do the AddTool any place else in the program i get the assertion error...
i thought it to be most logical to do AddTool at the same time i create the button but that gives me the same error
does anyone know what im talking about and if so can you help me?
thanx
/Eric
|
|
|
|
|
Hai everybody..
I want to make the FlexGrid cell as EditBox...I have wtitten the code for this but when move out of that cell after editing cell is not getting its border back...can anybody help me???
ThomasKennedyBose
|
|
|
|
|
How are you doing this because I have played with this option just for fun so I could be able to help.
// Afterall I realized that even my comment lines have bugs
|
|
|
|