|
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
|
|
|
|
|
SendMessage() is the way to go. Create a custom message, and add a message handler in your UI thread to handle the message. That way you are thread safe, and going about it the proper way.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I have a TCP socket. After connecing to the server I would like to recv data
but recv is blocking. I would like to timeout after 5 seconds if server does not respond. How can I timeout the recv call.
Thanks
|
|
|
|
|
hmm using the asyncsockets usually, but I believe that
<br />
int timeout = SOME_VALUE_IN_MILLISEC;
setsockopt( sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout) );
can help you. Look to the documentation. (valid only for Microsofts Winsock2)
|
|
|
|
|
Use something like WSAselect, or any of the other socket functions that allow you to wait on a socket for data. The benefit is that as well as waiting on the socket, you can also wait for other events in your program
|
|
|
|
|
I can't seem to get any help from the messageboard in the article area. So i try here.
I've seen many people asking on how to get a pointer to a view that is in the controlbar.
But so far i haven't seen any code on how to do it.
I'm not that very good on MFC and i could really need som help with this.
I have added a CFormView to the controlbar, and it works great. But how do i get a pointer
to that view? I need to set some variables, and call some functions but i need a pointer
to be able to that.
Please, could anyone help me?
|
|
|
|
|
Do you know any function to return if the app is running from a server or from the local machine ??
Thanks,
Cris.
|
|
|
|
|
I think you want to use CreateToolhelp32Snapshot(), but you would have to iterate through the snapshot using Process32First() and Process32Next() until you found the exe file you were looking for. This requires windows 95 or later or windows 2000 or later. Check out MSDN for sample code.
|
|
|
|
|
Ok, I meet the exe file. But how can I know if the process is running in the local machine ?? Which variable indicate that ??
Thanks,
Cris.
|
|
|
|