|
Matthew Faithfull wrote: or do what every one else has done and write your own
Just what we need, another bloody assert macro!
Steve
|
|
|
|
|
George_George wrote: 1. ASSERT;
2. assert;
3. _ASSERT;
4. _assert.
Which one is the most correct to use?
I use #1 for MFC, and #2 for Win32. If you are curious what each resolves to, if anything, just place the mouse cursor on it and press F12.
"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
|
|
|
|
|
Thanks DavidCrow,
I think there is no need to manually define ASSERT and other forms of ASSERT to NULL when in release configuration, right?
regards,
George
|
|
|
|
|
George_George wrote: I think there is no need to manually define ASSERT and other forms of ASSERT to NULL when in release configuration, right?
I've never had the need to, but then again, I'm prejudice.
"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 agree.
regards,
George
|
|
|
|
|
If in the VS environment, I vote for _ASSERTE(...) because it echos the failed expression in the assert dialog that pops up - much easier to see if you should skip it (i.e. a known problem) or actually investigate.
The non-Debug #define s for assert-related macros are usually to allow release-build code to work correctly if the macro includes a statement terminator. For example, if you have the following code:
if( test != value )
MyMagicAssert( test ) The above code might be correct if the MyMagicAssert macro contains a semicolon or expands to something that is scoped by { and } .
If in a release build MyMagicAssert was #define ed to nothing, the code would evaluate to become:
if( test != value )
So without scope or a semicolon, the if(...) would associate to the next line of code, which would likely be an accident. By #define ing the macro to a semicolon or to {} the code compiles and runs as expected.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hi James,
I agree and learn all from your reply, except this point. I think we do not need to manually define _ASSERT to NULL is _DEBUG or not defined, right?
regards,
George
|
|
|
|
|
There are some forms in which enumchildwindows doesn't return child elements, while on the screen I can see statics, labels... for Example in Office word 2003 Tools->Options (You can try with spy++) How to capture this text?
|
|
|
|
|
Do you want to get text of controls on your program or other programs?
|
|
|
|
|
|
For get or set text you need to handle(hwnd) do you have any CWnd of that window if you have you can use of this code if you run this code on your program it change text of all controls to 123 and vice versa for get text of control (if you have code can you show it dont need to post all code)
for(CWnd* pWnd = GetTopWindow(); pWnd;pWnd = pWnd ->GetNextWindow())
{
pWnd ->SetWindowTextW(_T("123"));
}
|
|
|
|
|
I have only hwnd of main window, and enumchildwindows doesn't return any child windows, but I can see them on form. Please read my first post carefully.
|
|
|
|
|
Can you use of FindWindow ?
|
|
|
|
|
Hi All.
I have a problem regarding disappearance of cursor.
Lets say, I have 2 windows [or Text editors] in an application. I also have a frame that take care of some HTML pages.
Now, when I swap in between above mentioned 2 windows, I used to get a cursor on the clicked window.
----PROBLEM----
In case I have the focus on Window 1 and then if I click on the frame, my focus still stays on Window 1. Cursor disappears, thats normal. But when I click back on this window, I am not able to get my cursir back. Also, in that case, if I click on Window 2 and then back on Window 1, I get muy cursor back.
Any pointer/hint will be helpful.
Thanks
PanB
|
|
|
|
|
Hi,
I need to somehow make my dialog start up hidden. I have a line of code in my own DoModal function that creates the dialog and then executes my own function, which fades the window from completely transparent to opaque. Unfortunately, the CreateDlgIndirect function (which is used to create the dialog) has to be executed BEFORE my fading function, since my function needs to access the created window to do the fade. But what happens is, the window is created and made visible, and THEN my function is executed, which results in a nasty flicker before the fading. Here is my line of code:
if (CreateDlgIndirect(lpDialogTemplate, CWnd::FromHandle(hWndParent), hInst) && CloseSmoothly(m_hWnd, FALSE))
Now, I'm wondering if there is any way to modify lpDialogTemplate so the dialog starts up hidden and nothing flickers. I've tried lpDialogTemplate->style=SW_HIDE , except I get an error: error C2166: l-value specifies const object .
So, is there any way to stop the CreateDlgIndirect function from making the window visible after it is created?
Thanks in advance.
|
|
|
|
|
Have you tried:
lpDialogTemplate->style <big>|=</big> SW_HIDE
??????
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 get an error when I do that. The error says "l-value specifics constant object."
|
|
|
|
|
I think the error comes because the parameter has to be set before creation. For example, I use it (like that) in my CChildFrm inside PreCreateWindow(CREATESTRUCT& cs), but this is not valid for dialogs, just for views/windows (I'm not 100% sure about this last sentence).
I can not tell you a right solution, but a bypass/trick that could work is to use the MoveWindow or SetWindowPos inside your OnInitDialog and set the coordinates in a value that ensures it goes outside the area of desktop, or do it so small that is not seen.
For example.
BOOL CMyDlg::OnInitDialog ()
{
MoveWindow (3000, 3000, width, height, FALSE);
MoveWindow (0, 0, 1, 1, FALSE);
}
Hope it helps
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 trying to use function CCmdTarget::OnEvent(...). I do not know what parameters I have to input. Please help me with a sample. Thank you.
|
|
|
|
|
Have you try it on MSDN. I can't found such a member function on CCmdTarget:: at all on MSDN Library 2005.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hi all,
If you guys know a best resource (a book, tutorials, e-books, etc) which I can use to learn MFC from the basis pleas let me know.
Thanks a lot....
I appreciate your help all the time...
Eranga
|
|
|
|
|
This [^] & this[^] might help you a lot. I would better suggest you to read some books like Programming in MFC, WIN32 - Charles Petzold to start with and then move on to more intricate and complicated things.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Actually I used C++ How To Program by Deitel and Deitel. Actually there are lots of theories, need more time to come across with it. It is great for long way to go. But I'm looking some materials which explain both coding as well as the use of GUI. Right now I use Visual Studio .Net 2003.
Thanks
I appreciate your help all the time...
Eranga
|
|
|
|
|
You dont want to start to learning c++ you know some things but what?
|
|
|
|
|
Actually I know some basis on Win32 applications. I want to learn MFC as well, basically to develop interfaces for my code(ie. for my applications)
I appreciate your help all the time...
Eranga
|
|
|
|