|
Please pardon the very newbie question, but....
I have two edit controls and an OK button in a dialog box. Edit1 is read only multiline and Edit2 is single line. What is the best way of appendin text from Edit2 into Edit1? I want to press Enter after entering text in Edit2, but I don't want to dismiss the dialog.
I added an invisible button, made it default, then put the copy and paste text in the OnButton1 handler, but that is a real kludge.
Once again, a very beginner question I know, but thanks to anyone who can help.
|
|
|
|
|
|
Hey all.
When asynchroniously downloading a file from an HTTP server, is it possible to receive INTERNET_STATUS_REQUEST_COMPLETE messages AFTER receiving an INTERNET_STATUS_CONNECTION_CLOSED message? Is it possible during a successful download, or only in a case of a failure?
Thank you!
|
|
|
|
|
Hi,
I want to draw a transparent bitmap into a dialogbar. There are exemples for drawing t. bitmap into dialog but none for dialogbar.
Anyone can help?
Everything's beautiful if you look at it long enough...
|
|
|
|
|
I have some void functions in my class
void B1(void);<br />
void B2(void) ; for which I type defined the following
typedef void EMPTYFUNC(void);
In a Thread Function I need to call these functions based on the value of a variable
UINT ThreadFunc(LPVOID p)<br />
{<br />
MyClass *thisPtr = (MyClass *)p;<br />
EMPTYFUNC *fPtr;<br />
switch(thisPtr->whichFunction)<br />
{<br />
case FIRST_FUNC : fPtr=thisPtr->B1;break;<br />
case ..<br />
<br />
}
I am getting an error at fPtr=thisPtr->B1
What am I doing Wrong ?
How should i call the function ?
Thanks
|
|
|
|
|
You need pointers to member functions, which resemble pointer to functions but have different syntax:
typedef void (MyClass::EMPTYMYCLASSMEMFUNC)(void);
UINT ThreadFunc(LPVOID p)
{
MyClass *thisPtr = (MyClass *)p;
EMPTYMYCLASSMEMFUNC *fPtr;
switch(thisPtr->whichFunction)
{
case FIRST_FUNC : fPtr=&MyClass::B1;break;
case ..
(thisPtr->*fPtr)();
} The syntax is admittedly weird. If you want to know more, search on some tutorial about "pointers to member functions".
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
i'm pretty new to this. i'm not even sure if "casting" is the term.
i need to take a string, convert it to an integer so i can do some math, then convert it back to a string to send out to a messagebox.
example:
int a;<br />
int b;<br />
int result;<br />
<br />
result=a+b;<br />
MessageBox(result); ideally a, b, and c would start out as a string, but i don't know how to convert so this might be a bad example.
|
|
|
|
|
Look in Mike Dunn's C++ FAQ[^] for methods to convert strings into numbers an vice versa.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm working on an MDI application and I wanted to do some custom handling for certain types of messages so I'm overriding the Run() function of my app like so:
<br />
int CMyApp::Run()<br />
{<br />
MSG msg;<br />
while(1)<br />
{<br />
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))<br />
{<br />
if(msg.message == WM_QUIT)<br />
break;<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
else<br />
{<br />
OnIdle(1);<br />
}<br />
}<br />
return msg.wParam;<br />
}<br />
This seems to work perfectly for some aspects since menus and the views for my documents are responding correctly to my mouse and keyboard events. However, all the ON_UPDATE_COMMAND_UI events for my toolbars have suddenly stopped receiving messages. What did I do wrong?
|
|
|
|
|
I don't know, but you can take a look at the source code of MFC (it is shipped with your Visual Studio) and know exactly how CWinApp::Run is implemented.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
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
|
|
|
|