|
Please! who can show me what I need to change here for that problem
void CRegWinDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
//this->MoveWindow(cxIcon, cyIcon, m_hIcon, true);
CRect rect; //this->MapDialogRect(&rect);
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
|
|
|
|
|
The paint handler effects how the area is painted, not how big the dialog actually is. The handler under the check for IsIconic draws the icon.
You need to over ride OnInitDialog, where you can do what I suggested ( get the dimensions using GetSystemMetrics and call MoveWindow ), although MapDialogRect looks like a better idea, I have never used it before so I cannot comment. ( I intend to though, it looks useful ).
I'd suggest trying MapDialogRect first, and doing it in OnInitDialog.
Christian
#include "std_disclaimer.h"
|
|
|
|
|
I did so and this problem remain
BOOL CRegWinDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
MapDialogRect(&rect);
//GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
CPaintDC dc(this); // device context for painting
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
//this->MoveWindow(cxIcon, cyIcon, x, y);
}
|
|
|
|
|
I'm not sure why you expect this to work, but I'd suggest that when people give you advice you seek to learn *how* something works so that you don't have to ask again. You have copied a lot of code that came for free in your OnPaint, which, as I explained before, has nothing to do with what you want.
Here is the total solution. Please take the time to understand how it works, it is with the hope that people will *learn* that I spend time here answering questions.
MoveWindow(0, 0, GetSystemMetrics(SM_CXFULLSCREEN), GetSystemMetrics(SM_CYFULLSCREEN));
This moves the window to fit exactly onto the screen - you will probably have to subract from the last parameter in order to allow for the taskbar. I am not sure at this late hour how to go about figuring out the available screen area taking into account the taskbar - read up on GetSystemMetrics, it's probably there. Also, all of your individual objects in the dialog will remain where they are relative to 0,0 and may need to be resized. They can have MoveWindow called on them as well, by default they are derived from CWnd.
Hope this helps.
Christian
#include "std_disclaimer.h"
|
|
|
|
|
If I have an EXCEL file and I want the VISUAL C program to read data from that EXCEL file....Do you know how to do it?........I have tried the function fopen but they said I put the source code at the wrong function or something like that do you have any idea?
Thank you
|
|
|
|
|
Have you tried using the ODBC Excel Driver found under System DSN. At least it is there on my machine, I believe from the instalation of VC++. You should then be able to access like a database using CRecordSet derived class.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
any one now about how to implement buffering inaudio files.
cnu..a.
|
|
|
|
|
I have an OpenGL application app based on MFC. I have a requirement that I need to redraw the whole scene every second(some sort of animation). When I use the standard method of invalidating the client area every second, the CPU usage is very high and my app does not respond to any other commands.
Can someone suggest any better ideas?
Thanks
|
|
|
|
|
Only redraw the scene when something changes.
If you still need a frame every second, do a ::BitBlt() each second.
Michael S. Scherotter
Lead Software Architect
Tartus Development, Inc.
|
|
|
|
|
I tried defining an entry in the Accelerator table (CTRL+ALT+Z) and attaching it to the ID of a button. That didn't seem to work, cuz nothing happens when i press the key combo.
I would appreciate any help.
Thank you.
|
|
|
|
|
Never mind.
I just answered my own question.
For those who are interested, use RegisterHotKey() along with WM_HOTKEY message.
Works like a charm.
|
|
|
|
|
I enumerate the encoders registered on my computer(such as:Cinepak Codec by Radius, MJPEG Compressor,DivXMPEG-4 Fast-Motion...).Then how can I select one of them (Such as DivXFast-Motion) to compress the timeline using DirectShow filters?
Note:
These encoder have the same CLSID(CLSID_AVICo),only FccHandler and FridenlyName are different.How to select one of them?
Thanks!
|
|
|
|
|
is there any way to get the local time of your computer without using time_t of time.h?
|
|
|
|
|
No solution friend.
You will have to give up using time_t and start using Win32 SDK calls
these revolve around SYSTEMTIME structure and functions are GetSystemTime GetLocalTime.
|
|
|
|
|
thank you very much i will try that!
|
|
|
|
|
I wanna run an exe file from my software that is coded in VC++... Is that possible???? If yes can someone tell how??
Thanx....
|
|
|
|
|
_spawn works for me. Or WinExec. Or CreateProcess. Or use the help system...
|
|
|
|
|
ShellExecute can also be used.
- David Gevert (don't feel like logging in.)
|
|
|
|
|
Search as I may, I cannot find how to set a selection in a clistctrl from within code ( as in preseting a selection when the control is first populated ).
Also, I notice that whenever the dialog bar containing the list control is significantly moved ( un/docked, un/hidden ) the highlighted selection disappears.
Can anyone tell me how to handle these things?
I imagine they're fairly simple.
Thanks in advance.
|
|
|
|
|
To set the selection: ListView_SetItemState ( hwndYourList, nIndexToSelect, LVIS_SELECTED, LVIS_SELECTED );
You can add LVIS_FOCUSED to the flags to set the focus rectangle to the item as well.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
I am having problems reading an object from a file..
this the class:
class MEMVAr
{
public:
CString Course;
int Wheight;
CString Grade;
MEMVAr() : Course(""), Wheight(0), Grade("")
{ }
};
I have declared the object as a public variable in the class CGPACalcDlg as follos:
MEMVAr D_F[18];
now.. when I write the object to the file using this function:
void CGPACalcDlg::OnWrite()
{
ofstream outfile("data.dat", ios::binary);
outfile.write(reinterpret_cast<char*>(&D_F), sizeof(D_F));
outfile.close();
}
the follwing function only reads the integers:
void CGPACalcDlg::OnRead()
{
UpdateData (TRUE);
ifstream infile("data.dat", ios::binary);
infile.read(reinterpret_cast<char*>(&D_F), sizeof(D_F));
infile.close();
UpdateData (FALSE);
}
I can only view the integers in D_F object.. what is wrong with the code ?? why I can't read the CString variables?
|
|
|
|
|
A CString only holds a pointer to the string data (much like a plain char*) so when you write out the raw struct, you don't save the string itself. You'll need to write out the actual strings, and when you read back in, assign the strings to the CString memebers.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
Do you think converting the CString into chars, then write the whole thing will help ?
|
|
|
|
|
|
I need to make a small HTML editor , not a tag editor a WYSISWYG type like FrontPage
I only need the view class or atleast HOW to make one, it should be interactive so when I
write http://www.somesite.com it will change it to a hyperlink and I can insert an image.
any thing will help...
|
|
|
|