|
What are you doing dismissing and domodal ing the dialog? Why don't you validate the key that was pressed in your dialog's <code>OnOk() ? I think you are trying to do it the wrong way.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
|
I explained it to Iain Clarke:
Yes, normally it's the correct way to do this
But i need to step out the DoModal() (return to the function which calls the DoModal())
I created a Wrapper-Control which is called as the same way in windows-logic as in DOS-Console-logic
and in dos i have the following:
while(stop != 1) {
Grid.Execute(); //-> does the DoModal() and quits this function via the OnOK()
switch(Grid.PressedKey) {
case KEY_ESC: stop = 1; break;
case KEY_ENTER: /*traitement*/ stop = 1; break;
};
}
I need to do this, because i reconstruct a DOS-Console Project into MFC
And both source-codes still exists (the DOS-Application should still exist after the MFC Application is ready)
So i need a source-code which can be traited in each logics
Because to adapt some 100000 lines of code isn't so cool
This "amphibian" source-code works, but i try to get it more beautiful
Thanks anyway for your answer
It's only the way to reuse the DOS-SourceCode and not to recode all the sourcecode in a Windows-logic
Otherway i made it naturally in your given way.
Because it's not so easy to my to create MFC-controls which works like a "DOS-Console-Control"
|
|
|
|
|
I already read your reply to him, but my point was that you were trying to achieve something in an unusual way. May be your situation demands you to do so. I haven't done something like that.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
yes, so it is
In school i made it in the correct windows-programmation-logic
But in work, were the DOS-Application should still life a double-code is not so good
Because during i recode the application to MFC the DOS-applic still grows
So all newer code should be integrated itselfs, with this kind of "wrapper logic"
But to my question:
Is it possible to freeze the display between a OnOK() and a DoModal()
so that the user don't sees the closing and re-opening?
Thanks
|
|
|
|
|
That can be done easily. Override PreTranslateMessage() of the Dialog (which is being shown on DoMOdal()) and handle WM_KEYUP/WM_KEYDOWN. This way u'll get the key.
Come online at:-
jubinc@skype
|
|
|
|
|
Thats totally correct, but in this case i'm in a source-code of the real MFC code
I need to copy the whole source-code of all cases of keystrokes to this MFC-Class
So i have a double source-code.
If the A-Key does create a new customer and the D-Key deletes a customer for example
i create this code in my class
If my colleague changes the source-code of the DOS-Application i need to change aswell the
source-code of the MFC-Class, that's pretty impractical. All work has to be done twice.
In my horror-code the DOS-Programmer changes simply the code in his DOS-way and the code also
changes in the MFC-logic...
It know, it's hard to understand why i do this, but it's really the onliest way to re-create
an application which contains over 2000000 lines of code and will also grow up during i code...
So i need simply an idea how to resolve my problem, however my kind of programmation is stupid or horrible
|
|
|
|
|
In my horror-code the DOS-Programmer changes simply the code in his DOS-way and the code also<br />
changes in the MFC-logic...
Here what does DOS-way mean? And how the changes are reflecting to the MFC code?
Come online at:-
jubinc@skype
|
|
|
|
|
I have for example a simple source-code ( .cpp & .h file) without classes, only static functions.
These functions are called from the DOS-code and aswell from my MFC-Classes :
For example
while(stop != 1) {
Grid.Execute(); //-> does the DoModal() and quits this function via the OnOK()
switch(Grid.PressedKey) {
case KEY_ESC: stop = 1; break;
case KEY_ENTER: /*traitement*/ stop = 1; break;
};
}
In the DOS-Application the .Execute draws with a lot of printf a Grid to the console
In my MFC-Application the .Execute opens a Dialog within a Grid-Control
If the user hit's a key, the Execute function ends and the switch(Grid.PressedKey) launches
If the key don't matches, the grid continues beeing displayed, until ENTER or ESCAPE is beeing hitted.
In DOS a #ifndef loads the header which defines the DOS-Grid and in the case of a windows PRECOMPILER-DIRECTIVE the header
for the Dialog will be loaded...
So this code is uniform to the application ...
You know what i mean? Because it's hard to explain in a brief text a whole project-logic
Greetz
|
|
|
|
|
Hi..
I am calling a DLL Methods through Command Line.I am getting errors..It is not Connecting to server.plz help me..
Error is..
p(214) : error C2451: conditional expression of type 'void' is illegal
Expressions of type void cannot be converted to other types
Code...
ACL_STATUS *Acl_Status;
HINSTANCE hClcltr = LoadLibrary("ACL_API.dll");
CONNECION connect2Server;
connect2Server = (CONNECION)GetProcAddress(hClcltr,"ACL_ConnectToServer");
CString sBuf;
CHAR *buf = sBuf.GetBuffer(MAX_PATH);
GetSystemDirectory(buf, 256);
lstrcat(buf,"\\shell32.dll");
sBuf.ReleaseBuffer();
connect2Server(aConfig[1], aConfig[2], aConfig[0], aConfig[5],Acl_Status);
--->(Error) if(connect2Server(aConfig[1], aConfig[2], aConfig[0], aConfig[5],Acl_Status ))
{
AfxMessageBox(_T("Successful"));
//AfxMessageBox("Succesful");
}
FreeLibrary( hClcltr );
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
if(connect2Server(aConfig[1], aConfig[2], aConfig[0], aConfig[5],Acl_Status ))
In the above statement, the connect2Server function returns void and u r attempting to evaluate its return value, hence the error.
Possible Solutions:
1. Don't check (don't write it in if/while) the return value of connect2Server as it returns void.
2. Return some value from connect2Server, then evaluate its return value.
Come online at:-
jubinc@skype
|
|
|
|
|
Guessing by the error, it seems that the "ACL_ConnectToServer" function doesn't return anything. So, you cannot check its return value with a "if".
BTW, please read the posting guidelines which are at the top of this forum. Thank you.
|
|
|
|
|
How CONNECION is defined?
(I guess the connect2Server function has a out parameter, the last one looks promising, to return the result of the operation).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
I want to convert CListCtrl items from Check Boxes to radio buttons
please let me know how can i do that
thanx in advance
|
|
|
|
|
There's no inbuilt method, u'll have to do it manually.
Come online at:-
jubinc@skype
|
|
|
|
|
hummm thanx for the info
let me know how to start of if u have any idea
|
|
|
|
|
ListCtrl needs to be made Owner Drawn. While drawing, use CDC::DrawFrameControl() to draw the radio button. Implement u'r own logic to get the selected Radio button item.
Come online at:-
jubinc@skype
|
|
|
|
|
Heyy Don
here is an other way i have done .. thought its useful for all so posting here
Create image list with cheked and uncheked dadiobitmap button images and and set it to list view control
CBitmap tmpBmp;
CImageList m_imgList;
m_imgList.Create(16,16,ILC_COLOR | ILC_MASK, 0, 255);
tmpBmp.LoadBitmap(IDB_RADIOBTNS);
m_imgList.Add(&tmpBmp, RGB(255, 0, 255));
myListCtrl.Create( Styles ,CRect(0,0,0,0), this, IDC_SOMEID)
//myListCtrl.SetExtendedStyle( set tyles what ever u want );
myListCtrl.SetImageList(m_imgList, LVSIL_STATE);
--
feel free to revert me back for info if any body needs more
|
|
|
|
|
sarat wrote: I want to convert CListCtrl items from Check Boxes to radio buttons
Are you wanting to ensure that only one item can be selected at a time?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Then make sure to use the LVS_SINGLESEL style.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello everyone,
How to get the performance counter index and name relationship? Is there a table?
(like integer 180 for working set counter)
I can not find from MSDN,
http://msdn2.microsoft.com/en-us/library/aa372648.aspx
thanks in advance,
George
|
|
|
|
|
Are there situations where you cannot refer to an item by its name? The performance API allows you to construct counters using a name. If I've misunderstood your question, please explain.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi DavidCrow,
I am reading some other people's code and it has a list of numbers (performance counter index), so I have to know how to get name by index.
regards,
George
|
|
|
|
|
But how do you know there is a corresponding name?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|