|
First of all: I do not know WHY it freezes, but I give you a hint how to make it better:
Derive the CSocket class and override the OnReceice()-function, you won't then have to wait until you receive a packet but just get noticed through this function when a new packet arrives.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
If memory serves correctly (sorry, it's been a while) you need to insert a line break (\r\n) at the end of each request to the server other wise the server can't detect the end command, ie:
USER guest\r\n
PASS mypassword\r\n
Hope this helps....
|
|
|
|
|
hello @all,
does someone know, how I can round a double-number on two right-of-comma positions?
sunny
|
|
|
|
|
Hi,
I just came across an old article where the author had a program that was essentially an endless loop that would scan a directory for files and move them from that directory to somewhere else on the machine.
Under 'possible enhancements' he mentioned that he could use multiple instances of this same process to squeeze more performance - ie, to move more files, either in the same source directory or different directories.
This seems kind of goofy to me. I say the only performance gain you'd get would be on multi-processor machines, and that otherwise you'd actually be degrading performance since you're increasing the load on the OS scheduler.
Thoughts?
HB
|
|
|
|
|
It seems to me that the performance bottleneck would be the disk I/O in any case, and so extra processes/threads are unlikely to increase performance by any significant margin.
Dave
|
|
|
|
|
My app uses a CScrollView for one of it's document types and there can be a very large number of records to be displayed. I have now found that the TextOut() vertical position variable (an integer) is overflowing and therefore OnDraw() is redrawing the view with later data records. What is the correct method of displaying a VERY large number of records in a CScrollView window ??
Doug
|
|
|
|
|
Hi,
I'am creating a MDI App with a dialogbar in it. Inside of the dialogbar I have a bitmap that I have loaded with the ressource editor. I want some part of the bitmap to have the system color.
I have tried:
MainFrame::Mainframe()
{
CBitmap bitmap;
COLORMAP tabcolormap;
tabcolormap.from = RGB(255,255,255);
tabcolormap.to = COLOR_SYSTEM;
bitmap.LoadMappedBitmap(IDB_LOGO,0,&tabcolormap,1);
}
My App run well but the bitmap doesn't change.
My dialogbar is created with:
CDialogBar mydialog;
if(!mydialog.Create(this, IDD_DLGBAR, CBRS_RIGHT, IDD_DLGBAR))
{
TRACE0("Failed to create dialog bar\n");
return -1; // fail to create
}
any ideas?
thanks!!
|
|
|
|
|
I did not get exactly what you ment..
maybe the bitmap repaints before it appears..
try to handle tha onpaint event for it..
|
|
|
|
|
2 questions:
1. How do I search this message board? I had seen postings before but since I can't search for it, I can't find the answer. I thought there used to be a search link.
2. When a user selects "Display Properties" | "Settings" tab " | "Advanced" button | "Font Size" combo and selects "Large", is there a way to detect this programmatically? I need to resize my grid controls depending on whether normal or large fonts were sel'd cuz everything is not displayed or visible.
|
|
|
|
|
1. There's a "Search" edit control at the top. I think it will search the message board.
2. You can do it like this:
HDC a_hDC = ::GetDC( NULL );
BOOL a_bIsLargeFonts = (::GetDeviceCaps( a_hDC, LOGPIXELSX ) != 96);
::ReleaseDC( NULL, a_hDC );
Didn't compile it, but that's the basic idea.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
Chris Richardson wrote:
1. There's a "Search" edit control at the top. I think it will search the message board.
I had tried that...but it seems to only search articles and not this message board.
Thanks, for the tip. It got me started on where to look and my final solution was only slightly different from yours, having read up on it some from MSDN, where they suggest that large font selection was not guaranteed to be 120 DPI so I changed it slightly.
|
|
|
|
|
Hi,
I have written a tapi application which successfully makes a call(dial). But in my application i'm not able to accept an incoming call. I got the LINECALLSTATE_OFFERING call status, and there i tried the lineAnswer() API, but it just doesn't accept the incoming call. Is it the correct way for accepting a call?
Kindly help-
Vini
|
|
|
|
|
vin wrote:
Kindly help
Check what MSDN says: Accepting Incoming Calls[^]. Hope this helps.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
Do you have the line open for Owner?
|
|
|
|
|
Davey wrote:
Do you have the line open for Owner?
I did open the line as OWNER. I got the LINECALLSTATE_OFFERING and from there i used lineAnswer(). But i'm not getting the connection. The phone still keeps ringing .. What should I do? Should i issue some wait command to wait for some time before i answer the call. Also is it required to send any notification back explicitly?
Kindly help
vini
|
|
|
|
|
Cant seem to find info on this. If I dont want splitter windows but multiple views in an SDI, how do I go about it?
Also in an MDI does it make any sense to have doc1 with 2 views, doc2 with 6 views etc? Or is it one doc per view?
Thanks,
Appreciate your help,
ns
|
|
|
|
|
In general, one document can have multiple views. Without a splitter window, describe how you want the multiple views to look under SDI.
Kuphryn
|
|
|
|
|
I guess I was thinking that V1 could occupy the frame, then fromn the menu you can switch and make view2 occupy the screen.
Appreciate your help,
ns
|
|
|
|
|
I'm still learning how the Saves are handled in MFC.
I have a file which is marked Read-Only. I select 'Save', and when the 'SaveAs' dialog comes up I try to save the file under the original name. "Do you want to replace?Y/N" , I select Yes.
I have a pop-up warning that in Serialize() that says "read-only you can't save this". Click OK.
Then it looks like a copy of the file MFCxxx.tmp (I think this is a CMirrorFile object) is created in the directory, and the original file gets cleared, but not deleted.
My thought is that the MirrorFile is supposed to replace the original. And because its Read-only I can't delete the original to replace it. Is this an accurate description of whats happening here?
What is the best way/place to avoid this situation and not even try/allow to replace the read-only file?
Thanks.
BW
"Gandalf. Yes. That is what they used to call me. Gandalf the Grey. *I* am Gandalf the White."
- Gandalf the White
|
|
|
|
|
Is there a "pure" C++ way to replace int main(int argc, char** argv)?
In other words, have a static member function used as main, much along the lines of C# and Java? I've been able to get such an animal to link and run, I just haven't figured out how to get the runtime initialized.
Any one figured this out?
-pete
|
|
|
|
|
If you _really_ wanted to do this, you could try using the /ENTRY:<function> option of the linker (this if for VC++), and set <function> to the mangled name of your static member function. I haven't tried this though, so i'm not sure if it will work.
Anyway, why not just have a one line main function that calls your static member?
Dave
|
|
|
|
|
Dave Bryant wrote:
If you _really_ wanted to do this, you could try using the /ENTRY: option of the linker (this if for VC++), and set to the mangled name of your static member function. I haven't tried this though, so i'm not sure if it will work.
Actually I've already done that and it works, to a point. You just cant call anything, the CRT isn't initialized.
Dave Bryant wrote:
Anyway, why not just have a one line main function that calls your static member?
The reason for doing it is just to do it .
It would be nice to have a totally "OO" application without using C# or Java, in other words, no stand-alone global functions.
Still trying...
-pete
|
|
|
|
|
Anonymous wrote:
It would be nice to have a totally "OO" application without using C# or Java
Try Smalltalk?
It's free, can use DLLs, there even is a version working specifically with .NET, IIRC.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Hello,
I am fairly new to MFC, so please do not beat me up too badly for asking a dumb question.
I am writing an application that consists of a UI and a series of command-line applications to perform compilations on text input through the UI. The general flow of the application is similar to the process that MSVC follows when a project is compiled. I.E. The UI runs a compiler as a separate process and collects output from the process to display on the screen.
I have the "compiler" written (as a command line application) and it works fine. I have the UI executing the "compiler" using the ::CreateProcess() method/function. Input/output from the process is managed using Named Pipes to replace the stdin, stdout, and stderr streams. (I have started a separate thread to monitor and parse the stdout and stderr pipes and send messages back to the application based on the information received.) So far, so good.
I am using a CListCtrl to display the messages to the user, that are received from the "compiler" via the named pipes. However, it appears that the CListCtrl will not actually update the display until the thread with named pipes completes (this is the thread that the CListCtrl display methods are being called from). I have called the Invalidate() method and even sent a WM_PAINT message after each message is added to the CListCtrl. However, it appears that these messages block until named pipes thread completes.
So, my question is:
1. - Can I make the CListCtrl update the display immediately from a seperate worker thread?
2. - Should I be using some control other than a CListCtrl for displaying messages from the separate thread? (The only reason I selected the CListCtrl was to be able to easily store additional infomation with each display message - source code line where the error/warning/message occured and possibly an icon to allow the user to easily distinguish between Errors, Warnings, and Messages.)
Thanks!
|
|
|
|
|
One solution is to send a message to the listbox's parent window and then update it according. That solution is thread safe. Another solution and one that is not thread safe is to pass a pointer of the listbox to the worker thread and allow it to update the listbox in real-time. One disadvantage is the fact that it is not thread-safe. For example, if you call ::WaitForSingleObject() and attempt to update the listbox, a deadlock occurs.
Kuphryn
|
|
|
|