|
Add a CRect member to your dialog class and handle the WM_MOVE and WM_MOVING messages. In the WM_MOVE message handler call GetWindowRect() to get the position of the dialog, save it in the CRect member. In the WM_MOVING handler, set the values of the supplied CRect pointer to those in the saved CRect.
void CMyDialog::OnMove(int x, int y)
{
CDialog::OnMove(x, y);
GetWindowRect(m_Rect);
}
void CMyDialog::OnMoving(UINT fwSide, LPRECT pRect)
{
*pRect = m_Rect;
}
The method given above will only work if the user tries to move the dialog with the mouse, it will break when the user uses the Move command in the context menu.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
mehrdadov wrote: I want to Create a modaless dialog that user can't move it
Simply remove it caption bar!
|
|
|
|
|
Hi all
I have such code :
...
__int32 x = 0;
char *str = "1234";
x = (str[0],str[1],str[2],str[3]);
...
I know that the value of x will be 52. Can someone explain why ?
thank you in advance
|
|
|
|
|
Hi big_denny_200,
Homework?
__int32 x = 0;char *str = "1234";x = (str[0],str[1],str[2],str[3]);-->52
__int32 x = 0;char *str = "123A";x = (str[0],str[1],str[2],str[3]);-->65
__int32 x = 0;char *str = "123a";x = (str[0],str[1],str[2],str[3]);-->97
__int32 x = 0;char *str = "000a";x = (str[0],str[1],str[2],str[3]);-->97
or(000A)->65
Ok
|
|
|
|
|
thank you for reply white sky, but it is not homework
as I understood, x will receive the value of last character in text ?
Right ?
|
|
|
|
|
Hi big_denny_200
but(why x is 52)
__int32 x = 0;
__int32 x2 = 0;
char *str = "/01234aA";
x = str[0],str[1],str[2],str[3];//->47
x2 = (str[0],str[1],str[2],str[3]);//-->50
__int32 m_check=0;
m_check=str[0];//47
m_check=str[1];//48
m_check=str[2];//49
m_check=str[3];//50
m_check=str[4];//51
m_check=str[5];//52
m_check=str[6];//97
m_check=str[7];//65
//m_check is 65,Now whats test?
char *test;
test=(char*)&m_check;
//test is A
A=65
Do you know ascii code?
if you press Alt+65 then print A or if you pree Alt+97 then print a
Right?
-- modified at 12:30 Sunday 9th April, 2006
|
|
|
|
|
If we convert to string to ASCII (numbers in brackets are decimal):
"1234" -> 0x31(49) 0x32(50) 0x33(51) 0x34(52) 0x00(0)
Now operator, returns its second parameter. i.e. (1st, 2nd) evaluates to 2nd .
So the expression (str[0],str[1],str[2],str[3]) evaluates to (str[1],str[2],str[3]) which evaluates to (str[2],str[3]) which in turn yields (str[3]) - Which is 52.
Steve
|
|
|
|
|
I bought a book called "3D Game Engine Architecture's ".
There are two web addresses(as beblow) in this book.
These web addreses are not active(link failure) now.
Someone could know the web address change to what?
// Magic Software, Inc.
// http://www.magic-software.com
// http://www.wild-magic.com
// Copyright © 2004. All Rights Reserved
|
|
|
|
|
|
Hi all
lets say I have a file path c:\\foo.txt
How can I determine what Icon is set to it ?
thanks.
PS. I have an edit box with fileBrowse buttons and when user loads some file I want to display the file path in the edit box and its icon below.
|
|
|
|
|
|
Have a look at the SHGetFileInfo() API function.
Also look at this[^] article, it looks like what you are after.
<EDIT>
I've just realised that the sample article is for a C#, but the concept should be the same
<EDIT>
I Dream of Absolute Zero
-- modified at 7:09 Sunday 9th April, 2006
|
|
|
|
|
When i programming with directx, seem i can't not use intellisense. So it't hard to remember the params.
May you help me.
|
|
|
|
|
Do you have two copies of Visual Studio open? That can stop Intellisense working.
The tigress is here
|
|
|
|
|
Hi, I get the problem again.
Thank to everyone help me!
My problem is that I have a pointer_to_function as member of my class. But I can't use this pointer to point to one of my member functions. More detail: I wrote a code like this:
int global_display(){
cout<<"global_display()"<
|
|
|
|
|
The syntax for member function pointers is rather confusing. If you want to get your code compiling so as you can call 'display_1', try:
int global_display(){
cout<<"global_display()"<<endl;
return 0;
};
class test{
public:
test();
int (test::*myfun)();
int display1();
int maindisplay();
};
int test::display1(){
cout<<"display1()"<<endl;
return 0;
};
int test::maindisplay(){
(this->*myfun)();
return 0;
};
test::test(){
myfun = &test::display1;
};
The main changes: firstly the constructor should not return 'int'. Then, the member function's declaration has to change to show it's a member function and not a non-member function. The invocation also has to change to use the ->* operator (or .* if you were calling a reference, in this case the object itself is calling, so we have to use this->*). Finally, the function reference has to be bound with the ampersand, and the classname too. This code was tested in VS2005 and VS2003.
Matt Godbolt
Engineer, ProFactor Software
StyleManager project
|
|
|
|
|
Hi i have added a dialog box and sone buttons like ok button to it. i want the ok button to be disabled when the dialog box is initially displayed.how do i do this
sud
|
|
|
|
|
Try this bit of code.
BOOL CYourDlg::OnInitDialog()
{
CDialog::OnInitDialog();
//pointer to your button
CButton *pButton = (CButton*)this->GetDlgItem(IDC_BUTTON1);
pButton->EnableWindow(FALSE);
}
EvScott
|
|
|
|
|
EvScott wrote: BOOL CYourDlg::OnInitDialog()
{
CDialog::OnInitDialog();
//pointer to your button
CButton *pButton = (CButton*)this->GetDlgItem(IDC_BUTTON1);
pButton->EnableWindow(FALSE);
}
Thanks for ur response. when i entered the above code i got a warning
"warning C4005: 'IDC_SIZE' : macro redefinition
see previous definition of 'IDC_SIZE'"
Please tell me what is wrong
Thanks
|
|
|
|
|
Compiler Warning (level 1) C4005
'identifier' : macro redefinition
The given identifier was defined twice. The compiler used the second macro definition.
Sudeep, observe the above which is an excerpt from MSDN. Make sure that you have only ONE identifer named "IDC_SIZE". The compiler will complain otherwise. Hope that this helps
EvScott
|
|
|
|
|
EvScott wrote: Compiler Warning (level 1) C4005
'identifier' : macro redefinition
The given identifier was defined twice. The compiler used the second macro definition.
Sudeep, observe the above which is an excerpt from MSDN. Make sure that you have only ONE identifer named "IDC_SIZE". The compiler will complain otherwise. Hope that this helps
idc_size is defined using #define only once. pls tell me where else can this declaration be found? i tried but cudn't get the solution
Thanks
|
|
|
|
|
Hi sudeep_br,
I suggestion that you change IDC_SIZE to exmaple IDC_SIZE2
and run again?whats happen?
-- modified at 2:10 Monday 10th April, 2006
and
m_yourButton.EnableWindow(0)
|
|
|
|
|
|
BOOL ProjectName::OnInitDialog()
{
CDialog::OnInitDialog();
GetDlgItem( IDC_Button )->EnableWindow(FALSE);´
}
|
|
|
|
|
sheshidar wrote: BOOL ProjectName::OnInitDialog()
{
CDialog::OnInitDialog();
GetDlgItem( IDC_Button )->EnableWindow(FALSE);´
}
Thanks for ur response. when i entered the above code i got a warning
"warning C4005: 'IDC_SIZE' : macro redefinition
see previous definition of 'IDC_SIZE'"
Please tell me what is wrong .where shud i make changes
sudeep
|
|
|
|