|
xianwuluo wrote:
Hope this is what you are asking about.
No, but perhaps SkunkedWorks might be interested.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
My mdi application has a CDialogBar window (say child) in it. i need to show some message when the mouse is moved over the child. I tried 'GetCursorPos' but it is giving co-ords relative to the screen and so when i resize MDI i dont get the actual co-ords.
I tried OnMouseMove too. I gets message when mouse focus is on the child but i need to get notified when window loses the focus.
Do you know how to do this ?
Thankx,
abintom
|
|
|
|
|
isn't it possible to create a message handler for WM_MOUSEMOVE?
Don't try it, just do it!
|
|
|
|
|
|
Also note that it is easy to convert coordinates. For screen to client coordinates call ScreenToClient. This can be done for any desired window.
|
|
|
|
|
Hi,
Hei Alex, Blake and Bill.. Thankx for the tips.
I did it with the help of TRACKMOUSEEVENT and OnMouseLeave.. Thanks all,
cheers,
Abin
|
|
|
|
|
i have created a modal window using MFC, as soon as ENTER key is pressed the window is destroyed. what to do to avoid this?
|
|
|
|
|
Add a function to the dialog class
virtual void OnOK();
void CMyDlg::OnOK()
{
}
hope this helps and get a good MFC book
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Add a handler for the Ok and Cancel buttons and remove the call to OnOk() and OnCancel() in these functions.
|
|
|
|
|
I prefer to override PreTranslateMessage and handle the CR myself
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
if ((pMsg->message == WM_KEYUP) || (pMsg->message == WM_KEYDOWN))
{
if (pMsg->wParam == VK_RETURN)
{
<p></p>
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi All,
I have a requiremnt in vc++ where i have to check for the user currently logged in(Administrator OR normal User). If it is normal user then i should be able to set previleges to create file in "C:\ProgramFiles" and do some other things.
please send me the code if possible.
regards,
Prax
|
|
|
|
|
use this api to detect IS LOGGED ON USER IS ADMINISTRATOR or NOT?
NetUserGetInfo(ServerName,UserName,UEERINFO_1,BUF_PTR)
and to get Current USername ->
GetUserName()
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Whilst this is true, this is not a valid way to determine if the user logged on is the Administrator account on the computer, since you can rename the Administrator account using the Group Policy Editor.
--
Andrew.
|
|
|
|
|
A normal user (or more accurately a "restricted user") account doesn't have write access to the Program Files tree. Such an account also can't change the DACL on the directory, for security reasons. The right thing to do is fix the program so it doesn't write to Program files - the \Documents and Settings\All users\Application Data dir exists to hold data files.
--
I'm Michael Dunn and I approve this post.
Vote Trogdor in oh-four!
|
|
|
|
|
Thanks to Alok & Michael...
regards
Prax
|
|
|
|
|
Hi All, I am carrying out a simple localization project. I have a dialog based application and the target language is Hebrew. I would like to know how to Right-Align the texts which apppear in the MessageBoxes. I am able to Right-justify text messages, by using the option MB_RTLREADING. There is an option called MB_RIGHT. However this does not work. Please advise
|
|
|
|
|
hello, i know i can get a function pointer into a function by declaring the function as:
setfunction(double (*funcPointer)(double)); // for example
but i'm having difficulty returning funcPointer from an accessor. for eg do i declare the accessor as:
double (*)(double) getfunction(); // should return the function pointer
unfortunately this does not work, and i cannot see where i am going wrong.
any help would be great!
|
|
|
|
|
typedef is your friend:
typedef double (* pfnGetDouble) (double);
double GetDouble(double d)
{
return d;
}
pfnGetDouble GetDoubleFunc()
{
return (pfnGetDouble) GetDouble;
}
int main()
{
pfnGetDouble pfGD = GetDoubleFunc();
printf("%f\r\n", pfGD(42.0));
}
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
Is it possible to develop a simple SNTP server on a WINDOWS machine ?
Tanks a lot !
|
|
|
|
|
The simple answer is yes.
See SNTP[^]
Gives details of the simple network time protocol.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi,
i'm beginner programmer.
I want to know....
How to read data from comport..
I want to receive from send comport.
Is use "ReadFile" for read data..
and then how to reteive string.
If comport send some text for example-"Hello word",
how to get this is??
i alreadly have serial class for serial communication.
this is following ..
int CSerial::ReadDataWaiting( void )
{
if( !m_bOpened || m_hIDComDev == NULL ) return( 0 );
DWORD dwErrorFlags;
COMSTAT ComStat;
ClearCommError( m_hIDComDev, &dwErrorFlags, &ComStat );
return( (int) ComStat.cbInQue );
}
int CSerial::ReadData( void *buffer, int limit )
{
if( !m_bOpened || m_hIDComDev == NULL ) return( 0 );
BOOL bReadStatus;
DWORD dwBytesRead, dwErrorFlags;
COMSTAT ComStat;
ClearCommError( m_hIDComDev, &dwErrorFlags, &ComStat );
if( !ComStat.cbInQue ) return( 0 );
dwBytesRead = (DWORD) ComStat.cbInQue;
if( limit < (int) dwBytesRead ) dwBytesRead = (DWORD) limit;
bReadStatus = ReadFile( m_hIDComDev, buffer, dwBytesRead, &dwBytesRead, &m_OverlappedRead );
if( !bReadStatus ){
if( GetLastError() == ERROR_IO_PENDING ){
WaitForSingleObject( m_OverlappedRead.hEvent, 2000 );
return( (int) dwBytesRead );
}
return( 0 );
}
return( (int) dwBytesRead );
}
open,close,send data function i can use.
but i cannot use this read function.
how to use this.
yet,i don't know.
pls explain me..
how to work this..
|
|
|
|
|
How about doing it simple to start with?, all that overlapped functionality and error handling is great when you know what's going on, but for starters you should keep things simple.
(The code below is from memory and not debugged)
#define MAX_BUFFER 1024
int main()
{
char portName[] = "COM1";
char buffer[MAX_BUFFER];
HANDLE hFile;
hFile = CreateFile(
portName,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if (INVALID_HANDLE_VALUE != hFile)
{
if (ReadSerial(hFile, buffer, MAX_BUFFER))
{
printf("Received: '%s'\r\n", buffer);
}
}
}
BOOL ReadSerial(HANDLE hFile, char * buffer, DWORD bufferSize)
{
BOOL retval;
DWORD dw;
buffer[0] = '\0';
retval = FALSE;
if (ReadFile(hFile, buffer, bufferSize - 1, &dw, NULL))
{
retval = TRUE;
buffer[dw] = '\0';
}
return retval;
}
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
Hi friends,
I need to construct and traverse a multiway tree. Does anybody having any doc/alogrithm/URL regarding this?
VikramS
|
|
|
|
|
Not sure which type you want, but read about these...
http://www.cs.princeton.edu/~rs/strings/
|
|
|
|
|
vikrams wrote:
I need to construct and traverse a multiway tree.
What kind (e.g., binary, tertiary, splay, red/black)?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|