|
I'm confused. Delving into the CMemFile code, it looks like the internal CMemFile buffer is NULL, which means that (memory shortage problems aside) the rich edit control has never called the callback to write to the file.
It might be worth putting a breakpoint before the offending line and taking a look at the memFile member variables to see if there is indeed a valid looking buffer in there!
If there is no buffer, it could be down to where you are calling the function from - could it be at a point where the rich edit control might have already cleared down the content and started destroying itself?
Just out of interest, what did you set GETCONTENT_BUFFER to? I set it to 4096.
Sorry I can't be any more help!
|
|
|
|
|
You use the compiler switch /Zc:forScope if you want standard C++ behavior for for loops with Microsoft extensions (/Ze). Standard behavior is to let a for-loop's initializer go out of scope after the for loop.
However, this switch APPEARS not to work if you are watching the value of a for-loop's initializer in a Watch Window
Consider the following code compiled with /Ze and /Zc:forScope:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<code>#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
float doug[3] = {0.0};
for (short i = 1; i < 3; i++)
{
doug[i] = 3.3;
} //next i
short i = 0;
short a = i;
cout << i << endl << a ;
return 0;
}</code>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Firstly, you get a compiler warning:
warning C4258: 'i' : definition from the for loop is ignored; the definition from the enclosing scope is used.
The warning is at the line:
<code> short i = 0;</code>
I claim that this warning is nonsense, since the definition of "i" should not exist at this point. How can you ignore something that does not exist?
Anyway, run the code past the for-loop and pause at the line:
<code> short i = 0;</code>
Note at this point that, according to the Watch Window
i = 3
a = -13108 (Why should "a" even exist at this point, albeit with a nonsense value?)
Now pause at the line:
<code> cout << i << endl << a;</code>
Note that the Watch Window says
i = 3
a = 0
In other words the Watch Window reports the value of "i" INCORRECTLY, whilst internally the program seems to have got the right idea.
Pinch yourself and see if you are not hallucinating with the line:
<code> cout << i << endl << a ;</code>
Yup ... both "i" and "a" really do seem to have value = 0, BUT the Watch Window STILL says that i = 3!
(Incidently disabling Microsoft extensions altogether with /Za fixes the Watch Window problem)
This is all very unsettling for a beginner programmer.
2 Questions:
1. Can anyone shed any light or comment? Am I missing something?
2. According to the Watch Window, why does "a" seem to exist before getting to the line:
<code> short a = i;</code> ???
Thanks to all,
Doug
Doug
|
|
|
|
|
Use gcc.
BuggyMax
|
|
|
|
|
I cannot use gcc in my code.
Benchmarking shows that gcc in my application, which is computation intensive, slows it down to 1/3 of the unmanaged version.
Doug
Doug
|
|
|
|
|
//This code works but the string is signed. How do I convert a large DWORD to a string format?
thanks
DWORD dw = 4294967281; //0xFFFFFFF1;
CString strNum;
strNum.Format("%d", dw);
DWORD dw2 = atol(strNum); //problem strNum looks like -15 and not 4294967281
ASSERT(dw == dw2);
|
|
|
|
|
|
%u - thank you very much!
|
|
|
|
|
I'm adding a new feature into my program that will move saved games (for Microsoft's Freelancer) to different folders. The problem is, saved games reside in each users' "My Documents\My Games\Freelancer\Accts\SingePlayer" folder, and I don't know how to find other users' My Documents folders. Is that possible? It's fine if the solution requires admin priviledges in 2000/XP.
|
|
|
|
|
Hi together,
I have written a thread last week concerning "CRecentFileList", but it seemed that nobody could help me, so I want to ask again for help:
Does anybody of you knows an nice article or an working example (MRUCombo doesn't work correctly for me) that could eventually helps me?
That would be very nice!
Best regards, Tobias
|
|
|
|
|
Hi together,
do you know a good Tutorial for me about how do Print arbitrary things, for example something like an Array of Integers, or some Strings, with MFC?
Neither I know a good tutorial, nor I have an idea how to address the printer!
Please, it will be very nice, if you can help me!
Best regards, Tobias
|
|
|
|
|
Once you have the printer's DC, use its TextOut() method.
|
|
|
|
|
Thanks for your Reply!
I found an article about printing with use of a CPrintDialog and other things at
www.c-plusplus.de
Greetings, Tobias
|
|
|
|
|
Hey All,
I am in need of some function or library that will allow me to intercept (or spy on) messages in a third-party application (essentially any application) similar to Spy++. I noticed an application posted here called InterSpy, but it uses hooks and you need to add code to your application to spy on messages. Spy++ obviously doesn't require this since you can spy on any application. Does anyone know how Spy++ works?
Tom
|
|
|
|
|
I think global hooks can be used without injecting any code into the target application. SetWindowsHookEx with dwThreadId set to 0 seems to watch on every thread within the desktop, from what the docs say.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I was thinking the same thing.
A global system hook should catch messages without any code in the target application. That's what a global hook does.
hey
|
|
|
|
|
|
I thought the source for Spy++ was came with the MS Platform SDK. Aren't there other articles here on CP about hooking into other apps. I'd also be looking on MSDN. I'm sure you'll find articles there on doing this stuff.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Take a look at the Winspector program in the free tools section here. Its a home grown version of spy which works a lot better in many ways. The only problem is that the source is not available, but you can get hold of the exe.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
how to get HTTP POST data before sending request from multipart/form-data encoded form ?
This kind of forms gives empty post data in this event, and headers parameter contains chaotic part of data sent, like this :
Content-Type: multipart/form-data; boundarrt/form-data; boundary=--------------7d3892
and that's all what is sent.
It must be some bug in IE (i have 5.0), or htmlview, but i couldn't find anything on net about this ?
Anybody has the idea what's wrong ?
Thank you
rrrado
|
|
|
|
|
You can not do this from view....
Pluggable protocol/filter is your best bet.
|
|
|
|
|
But how to make mime filter and attach it to one instance of webbrowser ?
I've never wrote any mime filter or pluggable protocol, but it seems to be only
permanent or tmporary, but both types seems to be global for all instances of IE. I don't want this filter to be called even if user is browsing in IE outside my application.
Thank you !
rrrado
|
|
|
|
|
1) Even if you wanted you can not make app, or mime global for default protocol such as http.
2) Just register temporary proxy app / or filter and you will get access to bindinfo.stgmedData
Brian
|
|
|
|
|
can u post an article on how u solved this problem after u solve this.thx
qrious
|
|
|
|
|
Help wanted!
I need to create a resourceless dialog box. I want it to use a WndProc instead if a DlgProc, and I want to use CreateWindow instead of CreateDialog or variants.
Is there a standard window class which I can use to accomplish this task?
I was thinking of:
CreateWindow(TEXT("DIALOG"), TEXT("HELLO"), WS_VISIBLE, ...)
^^^^^^
The window class
Thanks in advance
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
S van Leent wrote:
Is there a standard window class which I can use to accomplish this task?
No, you have to create your own. The closest thing to this is using a standard/common style bit when creating your own class.
Here's a typical one. And, hInstance should be the same value that's passed to your WinMain () procedure.
TCHAR szClassName[] = _T("Pick Something Unique");
WNDCLASS wc;
...
wc.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAINFRAME);
wc.lpszClassName = szClassName;
RegisterClass(&wc);
...
hWnd = CreateWindow(szClassName,
_T("Hey"),
WS_OVERLAPPEDWINDOW,
100, 100,
200, 200,
NULL,
NULL,
hInstance,
NULL);
Jeremy Falcon
|
|
|
|