|
and now i got it right. I did not change anything but program works!!!!
int life()
{
in a land with no bird, no spring. My first journey was a
return 0;
}
|
|
|
|
|
Chris Losinger wrote: of course it does. you aren't checking for those letters.
Are you sure? The statement:
while ( ch != 'c' && ch != 'p' && ch != 't' && ch != 'g' ) should evaluate to true if c equals 'G' or 'D' , thus the loop would execute.
"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
|
|
|
|
|
DavidCrow wrote: Are you sure?
not any more
|
|
|
|
|
I have a tool bar in my application . i have code wirtten to disable one button on toolbar using ON_UPDATE_COMMAND_UI message. If the button gets disabled due to OnIdle message tool bar gets this message continuously and i get a flicker effect. Also due to this flicker it stops showing tool tips. for entire application. I have other tool bar buttons which have similar functionality but they work fine.
The only difference is all other buttons also have a Menu Item associated with them??
Is there any way to avoid this flicker.
|
|
|
|
|
When I'm creating dialog based applications I usually design them for resolutions of 1064x768. However, if I change to other screen resolutions (1280x1024 or 1600x1200 or ...), I would like them to grow according to the new screen size.
The first idea was to create a resource for the smallest screen resolution (800x600) and to set the FontSize according to the screen resolution during the dialogs initialization.
However, the result was not that what I expected.
The next idea was to create 3 or four different resources for different screen resolutions. This could be done easily by increasing the font size for the whole dialog.
So I created 4 different resources (Dialog800x600 (FontSize 6), Dialog1024x768 (FontSize 7), Dialog1280x1024 (FontSize 8) and Dialog1600x1200 (FontSize 10)).
In this case I have the problem that I can just start the first dialog (Dialog800x600) that was used during creation of the whole application. I think that the dialogs IDD is fix within MFC/C++ and can never be switched to another IDD.
So, does anybody have experience in creating applications that will fit for different screen resolutions?
Thanks ahead for any reply.
|
|
|
|
|
Is it really necessary to use a dialog? A simpler option would be to create an ordinary window filling the screen (remember to consider multiple screens when calling GetSystemMetrics) and then populating that window with controls. (The size of dialogs aren't actually related to pixels, but are calculated in terms of "dialog base units" (something that has to do with the size of the default font). Even if you manage to resize your dialog to fill the screen in different resolutions, the dialog will appear different depending on the user's selection for default font.)
If you really have to use a dialog, one option would be to use PostMessage(WM_SIZE, ...) in your OnInitDialog, and the on OnSize reposition the controls using the relative positions derived from the resource. Something in the line of:
<br />
BeginDeferWindowPos(...)<br />
for(i = 0; i < m_nNumCtrls; i ++){<br />
DeferWindowPos(...) <br />
}<br />
EndDeferWindowPos(...)<br />
-- modified at 19:59 Friday 26th October, 2007
|
|
|
|
|
Dialog IDD is fixed but you can change. you will have to do some changes in constructor. Go to dialog class suppose CTestDlg
Replace constructor CTestDlg(CWnd* pParentWnd = NULL) From CTestDlg(int id, CWnd *pParentWnd = NULL);
In implemention do CTestDlg::CTestDlg(int id, CWnd* pParent) : CDialog(id, pParent)
{}
When you want to display dialog. Check
if(resolution == )
{
CTestDlg testdlg(IDD_DIALOG1);
testdlg.DoModal();
}
else
{
CTestDlg testdlg(IDD_DIALOG2);
testdlg.DoModal();
}
Manish Rastogi
|
|
|
|
|
Why dont you get the size of desktop and use SetWindowPos () to change the size of the dialog in the OnInitDialog ()??
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
I am having a problem when building a solution in VC8 (2005). I am migrating a progam from VC6 to vc2005. When linking I get "error LNK2019: unresolved external symbol __imp__PrintDlgA@4 referenced in function _PopPrntPrintFile" I want to link static libraries and change to /MTd to do this. I still get these errors.
PLEASE HELP!
Thanks,
Bill
|
|
|
|
|
It seems that your project needs to a lib file are you sure you import a correct lib ?
|
|
|
|
|
I do not know if I can get the correct one. I have 2005 express. Here are the command line options used.
Compiler
/Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_VC80_UPGRADE=0x0600" /Gm /EHsc /MTd /Fp".\Debug/PopPad.pch" /Fo".\Debug/" /Fd".\Debug/" /FR".\Debug\\" /W3 /WX /nologo /c /ZI /TP /errorReport:prompt
Linker
/OUT:".\Debug/PopPad.exe" /INCREMENTAL /NOLOGO /MANIFEST /MANIFESTFILE:".\Debug\PopPad.exe.intermediate.manifest" /DEBUG /PDB:".\Debug/PopPad.pdb" /SUBSYSTEM:WINDOWS /MACHINE:X86 /ERRORREPORT:PROMPT nistpack.lib odbc32.lib odbccp32.lib kernel32.lib
I think it is the comdlg32.lob file I need, I have checked and it is in multiple pathes whihc I have included in Tools/Options.../VC++ Directories under the Libraries Tab.
Could it be that under vc6 is was a MFC?
I am reaching for anything...
Thanks,
Bill
|
|
|
|
|
are you doing a UNICODE build but linking to the non-Unicode libs (or vice versa) ?
|
|
|
|
|
I am using MFC,when I declare a X Object int class Y and a Y Object in class X,then compile Error,I know ,i have to use extern in file.h but I don't put it anywhere,please post a small code about extern to help me.Thanks everyone
|
|
|
|
|
class Y;
class X
{
Y y; <font color="Red">
};
class Y
{
X x;
}; This shows the order the compiler needs to see the declarations, regardless of
whether you use header files or not.
This will only work with object pointers, since the compiler doesn't know the size of a Y
object when it encounters the X class.
The only solution, then, is something like:
class Y;
class X
{
Y *py;
};
class Y
{
X x;
};
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Oh thanks about your question,but I'm sorry,I want to ask about include<file.h> in MFC,you can try,
If you create two class in MFC,they are X and Y,I suppose in class you have a Object X,exam X1,and in X is Y1 belong Y:
class X
{
Y Y1
}
class Y
{
X X1
}
At MFC,These two classes stay two distributed places,so At class Y you must to call include<x.h> and at class X is <include y.h="">,this is a cause to compile error,Please help me
|
|
|
|
|
Please reread my response.
It doesn't matter if you use MFC or not, or if you use header files or not.
The compiler is going to parse the code from the top-down. To resolve the
circular reference problem, you have to have similar code to the code I posted
and it needs to be in that order.
Again, this will not work:
class X
{
Y Y1 <-- the compiler does NOT know what a Y object is here!!!
}
class Y
{
X X1
}
You could try this, but it won't work either:
class Y;
class X
{
Y Y1 <-- the compiler does NOT know what SIZE a Y object is here!!!
}
class Y
{
X X1
}
So, you must use a pointer. The compiler knows the size of a pointer:
class Y;
class X
{
Y *pY1
}
class Y
{
X X1
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Oh no,when you use MFC (Dialoge box) ,you create two class (class X and class Y)which different place,you can't spacify which class will compile before
|
|
|
|
|
Oh yes, you have complete control over the order of the code.
You always have to put your code in the order you want it compiled.
That doesn't change for "#include"d header files - they get compiled
right where you place the #include.
You're really missing my point here. My point is that you can't include
a type in a class that the compiler doesn't know anything about. You can,
however, use an empty class declaration (e.g. "class SomeClass;") to let the
compiler know that a class of that name exists but its size is unknown.
You are NOT going to be able to have a "circular reference" like you're showing
without using a pointer to an object of the unknown type in at least one of the
classes in question.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Come on, Mark, quite beating around the bush and tell us exactly what is going on. Do you have to make it so blasted difficult?
"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
|
|
|
|
|
Heh. I'm trying! My head is clogged and I'm hopped up on cold medicine.
That's my story and I'm sticking to it
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
sorry Mark,My foreign language is too bad,so I use many word which not true,I am sorry,
|
|
|
|
|
What was first, the egg or the chicken?
That's the problem that Mark is trying to explain.
Hope is the negation of reality - Raistlin Majere
|
|
|
|
|
dear Mark,I sorry about this question,My English language is very bad,so I don't good at using words,I thanks about your your answers,and I hope you can skip for me
good look to you
|
|
|
|
|
No problem
Did you fix your issue?
I don't know how else to explain it - you have to include your .h files and/or
add the appropriate lines of code in the correct order for the compiler.
The sample code in my replies looks really simple, but it should have everything you
need to resolve your circular reference. MFC is just C++ - all the same rules apply.
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Oh yes,I finished my trouble,that is great,you say exactly,I read many times and translate(because I am VietNamese) and understand,Thanks you very much,
good look to you
|
|
|
|