|
What might be part of the problem here is that char is signed and wchar_t is unsigned. Thus char -> wchar_t is a degenerative conversion given that over half the range of char can not be properly mapped to wchar_t. However, char -> bool is a well defined conversion given that char fully maps into a bool.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
How icon run my program as any programs in computer,for example i programmed an organizer and i want to run it as any programms,how i can build it ,,any one help me?
|
|
|
|
|
BOOL CWnd::GetWindowPlacement(WINDOWPLACEMENT* lpwndpl) const
{
<code>ASSERT(::IsWindow(m_hWnd));</code>
lpwndpl->length = sizeof(WINDOWPLACEMENT);
return ::GetWindowPlacement(m_hWnd, lpwndpl);
}
Crash says its not a window. However in my code I am getting a nonNUll pointer:
for (int i = 0 ; i <imageDisplayVectorsize ; i++)
{
CImageDisplay* imageDisplay =ImageDisplayVector[i];
imageDisplay->GetWindowPlacement(&wp);
I've used my ImageDisplayVector elsewhere as
int vecSize = ImageDisplayVector.size();
for (int i = 0; i < vecSize; i++)
{
CImageDisplay * pImageTemp = ImageDisplayVector[i];
pImageTemp->ShowWindow(SW_SHOW);
}
and the windows show up (first I'd hidden them) with no problem. Which makes me think my pointer is fine.
SO why does the GetWindowPl think its not a window?
How shall I approach the debugging of this problem?
Appreciate your help,
ns
|
|
|
|
|
Hello Everybody:
This is the weirdest thing that I experienced with MFC. In a project that I'm working, there is a class that is derived from a CScrollView that displays images. When I run the program and the CScrollView is visible on the screen, sometimes it shows up as a text editor. It stays as an text editor and the images shows up. There are some occasions that the text editor just stays there. By any chance any of you guys experienced this before? Any place that you guys can suggest that I can start looking? It's been hard to spot because the code is written by someone else. I tried in the CScrollView's OnInitialUpdate and I don't find anything. This is happens in a Win2k and a WinXP machine. Any answer is more than welcome.
Best regards,
Luis E. Cuadrado
)
|
|
|
|
|
I spent a while debugging this.:
I had a loop:
for (int i = 0; i &< nSize; i++) ;
{
vec[i]->someMethod();
}
where I was storing pointers to a class in the STL vector.
Well, eventually I saw why my code was crashing......(the . What puzzles me is that the variable i was still holding its final value of nSize + 1 when it finished with the for(). Besides which my code should have complained that i was not declared.....since its within the for ....
Maybe i am wrong in my scope assumptions?
Appreciate your help,
ns
|
|
|
|
|
Declaring a variable inside the for() is the same as declaring it outside the for(). I'd certainly prefer this not to be the case. As an aside you should be using STL iterators.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
I could...but thats the appeal of an STL vector for me instead of some other container- accessing by index ............ But it would save me from this sort of mishap
Thanks much. I was mistaken in my scoping assumption then.....
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
I was mistaken in my scoping assumption
Actually, you're right. Microsoft is wrong in this case. Very annoying when you're trying to code for multiple platforms.
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Hasn't this change been introduced only recently to the standard?
And, although it solves a common nuisance, it can make existing code break silently (though admittedly badly written). A bad move, I'd say...
Those who not hear the music think the dancers are mad. [sighist] [Agile Programming]
|
|
|
|
|
peterchen wrote:
Hasn't this change been introduced only recently to the standard?
Depends if you work for Microsoft and/or consider half a decade to be "recent", or if you consider the ISO C++ standard to be a document Microsoft should follow.
|
|
|
|
|
As I understand it, this was in the proposed revisions, then taken out, then put back in.
If you want the standards behavior you can add extra braces:
{for (int i = 0; i < 10; i++)<br />
{<br />
...<br />
}}
Incidentally, you can turn this enforcement on in VC++.NET.
|
|
|
|
|
Joe Woodbury wrote:
Incidentally, you can turn this enforcement on in VC++.NET.
That might be what you believe, and what Micros~1 wants to fool you into believing - the truth is that you're only screwed from the side, and not directly from behind, with that "fix".
for (int i=...) {}<br />
for (short i=...) {<br />
}
|
|
|
|
|
Mike Nordell wrote:
for (int i=...) {}
for (short i=...) {
// guess type of 'i'
}
short
I just checked (and it does what it advertises.)
|
|
|
|
|
ns wrote:
What puzzles me is that the variable i was still holding its final value ...
This is a well known bug in Microsofts compilers, and even in their "latest and greatest" the bug persists, only in a much more evil form:
for (int i=...) {}<br />
for (short i= ...) {<br />
}
There is but one solution to this problem: To the top of every source file wanting to keep scope of for-loop-variables, add
#ifdef _MSC_VER<br />
#define for if(0) {} else for<br />
#endif
|
|
|
|
|
But his snippet has nothing to do with the "well known" bug?! Or am I missing something?
Those who not hear the music think the dancers are mad. [sighist] [Agile Programming]
|
|
|
|
|
peterchen wrote:
But his snippet has nothing to do with the "well known" bug?!
Yes it has.
Or am I missing something?
Yes you are. This is about scoping of for-loop-variables. Once the for-loop is ended (in the example the terminating semicolon), 'i' is no longer valid. Yet, inside the (artificial and superflous) scope; 'i', which is no more (if following international rules, which MS are not), is still accessible from the broken compiler(s).
|
|
|
|
|
Actually, there's a peculiar inconsistancy with the standard. The opening brace of a for loop is essentially considered superfluous and a hidden brace is implied as being before the declaration.
However, in a do loop, the closing brace is NOT considered to be after the while condition. (Frankly, I wish it were, but it isn't.)
Finally, in Visual Studio .NET, you can turn on enforcement of the standard for scopes of for loops (/Zc:forScope) You can also turn off Microsoft extensions.
|
|
|
|
|
Hi,
I'm trying to set up doxygen, and encountered two things I can't figure out:
1) Can I automatically put all sources of one folder (and below) into a documentaiton module? (i.e. without touching every file in the folder)
2) I'm can't figure out how to get the following handling of undocumented members:
- they should be listed in the class overview
- the detailed spec should not contain them
Any doxy wizards around here?
TIA
Peter
Those who not hear the music think the dancers are mad. [sighist] [Agile Programming]
|
|
|
|
|
peterchen wrote:
Can I automatically put all sources of one folder (and below) into a documentaiton module
There's a RECURSIVE flag in the config file that you can turn on. In conjunction with FILE_PATTERNS, you can control what gets processed.
Not quit sure what you mean by #2. If you mean they should appear in the list of public methods but not have a detailed description further down the page, isn't that what happens anyway. I either totally ignore undocumented methods or document them
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Thanks!
#1) When using the recursive flag, everything is documented at the same level. However, with the following structure:
FooLib\
BarDll\
Appl\
I'd like to have sth. like "Project FooLib", "Project BarLib" etc. as oder criteria. If I udnerstand correctly that's what I can somehow achieve with the \ingroup / \addtogroup / \defgroup identifiers, but I didn't get it working at all.
#2) for the class:
struct CBar
{
void Documented();
void Undocumented();
}
I get the following HTML (rougly):
struct CBar
public methods:
void Documented();
Documented Method
void Undocumented(); (1)
Details:
void Documented()
Documented Method.
This one has been documented
implemented in bar.cpp, line 22
void Undocumented() (2)
implemented in bar.cpp, line 77
I played around, I either have both (1) and (2), or none of them. What I'd like is (1), but not (2).
Part of the project is a large code base with very irregular comments (can't auto-convert into doxygen style). I'd like to progressively touch up the parts I'm working on anyway, but I have no chance to document everything on one run. Yet I'd like to see the member listing, but without the bulky information-free details section.
Those who not hear the music think the dancers are mad. [sighist] [Agile Programming]
|
|
|
|
|
peterchen wrote:
I'd like to have sth. like "Project FooLib", "Project BarLib" etc. as oder criteria.
Trying to do this with Doxygen would be pretty hairy I would create a separate project for each one which is a better solution anyway, IMO. I have a Python script that I run every night which walks our directory tree building MSVC and Doxygen projects. It then creates an index page that links to the output of every Doxygen project that it built.
For #2, there is a way to turn off the detailed entries if you don't explicitly provide any documentation. Look at ALWAYS_DETAILED_SEC although you might need a combination of switches. Otherwise, I suspect it probably can't be done. You could always sumbit a feature request. Or do it yourself
You might want to take a look at DocJet[^] as well. It's not free but it doesn't require tags and does a reasonable sort of a job figuring out what your comments mean.
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
#1: separate projects was my initial thought, I justed hoped for the added bonus of the projects automatically cross-linked
#2: I played around with the options pretty much, didn't find any. But a feature request sounds like a good idea - once I figured out it really can't be done.
DocJet: I won't get anything "fancy" approved that is >$400, But it sure looks good (and they have a great web site!)
Thanks for your time!
Those who not hear the music think the dancers are mad. [sighist] [Agile Programming]
|
|
|
|
|
peterchen wrote:
I won't get anything "fancy" approved that is >$400,
You could try approaching your boss with the calculation:
my hourly rate * #hours spent faffing around with Doxygen > cost of DocJet.
Never worked for me, though...
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Hello,
I am writing an SDI app which uses the IE CHTMLEditView class new to MFC 7.0.
From my main application window I am opening a second CFrameWnd with a new CHTMLEditView view. In this new window class I am attempting to populate the view, as follows:
//this runs after the new window is created.
void CNewMsgFrame::SetMsg(CString pString)
{
MessageBox("Hello!!!!");
CHTMLEdDoc* pDoc = (CHTMLEdDoc*)GetActiveDocument();
//pDoc->m_pHTMLView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
//pDoc->m_pHTMLView->ShowWindow(SW_SHOW);
//SetActiveView(pDoc->m_pHTMLView);
//pDoc->m_pHTMLView->SetWindowText(pString);
pDoc->m_pHTMLView->SetDocumentHTML(pString);
RecalcLayout();
}
I want to show an HTML page in the view (m_pHTMLView), and am using the SetDocumentHTML() method to load the HTML. However I find that the view remains blank. The only way I can get it to show the page is to include a MessageBox in the code: after the messagebox is shown, m_pHTMLView somehow rights itself, and displays the page properly! I find this very curious. Somehow using the messagebox seems to ensure that the new view is initialised properly: without that I must be leaving out some necessary code.
I would be grateful to know if someone can spot what code is left out, which is needed to make SetDocumentHTML() work correctly. (The commented bits of code are things I tried to make the code work, but which didn't help....)
Thanks,
Paul Trimming
|
|
|
|
|
Paul,
It sounds like your SetMsg() function is called before the new FrameWindow/View is visible. I'm not using MFC7, but there are examples for VC6 which show how to use CHTMLView, which I assume is a subset of CHTMLEditView. One example is MFCIE. I'm using CHMTLView plus extra MSHTML editing stuff in a new app without any problems. Hope that helps.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|