|
plz somebody tel me how to disable edit control on one dialog box from menu command on other dialog box
gourav dogra jfjunf
|
|
|
|
|
|
this will not work as irt give some error because i dont define the variable in first class so give full deatils plz i am beginner so pl, tel me how to handle these errors
its request syntax error : missing ';' before '*'
d:\gourav\password\log.h(18) : error C2501: 'CPasswordDlg' : missing storage-class or type specifiers
d:\gourav\password\log.h(18) : error C2501: 'myfirst' : missing storage-class or type specifiers
passwordDlg.cpp
d:\gourav\password\log.h(18) : error C2143: syntax error : missing ';' before '*'
d:\gourav\password\log.h(18) : error C2501: 'CPasswordDlg' : missing storage-class or type specifiers
d:\gourav\password\log.h(18) : error C2501: 'myfirst' : missing storage-class or type specifiers
D:\GOURAV\password\passwordDlg.cpp(153) : error C2039: 'myfirst' : is not a member of 'CLog'
d:\gourav\password\log.h(13) : see declaration of 'CLog'
Log.cpp
d:\gourav\password\log.h(18) : error C2143: syntax error : missing ';' before '*'
d:\gourav\password\log.h(18) : error C2501: 'CPasswordDlg' : missing storage-class or type specifiers
d:\gourav\password\log.h(18) : error C2501: 'myfirst' : missing storage-class or type specifiers
Generating Code...
Error executing cl.exe.
password.exe - 10 error(s), 0 warning(s)
gourav dogra jfjunf
-- modified at 5:51 Monday 5th June, 2006
|
|
|
|
|
whats type dialog if it is CDialog see
if CMyDailog is main class use this in another class
CMyDailog* view = (CMyDialog* )GetParent();
view->m_yourcontrol or function
of course if you use one CDialog program
whitesky
|
|
|
|
|
Create a class associated to the second dialog.
Declare an object or a pointer as
CYourFirstClass *myfirst; //in the header file of the this second dialog.
now when you are calling the dialog as
CSecondClass *mysecond=new CSecondClass();<br />
mysecond->myfirst=this;<br />
mysecond->DoModal();
now when you click on the menu bar item of the second dialog call
myfirst->myeditwnd->EnableWindow(false);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 5:18 Monday 5th June, 2006
|
|
|
|
|
Hi to all,
can we create a window using createwindow() in dialog based application ..
Manjunath S
|
|
|
|
|
Did you see CreateWindow in MSDN
this code is in MSDN
g_hwndMain = CreateWindow (
TEXT ("AnxJTest Class"),
lpstrWndTitle,
WS_VISIBLE,
0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
NULL, NULL, g_hInstance, NULL);
if (!g_hwndMain) {
DEBUGMSG(ZONE_VERBOSE | ZONE_ERROR,
(TEXT ("Could not create main window.")));
return FALSE;
}
of course Can you be more specific
whitesky
|
|
|
|
|
Yes
See the code underneath
#define ID_EDIT 201 //somwhere above in your code<code>
HWND hwndLarger;
hwndLarger=CreateWindow("BUTTON","EnterName",WS_CHILD|WS_VISIBLE,20,20,80,50,m_hWnd ,(HMENU)ID_EDIT,NULL,NULL);
</code>
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 5:26 Monday 5th June, 2006
|
|
|
|
|
|
Can i get sample code for Creating window in MFC dialog based application..
Thanks in advance ...
Manjunath S
|
|
|
|
|
Yes ofcourse... but tell me more details...
- NS -
|
|
|
|
|
I need to crate a class for windows and register it.after registering i need to create and palce that window on the Dialog.
Once completed, I need to create a SDL (simple Directmedia screen ) on the window..
SO my overall aim is to place SDL screen in MFC dialog based application...
Thanking You..
Manjunath S
|
|
|
|
|
I'm sorry, I have no experience with SDL.
Anyway I can help you to just create a window
First you have to insert a new class using ClassWizard.
Select class type as MFC and base class as generic CWnd.
Then you have to add a function to create the window in the new class created. Sample will just look like this...
bool MyWnd::Create(CWnd* pParent,const CRect& rect)
{
CString csClass = AfxRegisterWndClass( 0, LoadCursor( 0, IDC_ARROW ),
(HBRUSH)GetStockObject( WHITE_BRUSH ));
if( FALSE == CreateEx( 0, csClass, _T( "" ), WS_CHILD, rect, pParent, 0 ))
{
return false;
}
return true;
}
Then you can create a member variable of MyWnd in the dialog and can call the Create function of it.
- NS -
|
|
|
|
|
Hey man !
I provided you with the code itself. You just have to add it in your applications InitDialog function.
See my previous post to this thread.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I think he is expecting something more in detail...
- NS -
|
|
|
|
|
What are you really expecting. Frame your issue properly and post .
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi to all,
I need to create SDL(simple Directmedia layer) screen
and a drop-down box to select operation like (play,pause,stop)in the same window..
Thanking you
|
|
|
|
|
plz tel me how i can make a edit box on one dialog box disable by clicking on the menu command which is on other dialog box
so i want to know when i click on menu command from one dialog box it will open other dialog box and some edit boxes are disabled which i made earily
plz give me ans quickly
thanks for ur ans in adv
gourav dogra jfjunf
|
|
|
|
|
Use EnableWindow(false);
You must be having a control variable associated with the edit box.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
m_YourEdit.EnableWindow(0)
GetDlgItem(IDC_EDIT1)->EnableWindow(0)
whitesky
|
|
|
|
|
gourav456 wrote: so i want to know when i click on menu command from one dialog box it will open other dialog box and some edit boxes are disabled which i made earily
plz give me ans quickly
thanks for ur ans in adv
Is second Dialog Box is modeless or Model!
if it model :-
Then Set some Boolean variable which enable or disable the Button on the basis of boolean values
if is Modeless
you can post message to dialog box to enable or disable it button state
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hello everyone,
I am confused about the term "stack" which the system will use -- there are so many items we call them "stack". Suppose when we invoke a function, we will push the parameters and return address into a "stack", so that when the function returns, it can find the address to proceed correctly. Is it the same as a data structure "stack".
When we create a variable using malloc or new, we also say that it is allocated on "heap" other than on "stack", is heap also something like a stack in ternally (but has a different term)? And for local variables, when they are created, we say it is created on stack (for example, int i, j; ), it seems that each function has a separate stack?
Another confusing thing is thinking about stack and segment together, like the code segment, data segment of the program (which you can see when debugging your application), are the segments also some stacks (since when local variables are on code segment, we also say local variables are on stack, so I think maybe segment is implemented as stack)?
Besides the "stacks" I presented above, are there any other stacks which system will utilize?
Please forgive asking a simple question.
regards,
George
|
|
|
|
|
My viewpoint is the following:
When you start a C++ program, it consists of four parts: the code segment, the data segment; a unique heap area; a unique stack area.
The code segment contains microprocessor instructions obtained after successful compilation.
The data segment contains at least data declared with "static " modifier, as well as quoted strings.
When you call a function, for instance "f(1,2,3) ", then the arguments 1, 2 and 3 are pushed on the stack (the particular order depends on some factors). Also a return address (the address of the next instruction, after your "f(1,2,3) ") is pushed on the stack. Within the function, when you access an argument, you actually access a value from the stack. When the function finishes and returns back to the pushed address, the pushed values are popped from the stack and are lost, and the stack returns to its previous state.
Push and pop operations are performed by microprocessor using special pointer, stored in a register, which points to the top of the stack.
If you call a function again, the same stack is re-used.
If you have some local variables in your function, they are allocated on the same stack, somewhere above the pushed parameters and return address. That’s why you can crash your program if you access local variables incorrectly. For instance, by accessing a local array using invalid index.
Local variables declared with "static " modifier are allocated in data segment instead of the stack. This way, the value of static local variables is preserved between function calls.
If you call functions recursively, or use too large local variables, the stack becomes full.
When you use new operator or malloc function, data are allocated from the heap area. In contrast with the stack area, which are automatically cleared back when you return from a function, the heap-allocated data must be release explicitly, using delete or free .
If you allocate too much data or forget to release unneeded ones, the heap area becomes full. If you uses invalid pointers, you can corrupt the heap area.
So, there is a single stack and a single heap shared by your functions, and each program has its own stack and heap.
Windows applications also can allocate data in a specific manner using system functions like GlobalAlloc and others.
That is my vision on stack and heap.
|
|
|
|
|
Thank you Viorel,
> "each program has its own stack and heap"
Do you mean each process will has one unique stack and unique heap? So, different threads in the same process will share the stack and heap?
In your reply, you have never mentioned global variables and const variables. Will they be on data segment or on heap?
regards,
George
-- modified at 7:42 Monday 5th June, 2006
|
|
|
|
|
In multithreading application each of the thread in the same process will have its own stack. (That's why the functions like CreateThread or _beginthread have an optional argument for stack's size).
But the heap area is common for all of the threads. As a result, access to common heap data, as well as to common data segment, must be "synchronized". When you build multithreading applications, it is important to specify the correct compiler options (like "Runtime library"), otherwise shared data will be unexpectedly corrupted.
Global and constant variables are allocated in data segment. Actually this segment can be divided into constant data and changeable data. Compiler can apply some microprocessor’s or OS features in order to detect violation of constant data.
|
|
|
|
|