|
Thanks Luc,
Both of the binaries contains the word PDB. It is so strange. But the size is different and the bigger one (debug version) is debuggable, and the smaller one (release version) is not debuggable (when pressing F5 in Visual Studio 2005, all the break points set before will become invalid).
Any comments or ideas?
regards,
George
|
|
|
|
|
Hi George, I have one comment: the debug/release divide is not very strict, there are several
compiler and linker switches you can set/clear/specify influencing the kind of code
generated, and the amount of metadata present in the DLL/EXE file.
Visual Studio comes with two predefined configurations, aptly called "Debug" and "Release",
with different switch settings. But you can alter those settings, and you can define
additional configurations.
What is it exactly you hope to achieve?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thanks Luc,
I agree with your points. My purpose is to debug the application, i.e. when using F5 in Visual Studio 2005 to execute the debug, the application can stop at break points. But currently, when using F5, all the break points will become invalid.
I am wondering why and suspecting some important options (either compile option or link option is missing) which causes this issue.
Any comments or ideas are welcome.
regards,
George
|
|
|
|
|
Thanks Luc!
Sorry that I may not make myself undertood. I am using embedded VC++ 4.0 to develop. Now I installed Visual Studio 2005 and migrate the project files generated by embedded VC++ 4.0 to Visual Studio 2005 using the IDE. But now in Visual Studio 2005 I can not debug it. So, I am confused that there must be some wrong settings which blocks me from debugging in Visual Studio 2005 -- maybe there is something wrong in the migration process or something wrong in the Visual Studio 2005 settings.
regards,
George
|
|
|
|
|
Try Luc's suggestion - create a dmnmy project in VS2005 and then compare the settings between the debug version in that one and your migrated project. I'm sure the problem is in the settings since the eVC uses a subset of VS. Also, make sure your settings for the target windows version are also correct to now target a desktop versus a mobile.
Judy
|
|
|
|
|
Thanks Judy,
Previously, I think the differences between debug and release version is whether the macro DEBUG and _DEBUG are defined. I think I am wrong. There should be more differences -- i.e. simply adding DEBUG and _DEBUG macros to release version project can not produce debug version project.
Do you have any experiences and knowledge to share what is the settings (e.g. compile options, linker options, etc.) which makes debug and relase version different please?
regards,
George
|
|
|
|
|
George_George wrote: Previously, I think the differences between debug and release version is whether the macro DEBUG and _DEBUG are defined. I think I am wrong
Yes, you are wrong. The differences have always been more than just that define. Things like optimizations (/O), information to include in the output file (/Z), which runtime to include (/MT /MD /L) and more.
George_George wrote: Do you have any experiences and knowledge to share what is the settings (e.g. compile options, linker options, etc.) which makes debug and relase version different please?
I've never memorized them. Whenever I've wanted to compare, I create a dummy project and then open it in two different instances of VS, one showing release and the other showing debug and compare them. Or just open up the .dsp file in text mode and compare the two sets of options directly. There are too many to know them all. Take my approach and compare them yourself then look them up in the help and see what each one does to really understand why a given setting is appropriate for which mode.
Judy
|
|
|
|
|
Hi Judy,
Great reply. I think all the configurations which matter is stored in .vcproj file, right (so I only need to compare with two .vcproj file to see any differences)? The .dsp file you mentioned should be some redundancy information of .vcproj file? Right?
I asked this question is because I am wondering if I only compare the two .vcproj files, whether I will miss some important settings which matter.
regards,
George
|
|
|
|
|
.dsp is the project file for VS6 and .vcproj is used for VS2005. I thought you were using 6, my mistake. You're not comparing two different vcproj files, you're comparing two different sections of the same vcproj from your sample project. If you look inside it, you'll find multiple "configuration" sections and within each section, all the different settings.
Judy
|
|
|
|
|
Thanks Judy!
regards,
George
|
|
|
|
|
I put some CEdit to the dialog, use the same function OnChangeEdit1, when the context of edit box is changed,
such as,
ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit1)
ON_EN_CHANGE(IDC_EDIT3, OnChangeEdit1)
the problem is, I can not decide which edit box has called the function, How can I get the ID for it?
|
|
|
|
|
Does this code helpful?
void CdddDlg::OnEnChangeEdit1()
{
if(GetFocus()==GetDlgItem(IDC_EDIT1))
MessageBox(_T("editbox1"));
if(GetFocus()==GetDlgItem(IDC_EDIT2))
MessageBox(_T("editbox2"));
}
|
|
|
|
|
...and for a syntactical point of view, you should always put curved braces for if statements, even it then contains only one instruction...
|
|
|
|
|
toxcct wrote: ...and for a syntactical point of view, you should always put curved braces for if statements, even it then contains only one instruction...
I always put curly braces for if statements, even if it would only be a one-liner. About a month ago, however, I started doing one-liners without the braces. I ran into so many problems from doing this. It took me quite a while to get re-accustomed to my old ways. It's funny, you would think it wouldn't cause any problems, but it did for me.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thank you for your advice.;)
|
|
|
|
|
Step 1. Ensure that IDC_EDIT1,IDC_EDIT2,IDC_EDIT3 are consecutive ID's ie 1001,1002,1003
Step 2. instead of 3 separate ON_EN_CHANGE's inside the ClassWizard part of the MESSAGE_MAP use on ON_CONTROL_RANGE outside of the ClassWizard part of the MESSAGE_MAP
ON_CONTROL_RANGE(EN_CHANGE, IDC_EDIT1, IDC_EDIT3, OnChangeEdit1)
Step 3. change the declaration of OnChangeEdit1 to
void YourClass::OnChangeEdit1(UINT nIDCtl)
see ON_CONTROL_RANGE[^]
|
|
|
|
|
<br />
SqlCmd.Format("SELECT TOP %u * FROM \<br />
(SELECT TOP %u * FROM %s ORDER BY time DESC) as t1 \<br />
WHERE time not in (SELECT TOP %u time FROM %s ORDER BY time DESC) as t2 \<br />
ORDER BY time", \<br />
m_RcPerGrp,m_CntDispRc,m_TableName,tmp,m_TableName);<br />
If I take off
<br />
WHERE time not in (SELECT TOP %u time FROM %s ORDER BY time DESC) as t2<br />
there is no runtime error.
What's wrong?
|
|
|
|
|
the problem is not the SQL command but how you build the string...
you cannot write like you did, but change to this:
SqlCmd.Format("SELECT TOP %u * FROM <code>"</code>
<code>"</code>(SELECT TOP %u * FROM %s ORDER BY time DESC) as t1 <code>"</code>
<code>"</code>WHERE time not in (SELECT TOP %u time FROM %s ORDER BY time DESC) as <code>"</code>
<code>"</code>ORDER BY time",
m_RcPerGrp, m_CntDispRc, m_TableName, tmp, m_TableName);
moreover, you should use parametrized query objects to add some parameters to your query, rather than build a CString yourself...
for your query, i suggest you this optimization:
SELECT TOP :1 *
FROM
(SELECT TOP :2 * FROM :3 ORDER BY time DESC) as t1
WHERE
t1.time NOT IN
(SELECT TOP :4 time FROM :5 ORDER BY time DESC)
ORDER BY t1.time
-- modified at 11:08 Sunday 11th November, 2007
|
|
|
|
|
Thanks very much.
I've never used parametrized query objects.
If it is not difficult, I should follow you suggestion.
Maybe I should find some sample code.
|
|
|
|
|
followait wrote: there is no runtime error.
From the compiler, linker, or your program?
"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
|
|
|
|
|
I create a CTreeCtrl control,but i cannot recieve the "TVN_ITEMEXPANDED" message.
the code:
m_pTreeCtrl=new CTreeCtrl();
m_pTreeCtrl->Create(TVS_HASBUTTONS |
TVS_HASLINES | TVS_LINESATROOT | TVS_FULLROWSELECT |
WS_TABSTOP|WS_CHILD|WS_VISIBLE|TVS_SINGLEEXPAND ,
CRect(0,0,20,20),
this,IDC_DROP_TREE);
ON_NOTIFY(TVN_ITEMEXPANDING, IDC_DROP_TREE, OnItemexpandingTreeDocuments);
Thanks!
|
|
|
|
|
If your using a CView derived class to host this in, you would want to make your code look something like the following...
//////////////////////////////////////////////////
// Generated message map functions
protected:
CTreeCtrl* m_pTreeCtrl;
//{{AFX_MSG(CTest234View)
//}}AFX_MSG
afx_msg void OnItemexpandingTreeDocuments(NMHDR* pNMHDR, LRESULT* pResult);
DECLARE_MESSAGE_MAP()
/////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CTest234View, CView)
//{{AFX_MSG_MAP(CTest234View)
//}}AFX_MSG_MAP
ON_NOTIFY(TVN_ITEMEXPANDING, IDC_DROP_TREE, OnItemexpandingTreeDocuments)
END_MESSAGE_MAP()
////////////////////////////////////////////////////
void CTest234View::OnInitialUpdate()
{
CView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_pTreeCtrl=new CTreeCtrl();
if (m_pTreeCtrl) {
m_pTreeCtrl->Create(TVS_HASBUTTONS |
TVS_HASLINES | TVS_LINESATROOT | TVS_FULLROWSELECT |
WS_TABSTOP|WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_SINGLEEXPAND ,
CRect(0,0,200,200),
this,IDC_DROP_TREE);
HTREEITEM hFirst=m_pTreeCtrl->InsertItem("First",NULL,NULL,NULL,TVI_SORT);
if (hFirst) {
HTREEITEM hSecond=m_pTreeCtrl->InsertItem("Second",NULL,NULL,hFirst,TVI_LAST);
}
}
}
void CTest234View::OnItemexpandingTreeDocuments(NMHDR* pNMHDR, LRESULT* pResult)
{
TRACE("Got here\n");
}
|
|
|
|
|
Well, CTreeCtrl derives from CObject so it'll probably throw a CMemoryException if it fails on "new" so my pointer check will probably never get reached on an error so it would be better located in a try/catch and I forgot to check the BOOL result from "Create" but you get the general idea.
|
|
|
|
|
thanks bob16792!
I create a tree control in my CDialog class, not CView class. well, I check my pointer is valid on "new" and the tree control I create appears on my dialog interface, so "Create" is successful.
If I drag a tree control on my dialog interface from the control box in the vc++, it can recieve the message,"VN_ITEMEXPANDED".
I don't know why the tree control that I create cannot recieve the message "VN_ITEMEXPANDED",but it can recieve the message "NM_CLICK".
|
|
|
|
|
|