|
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)
|
|
|
|
|
tx for your reply,
in your example it would actually be like that:
Double t = (25.5+0.0005)/1000; // but that still gives 0.025500499999999999 :doh:
but actually, it seems it be a display issue in the debugger viewer..
'cos even when the debugger shows a value d = 0.025500000001 where it should be 0.025500000000 when compare d with 0.025500000000, the result is true.
and a further check at the @ of the variable in the memory window, shows a correct value. TK GOD!
Fred
|
|
|
|
|
Yes you still will not have the correct answer to all those decimal places. The idea is that the answer is correct to the precision that you choose. In this case 4 decimal places.
You are quite correct in the matter of it being a display issue thereafter.
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)
|
|
|
|
|
Hi friends
How can i run a executable file i.e. "abc.exe" using a c++ program.
Please help me.
We Believe in Excellence
|
|
|
|
|
|
beuuuuurk
i advise you never use system() . moreover, calling abc.exe like you do will work only if abc.exe is in the $path$ ...
use ShellExecute() or maybe WinExec() instead...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Use the function CreateProcess if it is a Windows program.
|
|
|
|
|
The preferred methods are CreateProcess() or ShellExecute() . system() and WinExec() are throwbacks to the days of DOS and 16-bit Windows.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Hello,
I am developing an add-on for an application that uses active-x. I could mange to write the add-ons and seem there is no problem with the add-on expects one. The user may select a menu item from the original application when it should not be done so I want to hook into the menu item and replacing its serving function with my own function to tell the user that he shouldn’t do this or at least disable the menu item. I don’t have any way to do this using the interface that the application can give me ( at least I don’t know about such interface!). Is there any way to do this?
The main things that I want to do are:
Assume that you have a running application and you don’t have access to its source code.
1-I want that to change the status of the some menu items in the application (disable and enable them). Can I do this? If yes how?
2- I want to find when a menu item is selected by user. Assume that when the user select File menu item, the File() function in the application is called. Can I change it so that it call MyFile() function instead of original File() function? If yes can I call File() function from MyFile() function? If yes how can I do this?
Any help is much appreciated.
Best regards
|
|
|
|
|
There are two way I know of (and have used in an article) which may be of interest.
The first is to install an application wide hook (target application only) and monitor for WM_INITMENUPOPUP messages. If you use a RET hook (after the call has been processed), you should be able to change the state of inidividual menu items at this point.
The problem is that not all menus will generate a WM_INITMENUPOPUP message (if you specify the TPM_NONOTIFY style). For this I use an application hijack where we basically intercept the OS call to TrackPopupMenu/Ex and handle the menu at this point.
If the TPM_NONOTIFY style is set, you should be able to change the states of menu items at this point and have them correctly take effect.
THe methods I describe above can be found in my article http://www.codeproject.com/menu/QuickODmenu.asp[^]. You should be able to extract the areas of interest (assuming you dont need OD menus) and modify them to do what you need.
If you vote me down, my score will only get lower
|
|
|
|
|
In my company we are selling an application which is often upgraded. Till now we had the policy to send them email that new app is awailable and they just download it from our FTP with special username and password.
But this is getting rather stupid. I would like to have auto-update build in my app.
The problem is becouse there are so many solutions for this and all of them are wierd to me.
1.) MY first idea was that i have some kind of apache-php server which would deliver my installer.exe to my app. But people say that this is inpossible in PHP. They say that it only works with browsers. (This is wierd to me too)
2.) ISAPI filter or Extension?
3.) Should I just program Socket Server and integrate Socket Client in my app?
Any idea would be apriciated.
Tnx girls & guys
Hoorbnet
Love is the law, love under will.
|
|
|
|
|
Hello!
I have programmed one Auto Updater Application, Actually what the logic behind it is that my Application residing on
Client Computer, it self check for version update at a fixed interval and if it found an update it download itself new one (using UrlFileToDownload Api), after that it update itself in stealth mode (Updating on Local Computer was done by INNO Setup ).
Hope this will help!
"I Think this Will Help"
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
It has to have some sort of authentication implemented in client application.
Love is the law, love under will.
|
|
|
|
|
Hoornet93 wrote:
It has to have some sort of authentication implemented in client application.
Really Can't Understand
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|