|
I don't see why you need to overide Run() and I can't recall seing anyone do this in an app. If you need to handle messages before they get processed by the MFC message maps then use PreTranslateMessage(). That's what I do in ED (see sig) which is an MDI app.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
I'm overriding Run() because the standard handling for WM_TIMER events is too slow for my needs so I'm adding my own timer-handling to Run() although I didn't show that part of the code here since it was irrelevant to my question.
As it turns out, the reason my Update UI events weren't being called was because those are called by OnIdle(0). I'm not sure why I used 1 there before; I think was confusing it with the Sleep() function.
|
|
|
|
|
Have you tried using the timer call back function instead of the timer message. Timers aren't all that accurate to begin with and may not be an appropriate way to achieve your task.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
hi. any body knows a way to bind GDIPLUS.DLL or something to include this file to .EXE project file ?
thnx
-=Ehsan-de-Burge=-
|
|
|
|
|
Hi,
I use a MonthCalendar but the date isn't correct when I read the value.
anyone can help me for that or a link.
Best Regards
youssef
|
|
|
|
|
hello, could anyone help me?
I need a static control with a mechanism to notify parent window when mouse cursor runs over it.
thanks in advance.
|
|
|
|
|
I have a CListCtrl list which uses the SetExtendedStyle( LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT | LVS_REPORT ) to display a list control with gridlines. What I need to do is to show multiple columns that contain "editable" editboxes for several. So far, the closest example I have been able to find will only display editboxes when a listcontrol subitem is clicked. I need to display the editboxes all the time. And, they should not be affected by hor. or vertical listctrl sliders.
Thanks..
|
|
|
|
|
Personally for this type of input I use a GridControl.
This one here[^] is probably the best one around.
Michael
The avalanche has started, it's too late for the pebbles to vote.
|
|
|
|
|
Has anyone tried creating a project in Visual Studio .net that uses two separate resource files that share the same symbol header file? What I want to do is have the project's both resource files to show up simultaneously in the Resource View pane so I can edit them at the same time.
As far as I know, they only way this can be done is by adding both resource files under the corresponding branch of the project's tree in the Solution Explorer. However, doing this has a very interesting side-effect: even though the project builds fine when doing a full build, compiling a modified source file and re-linking seems to be impossible as the linker throws an exception and crashes. This is the output I get:
Compiling...
MainFrm.cpp
Linking...
MainFrm.obj : fatal error LNK1000: Internal error during Pass2
Version 7.00.9466
ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 004715DC (00400000) "C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin\link.exe"
NumberParameters = 00000002
ExceptionInformation[ 0] = 00000001
ExceptionInformation[ 1] = 00000001
CONTEXT:
Eax = 401AF86C Esp = 0012F2E4
Ebx = 1032E800 Ebp = 3FFF0000
Ecx = 00000000 Esi = 401AF7C4
Edx = 00000001 Edi = 400062A4
Eip = 004715DC EFlags = 00010246
SegCs = 0000001B SegDs = 00000023
SegSs = 00000023 SegEs = 00000023
SegFs = 00000038 SegGs = 00000000
Dr0 = 0012F2E4 Dr3 = 1032E800
Dr1 = 3FFF0000 Dr6 = 00000000
Dr2 = 00000000 Dr7 = 00000000
Since this doesn't happen when doing a full build, I assume it has something to do with the incremental linking option. Is this supposed to happen or is it one of the new Visual Studio's many bugs?
The only workaround I've found (after trying a zillion combinations of splitting and/or glueing resource and header files together) was to include the second resource file in the compile-time directives of the first one, replacing the .rc2 file that the Application Wizzard created, and have it appear in the Solution Explorer as a separate solution item, so that I can double-click on it and open it for editing. Anyone has any ideas for a more elegant solution?
Thanks.
|
|
|
|
|
Hi everyone,
I'm using VS C++ 6.0 I have an application that does file i/o. More specifically I'm reading in a binary file. My problem lies in a release build. when I build a release version, the eof(STREAM *) function never finds the end of file marker in my file. When built in debug mode, it easily runs without a problem, and returns 0 when finding the end of file marker.
Anyone know anything about this? I think I've found a bug in the multithreaded release library, but I don't know for sure. Anyone?? Any takers?? Thanks
Dan Willis
|
|
|
|
|
Post the line that checks the stream for eof. I do know that C++'s iostream objects have access it eof().
inFile.eof();
Kuphryn
|
|
|
|
|
Here's the line:
FILE *fp;
fp = GetScannerConfigFilePointer("rb");
....
do {
/Do my stuff
........
} while (!feof(fp));
What do you mean by access it eof() ??
Dan Willis
|
|
|
|
|
The chance of there being a problem with feof is VERY VERY slim. Your program has bugs in it that is either causing feof to not work properly (memory corruption) or feof is never called.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Yup, that's what I'm thinking, I just haven't found it yet :=/ Just thought I'd ask. My guess I'm overwriting memory somewhere, and I just haven't found where yet. :-/
I've use feof() many times before and haven't had a problem. :-/
Dan Willis
|
|
|
|
|
i did a test for using CRichEditCtrl with following code:
//class RichEdit is a sub-class of CRichEditCtrl
//the user-function is called by a button click
void RichEdit::StreamIn()
{
EDITSTREAM es;
es.dwCookie =0;
es.pfnCallback =Pro_StreamIn;
UINT uIn=SF_TEXT;
CRichEditCtrl::StreamIn(uIn,es);
}
//static class member
DWORD CALLBACK RichEdit::Pro_StreamIn(DWORD dwCookie,byte*pBuf,long cb,long*pcb)
{
static int iEnd=0;
CString cs;
cs.Format(cs+"Hello %d\n",iEnd);
int iLen=cs.GetLength();
memcpy(pBuf,(LPCSTR)cs,iLen);
if(iEnd%3!=2) *pcb=iLen;
else *pcb=0;
iEnd++;
return 0;
}
result:
--------click the button, text is:
Hello 0
Hello 1
--------click the button again, text is:
Hello 3
Hello 4
--------and so on as expected
my Q is:
1. if change style uIn=SF_RTF, text doesn't apear, why and how to fix it?
2. if format text with color, i.e. "Hello 0" as blue and "Hello 1" as red, how to do it?
thx in advance
includeh10
|
|
|
|
|
I had a project and when I created the toolbar buttons, in the prompt area i put stuff like:
Select keywords to search for\nSelect keywords to search for
which showed up when I hovered over the button. Now i am creating a new project and dont know what I did before that was special...but I dont see the prompt when i hover . In both projects, both the menu item and the toolbar button associated with it have the same ID...thats pretty standard. There was no updateUI handler for my first projects button and none now....
Appreciate your help,
ns
|
|
|
|
|
hi,
how to use CStdioFile to read separate lines from file like ifstream?
|
|
|
|
|
What do you mean separate lines? Do you mean one line at a time or do you want to skip lines?
ReadString();
Kuphryn
|
|
|
|
|
Anonymous wrote:
how to use CStdioFile to read separate lines from file like ifstream?
forget about it! use the ifstream!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I have a C++ class that allows declaration of static functions , but I needed to declare static variables also . As for example I need to access the current object in a static timer procedure as I needed to do some Initialization .
I did the following in my Class definition
class MyClass {
public :
-
static MyClass *thisPtr;
-
};
I got a Linker error . I am not able to figure out the mistake here . Please help
|
|
|
|
|
You've to initialize your static variables outside your class.
This could look like
MyClass* MyClass::thisPtr = NULL
|
|
|
|
|
MyClass* MyClass::thisPtr = NULL
This really works but I am failing to understand the significance
of MyClass*. I have already declared the type for thisPtr in my class ?
Thanks for the help
|
|
|
|
|
act_x wrote:
I have already declared the type for thisPtr in my class ?
Sure, but when initializing it the compiler needs the the type again. I think it's to do with the handling of static variables - they aren't assigned to memory space together with class variables - they're "on their own".
But that goes to much into theory for me ... everytime I need to know s.th. about that I'm asking my C++ compendium
|
|
|
|
|
|
Static member variables are equivalent to global variables. Putting it inside a header file basically announces to the CPP files (that include it) that it exists and what its type is. But it's not until you define it inside a CPP file that it gets instanciated and the linker can then retrieve its memory address.
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|