|
Are you able to post those 40 lines of code that cause the problem. Perhaps another set of eyes can find something you missed (unlikely I know, but possible).
Man, you really confused me when I replied and found your post had disappeared
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Someone considered it a programming question it seems Well, I'm to tired to argue with anyone.
I'll poke some other eyes and sticks on the code tomorrow. My main problem is that fixing that one place doesn't help me, and I don't expect another patch from Microsoft either :-/
OK, tomorrow. tired. cat wants food.
I never really know a killer from a savior boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
Best Wishes...
- - - - - - - - - - - - - - - - - - - - - - - -
Many nights we've prayed with no proof anyone could hear, we were moving moutains long before we knew we could !
Yet now i'm standing here, although we know there's much to fear, hope seemed like summer bird too swiftly flown away ...
There can be miracles! When you believe, though hope is frail, it's hard to kill !
Who knows what miracles, you can achieve! When you believe, somehow you will ...
YOU WILL WHEN YOU BELIEVE
|
|
|
|
|
peterchen wrote:
My main problem is that fixing that one place doesn't help me
No, but it might reveal the construct that is causing the problem and a way to get around it. I've had situations where the compiler has simply crashed trying to compile moderately complex logic, and it took forever to isolate where the problem was. I've also had "Internal Compiler Error"s when I've accidentally used bitwise rather than logical operators in conditional expressions.
Are you able to isolate which line of code (or near enough, considering the optimisation) causes the incorrect instructions?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Try disabling optimizations using pragma's and sucessively narrow down the area where optimizations are disabled until you can isolate the line that the problem is on... then either fix the issue by re-writing the line or simply leave optimizations disabled for that specific line.
steve
|
|
|
|
|
1. what are the differences among:
CString* str;
,
CString *str;
and
(CString*) str;
?!
2. what are LPVOID,LPCTSTR,LPTSTR,LPARAM...
(u may give me a link)
thx
|
|
|
|
|
These two mean the same thing:
CString* str;
CString *str; Since whitespace is not important, they have the identical meaning. The first one is more common among C++ programmers, while the second way is more common among old-school C programers.
This:
(CString*) str; is not a declaration at all. It's an expression statement that casts str to CString* and then throws away the result.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Magnae clunes mihi placent, nec possum de hac re mentiri.
|
|
|
|
|
1. There is no difference between the first and second declarations, but the third, you are casting str, whatever it is, as a CString and therefore is dissimmilar.
2. Those are data types that are all pointers to established types. LPVOID is a pointer to any type of data. LPCTSTR translates to an LPCWSTR (constant null-terminated string of 16-bit Unicode characters) if UNICODE is defined, else it defaults to constant null-terminated 8-bit Windows ANSI characters, in other words, if UNICODE is define, you'll get a wider string. LPARAM is a message parameter. I paraphrased from a Windows Data Types page in this Visual Studio .NET help file, not a website.
If anyone wants to correct something or add, be my guest.
|
|
|
|
|
i think the two replies above this one has done question 1 enough justice.
as for LPVOID, LPCTSTR, LPTSTR, LPARAM and so on... they are Microsoft
defined macros of otherwise basic types... think of it this way....
L = LONG = long
P = represents the * (pointer)
LP = pointer of size long
VOID = void
C = const
T = TCHAR
TCHAR = char or wchar_t depending on if the UNICODE macro is defined
STR = string
PARAM = parameter
so LPVOID is just (long) pointer to void/anything
LPCTSTR is just a (long) pointer to a const string of type TCHAR
for more Microsoft defined types lookup "Windows Data Types"
Cheers
|
|
|
|
|
Actually, LPVOID and PVOID are the same thing. The L doesn't mean anything any more, and is simply a hangover from the 16-bit DOS/Windows days. Back then:- PVOID was a NEAR pointer that pointed to an address in the same segment and required 16 bits of storage
- LPVOID was a FAR pointer that could point to anywhere in the memory address space and required 32 bits of storage
Under Win32, there is no concept of NEAR and FAR pointers since the address space is a flat 32-bit address space and segments are not required.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Sawjai wrote:
i think the two replies above this one has done question 1 enough justice.
as for LPVOID, LPCTSTR, LPTSTR, LPARAM and so on
and i'd conclude by saying :
<font color=#0000FF>typedef void</font>* LPVOID;
<font color=#0000FF>typedef const</font> TCHAR* LPCTSTR;
<font color=#0000FF>typedef</font> TCHAR* LPTSTR;
<font color=#0000FF>typedef</font> DWORD LPARAM;
<font color=#008000>
<font color=#0000FF>#ifdef</font> _UNICODE
<font color=#0000FF>#define</font> TCHAR wchar_t;
<font color=#0000FF>#else</font>
<font color=#0000FF>#define</font> TCHAR <font color=#0000FF>char</font>;
<font color=#0000FF>#endif</font>
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I was reading the following article http://codeproject.com/clipboard/archerclipboard1.asp[^]
and when I compile the code, it give me an error
(error C2039: 'GetWindowTextA' : is not a member of 'CString')
and it says "see declaration of 'CString'"
any help with this?
thanks in advance
|
|
|
|
|
Dody_DK wrote:
I was reading the following article http://codeproject.com/clipboard/archerclipboard1.asp[^]
is not opening on my Ccomputer , i don't knwo why.
Dody_DK wrote:
and when I compile the code, it give me an error
(error C2039: 'GetWindowTextA' : is not a member of 'CString')
and it says "see declaration of 'CString'"
GetWindowText it Self a Win32 Api ,search for it in your local copy of MSDN
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Better ask article related questions in their own forums/Message Boards. People dont like it here generally as you would have noticed by now.
Found on Bash.org
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
My Articles
|
|
|
|
|
it seems like you call something like CString::GetWindowText() .
you probably have a such lines :
CString str;
str.GetWindowText();
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
As others have said, questions about code in an article are best put in that article.
But I'm in a good mood.
Search MSDN for GetWindowText for all the answers you can shake a stick at.
GetWindowText is either a windows API function:
int GetWindowText( HWND hWnd, LPTSTR lpString, int nMaxCount );
Or a member function of CWnd:
int GetWindowText( LPTSTR lpszStringBuf, int nMaxCount ) const;
void GetWindowText( CString& rString ) const;
You can see the last member function takes a parameter of CString.
CString has no member function GetWindowText.
So in your code you probably have
CString str;
....
str.GetWindowText (...);
which should be:
void CMyWnd::OnSomething (...)
{
CString str;
....
GetWindowText (str);
....
}
Iain.
|
|
|
|
|
oki guys, since it is not the right place, so I would not talk more about it... and sorry if that disturbed you... thanks alot
|
|
|
|
|
I took advice from Antony M Kancidrowski and changed my class to look like:
class C489guiApp: public CWinApp {<br />
public:<br />
BOOL InitInstance() {<br />
m_pMainWnd = new C489guiFrame;<br />
m_pMainWnd->ShowWindow(SW_SHOW);<br />
m_pMainWnd->UpdateWindow();<br />
<br />
pFrame = reinterpret_cast<C489guiFrame*>(m_pMainWnd);<br />
ASSERT(pFrame != NULL);<br />
<br />
return TRUE;<br />
}<br />
C489guiFrame* pFrame;<br />
...<br />
It compiles but I get a runtime error:
Unhandled exception at 0x7c224c6c (mfc70d.dll) in 489gui.exe: 0xC0000005: Access violation reading location 0x0000000c.
The line it points to is an if statement:
if (!(pSBP->nFlags & SBPF_UPDATE) &&
((lpszNewText == NULL && pSBP->strText.IsEmpty()) ||
(lpszNewText != NULL && pSBP->strText.Compare(lpszNewText) == 0)))
and then it returns true if that if statement is true, the arrow points to the last line. Am I not doing something else correctly? As before, I'm new to this so be gentle on my comprehension, thanks a lot in advance.
|
|
|
|
|
I think that you use a variable which isn't initialized. Is pSBP correctly set before using it? Was lpszNewText correctly initialized?
Fold With Us!
Sie wollen mein Herz am rechten Fleck
Doch seh ich dann nach unten weg
Da schlägt es links
|
|
|
|
|
Hi,
Can anybody help me out with this strange problem?
I have a dialog-based application. On the main dialog I have a CRichEditCtrl that I read the contents of a file into it.
The CRichEditCtrl has the Horizontal scroll, Vertical scroll, Auto HScroll and Auto VScroll properties set to true.
Whenever I use the vertical scrollbar, it automatically scrolls back to the top after about 5 seconds. Any suggestions as to what might be the cause of this?
Thanks very much,
dlarkin77
|
|
|
|
|
What else is going on in your dialog? Do the contents change over time? Are there user-defined messages being sent to/from it? Spy++ is your friend: what messages coincide with the reverted scrolling?
You left me high and dry and changed me
You lied to me and now i’m angry...
|
|
|
|
|
Thanks for the reply Shog9.
I found what was causing the problem. It was actually an error on my part.
dlarkin77
|
|
|
|
|
Hi guys,
PC : Intel PIII 700MHz with W2k SP6
I was using VC++ 6 with VisualStudio SP4 and the result of a calculation like this one..
double res = 25.5/1000; // would give you 0.025500000000, as you can expect..
Now, here’s something quite weird:
I’ve just upgraded VS to SP6 and the same calculation now gives me..
double res = 25.5/1000; // 0.025499999999999998 ?????
even worse if you write:
double t2 = 5.f*0.001f; // 0.0050000002374872565 :wtf:
And it seems to be like that every time you try to compute 2 doubles or a double and an int for ex. (multiplication or division !)
as anyone noticed something similar? Wonder if there is any fix for that one.
Tx
Fred
|
|
|
|
|
|
Fred D. wrote:
Wonder if there is any fix for that one
I doubt it. What you have stumbled across is inevitable with floating point arithmetic.
You need to decide what precision you want and round up to that precision after your calculation. You can then show the floating point number to the precision required.
e.g.
double res = 25.5/1000 + 0.0005;
for your example.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|