|
Hi,
try with method SetDelayTime of CToolTipCtrl class: it allows you to set the delay time of the tooltip.
Check also msdn on http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_CToolTipCtrl.asp
|
|
|
|
|
Thanks for your advice.
Actaullay at some points on the Dialog Box it is not flickering but at some points on the Dialog Box it is flickering.
Means when ever my mouse is on left side in Dialog Box it will not flicker and when ever I move my mouse to extream right and towords down it is flickering.
Thanks in Advance
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
I want to put some text on a dialog.
I can either size my text to the dialog or size my dialog to the text. Can anyone tell me how to do this?
I think I will get some text passed to a function. I will then have to format the text into a number of lines with carriage returns and then I will have to create a window large enough to display the text.
So I need to be able to get the size of the text once formatted. How may I do this? Is there a way I can find the screen size of text?
|
|
|
|
|
Well first you'll need to figure the size of the rectangle your text will need to be displayed. You can use one of the text extent function like GetTextExtent(). The problem you will run into here is that the extent function will treat the string as one line, therefor you'll have to call it on a line by line bases. Note that each line my actualy have a different height (based on the characters they contain).
Width = widest line.
Height = tallest line.
From there it should not be to difficult recalculate the dialog size in the OnSize() function.
If you did not want to adjust the size of the dialog box: You could use the above method to see it will fit as is. If it will not fit you could try using GetFont() to retreive the current font (so you don't change selected font type) and the information to create a smaller font that may fit (recalculate and repeat until needed size is reach). Note: You might have to change the font type if this does not work.
I recomend that you look at one of the resizable dialog articles to help you decide what method to use (and how to resize a dialogbox).
Depending on why you need to do this you could just use a mult-line edit control, set to read only, and just copy the text to that.
Good Luck!
INTP
|
|
|
|
|
my prob is that i have a dialog type vc++ application named 'Xyz'.....in this....i have created my own class(CMyclass).....what i want to know is that how shall i can access data of the CXyzDlg class from the CMyclass.....
please help......
|
|
|
|
|
just put a #include "CXyzDlg.h" statement in your CMyClass.h file
|
|
|
|
|
thanx!!!!! ....
|
|
|
|
|
That depends on how you need to use CMyclass.
Is CMyclass only used by the dialog?
#include "CMyclass"
class CMyDialog
{
CMyclass m_myclass;
};
void CMyDialog::func()
{
m_myclass.func();
}
Is CMyclass a globaly declare object (declared some where else)?
#include "CMyclass"
extern CMyclass g_myclass;
void CMyDialog::func()
{
g_myclass.func();
}
Good Luck!
INTP
|
|
|
|
|
thanx!!!!!....
tis helped me....
|
|
|
|
|
When I started a Single-document project 3 years ago I didn't think scrollbars would be needed so I didn't select it in the AppWizard. Resently the need for scrollbars in the main window have arrisen and I can't get it to work. I have tried to change it but the scrollbars just returns to zero when I try to use them. So has anybody done this with success? Please let me know!
I do not want to start the project all over just to add scrollbars, think that will take me more then a week....
|
|
|
|
|
I'm not sure if this will work
Replace all occurences of CView by CScrollView in your CView derived class.
|
|
|
|
|
Tried that already and it doesn't work. Thanks anyway!
|
|
|
|
|
Don't forget to call at startup (for example in OnInitialUpdate of your view class) the function SetScrollSizes.
Normally I think this should work...
|
|
|
|
|
Hi
I urgently need a simple TAPI application in visual C++ that can dial number. On receiving the number, some speech needs to be transfered. I need Visual C++ code in TAPI 3.0 that can transfer speech on the calling (Dialing) number on receiving call.
Thanks from wahaj Khan
|
|
|
|
|
Browse to ftp://ftp.microsoft.com/devloper/tapi
|
|
|
|
|
Hi out there,
I have a strange problem:
I coded a simple Client-Server chat app! It works wonders. The way it works:
The server is a multithreaded app. It waits for incoming connections and if found, start a new thread. There, in an endless loop, it waits for messages.
The Client: It connects to the server, sends its name, so that the server knows who is online. This name will be written down in a lookuptable together with the IP and the socket.
If someone writes a message, the message looks like this: "ToName0FromName: Message". So the server checks if ToName is online, through the lookuptable, and if he is, sending him the Message (after the 0).
Now my problem:
Both clients connect. One starts sending messages. The other one receives them. If the other one sends a message, the first client does receive it. But every following message wont reach the first client. No error messages, nothing. It seems the server doesnt get the message. But, Sending doesnt give any errors, and I checked, and the client is still connected to the server...
If I disconnect this client and connect again, the same thing happens, but the other way around. so the first client cant send, but not the second!
What can this be?
I read alot of papers, and tried alot, but I am still confused!
It would be so nice if you could help me!
DKT
|
|
|
|
|
Hi,
I suggest you to try to debug your application with some watches on the receiveing buffer of the server sockets. What do you mean with "in an endless loop the server waits for messages"? Isn't the server app in idle state?
I was wondering if you used CAsyncSocket class...
|
|
|
|
|
No I am not debugging, changing the active setting to debugging means, I wont be able to debug the app, cause MFC doesnt want to work with threads properly!
With endless loop I mean something like:
while(true)
{
recv(...)
if error break
if done break
else show message
}
No. I am not using this function. I am just listening on a specific port and waiting for incoming connections, if found, start a new thread for it where this loop comes!
DKT
|
|
|
|
|
You may lost some data packets in the server side.
Try to use this thinking:
while(TRUE)
{
select(); // to get socket status
if (SOCKET_ERROR)
{
//deal with the error
//WSAGetLastError() must be called
}
if (TOUT)
{
continue;
}
recv();// after that, you are ready to read some data, because select() was signaled to do something.
}
|
|
|
|
|
Ok, thats fine. I didnt know about select!
Now I get an error code 10022 which means:
"WSAEINVAL
(10022)
Invalid argument.
Some invalid argument was supplied (for example, specifying an invalid level to the setsockopt function). In some instances, it also refers to the current state of the socket—for instance, calling accept on a socket that is not listening."
Now my question. Where didnt I pass the right arguments? I dont use SetSockOpt. I called the select directly after accepting an incoming conncetion, so, before going into the thread! Accept doesnt give any errors. And I know it works, cause I can send msgs.
This is what my accept looks like, or better the whole code up to accept:
if(WSAStartup(MAKEWORD(1,1),&wsaData)!=0)
MessageBox(TEXT("Initialize"), TEXT("Error!"), MB_OK);
local.sin_addr.s_addr=INADDR_ANY;
local.sin_family=AF_INET;
local.sin_port=htons(20248);
if((server_s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP))==INVALID_SOCKET)
MessageBox(TEXT("SocketCreation"), TEXT("Error!"), MB_OK);
if(bind(server_s, (PSOCKADDR)&local, sizeof(local))==SOCKET_ERROR)
MessageBox(TEXT("Binding"), TEXT("Error!"), MB_OK);
if(listen(server_s, 10)!=0)
MessageBox(TEXT("Listening"), TEXT("Error!"), MB_OK);
else
{
m_con_s="- Connected -";
UpdateData(false);
connect_b=true;
}
while(true)
{
fromlen=sizeof(from);
if((client_s=accept(server_s, (struct sockaddr*)&from, &fromlen))==INVALID_SOCKET)
{
wsprintf (szError, TEXT("Accepting Connections. Error: %d"),
WSAGetLastError ());
MessageBox(szError, "Accepting Connections:", MB_OK);
break;
}
else
if(select(0,0,0,0,0)==SOCKET_ERROR)
{
wsprintf (szError, TEXT("Error: %d"),
WSAGetLastError ());
MessageBox(szError, "Status of Con.", MB_OK);
break;
}
}
Thanks so far!
DKT
|
|
|
|
|
Two more questions:
1. How to use Select? I just set all arguments to NULL, is that correct to get the state of the socket?
2. Can the problem be because I am using just one port for everything, although I am using threads? I mean, every client is connecting on the same port, and get its messages on this port.
DKT
|
|
|
|
|
Does anyone know how can I code a program that logs the mIRC chat window ? Is it possible to code such a program?
I saw that the mIRC chat window class name is "Static" and I tried to get tha handle to the window and I sent a WM_GETTEXT message but it didn't work.
Please help me!!!
Cristian
|
|
|
|
|
Hello everyone:
Are there any functions fast than sccanf, sprintf, strlen?
Thanks.
-Freehawk
|
|
|
|
|
Maybe.
Before you start though I have two questions:
Have you done a profile on your program and determined that you program is really spending a lot of time in those 3 functions. In most cases, despite those functions not being particularly good, they are good enough.
Why are you not using a C++ string class, and the functions they provide to do the same? There are a number of them out there.
Assuming you have good answers to those questions:
strlen is best made faster by making a string class (or structure if you must do pure C) that holds the length of the string. Keeping this up to date can greatly speed up your program if strlen is called often.
The other two are most easily taken care of by careful analysis of what you are doing with them. In most cases just knowing something about the data and how it is used can make solutions obvious. (for instance if you use sprintf to create a string, and sscanf to latter pull it apart, why create the string in the first place, just pass the data)
Not knowing your data I cannot say more. I still suspect that this question is not worth asking.
|
|
|
|
|
Hi,
I was just debugging this c file when i encountered this statement
#line 24 "Flex.lex"
the control is transfered to line 25 of the Flex file
Can someone explain it in details also other directive which are frequently used .
Thanx..
lokiz
|
|
|
|