|
Hi all.
I have a bmp image and i have set it as a back ground of a dialog box. But the controls on dialog box are not getting matched with the colors from image. I mean the background of various controls like check box, radio button, static controls, etc is typical system color, i.e. off brown.
I can set the background color of the controls by overriding OnCtlColor() of CDialog class. But to set their backgound, I need the color from image, and as image is having number of colors I can't go with one perticular color?
My question is how I can make back ground colors of the controls exactly same as that of image color on which I have dropped them?
Thanks
Rakesh Thakur
|
|
|
|
|
Do you want to write text on an image?
|
|
|
|
|
|
I have been racking my brains to figure out how to detect a modal dialog box coming up and to response to the dialog box by lines of code which simulating "press ENTER key " or "clicking a button".
In my project, I import a dynamically linked library to use some functions. One function bring up some modal dialog boxes, suspending the main thread. I want to responsing to the dialog box as soon as it pops up by simulating the act of "Pressing the OK button on the dialog" with code. On the dialog box, there is only a OK button(having focus). Currently, I have to press the OK button manually whenever a dialog box comes up. I think the solution involves two aspects: (1) detect the occurrence of a dialog box; (2) simulate "Pressing the OK button on the dialog" with code.
Can anyone help please. Without a solution, I have to reponse manually to handreds of thousands of dialog boxes to keep my program running.
By the way, there is no way I contact the authors of the dynamically linked library to solve this problem.
|
|
|
|
|
One solution would be,
Get handle to that dialog, (using FindWindow() , you could use timer for this).
And then use SendMessage(WM_CLOSE,..) .
i.e.
void MyTimerProc(LPVOID)
{
HWND hDlg = FindWinow(NULL,_T("Dialog Title"));
SendMessage(hDlg,WM_CLOSE,0,0)
}
|
|
|
|
|
Prasad, Thank you.
You suggestion is perfect. It works fine now.
However, in my code context, i have to put scope operator :: before 'FindWinow and 'SendMessage'.
I do not know why. When searching MSDN, I found two FindWinow(). One is a member function of class CWnd; the other does not beloge to any class. I guess by using "::" , i.e., ::FindWinow, we actually refer to the latter. I am not sure about this.
|
|
|
|
|
cy163@hotmail.com wrote: CWnd
This MFC wrapper for window.
cy163@hotmail.com wrote: other does not beloge to any class
Its win32 SDK API.
cy163@hotmail.com wrote: ::FindWinow, we actually refer to the latter
Correct.
|
|
|
|
|
hi,
i have a dialog box in which i have dragged dropped a edit box control.
i have validated the editbox control by creating a class called validate and the base class of it to be CEDIT class.
i have wriiten the code for validation in onkeyup method of validate class
i have declared the variable of the editbox control to be of the type validate.it works fine
the code for validation is as follows:
<br />
void hi::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) <br />
{<br />
<br />
if (nChar <=57 && nChar >=48)<br />
AfxMessageBox("hi");<br />
else<br />
AfxMessageBox("hello");<br />
return;<br />
}<br />
when i nter alphabets i get a message box and then i need to clear the character entered how to do this???
thnx in advance,
zari
|
|
|
|
|
Hi,
you can use CEDIT Member function..
CEdit* pmyEdit;
// Delete all of the text.
pmyEdit->SetSel(0, -1);
pmyEdit->Clear();
Kind Regards,
Priya.
|
|
|
|
|
please edit your post and set your code sample between <pre></pre> tags.
thank you
ps: refer the Forum Guidelines[^]
|
|
|
|
|
zareee wrote: when i nter alphabets i get a message box
You get message box in all cases.
If you want to perform validations, use PreTranslateMessage of you CEdit derived class instead.
BOOL CMyEdit::PreTranslateMessage(MSG* pMsg)
{
if ( pMsg->message == WM_CHAR)
{
UINT nChar = (UINT) pMsg->wParam;
if ( nChar <=57 && nChar >=48 )
{
return TRUE;
}
}
return CEdit::PreTranslateMessage(pMsg);
}
|
|
|
|
|
HI ,
Can any one help out me ,i have one lot of files related each other and,i do not know how to search for a particular file related to the particular thing.
i have one project and i have to do modifications for certain changes.
can any please tell how it will be easy for me
Raj kumar
|
|
|
|
|
PraveenaRAJ wrote: HI ,
Can any one help out me ,i have one lot of files related each other and,i do not know how to search for a particular file related to the particular thing.
i have one project and i have to do modifications for certain changes.
can any please tell how it will be easy for me
I tell ya. Use Visual studio.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
Hi,
My problem is ,i have code for an application ,i donot how to change the previous code ,i have to modify it.by removing the conditions.
i do no for the code where it is declaring and where it is getting pop up.how to find out how the code flow is going ,i am some 100 files so i do not know
Raj kumar
|
|
|
|
|
Is that a dialog based app or MDI or SDI app? Or is that not using MFC? There is a feature called debug. You must try that.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
its a dialog based app
Raj kumar
|
|
|
|
|
Start debugging from InitDialog and edit what you want.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
HI ,
I am getting problem as # import staement _library _ missing, can u please help in this regard ,this is coming following the path
Raj kumar
|
|
|
|
|
What exactly is the error? Are you able to compile it or not?
ps: You're giving no clue and expect no help, absolutely.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
while batch building i got error as
error C4772: #import referenced a type from a missing type library; '__missing_type__' used as a placeholder
NNLInterface.cpp
AnalogUtilities.cpp
Raj kumar
|
|
|
|
|
Read this[^]
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
Hi all,
i have one problem related to thread. i am having my main thread running which will
on some event create a thread for validation purpose and then will start working.
and now this validator thread will create a socket and it will bind to port 20111.
and then will wait for client to connect.
but before waiting for client to connect it will send a message to the main thread that
validation is done.
but in this way i need to stick with port 20111.which i really don't want.
Is it possible for me to get a free port from operating system or from winsock
library and then i should bind to this port??
and one more thing i want is i want to get the free port no that operating system
has given in an variable because i will need that port number further in the main programs lifetime.
the code is as follows
UINT Thread_Func(LPVOID pParam)
{
wsaret = WSAStartup(0x101,&wsadata);
if(wsaret != 0)
return -1;
sock.sin_family = AF_INET;
sock.sin_addr.s_addr = INADDR_ANY;
sock.sin_port = htons((unsigned short)20111);// iwant to obtain this port no on fly and
// to get it in some variable so that i can use it further in my main thread
server = socket(AF_INET,SOCK_STREAM,0);
if(server == INVALID_SOCKET)
return -1;
if(bind(server,(SOCKADDR *)&sock,sizeof(sock))!=0)
return -1;
if(listen(server,1)!=0)
return -1;
cli_len = sizeof(cli);
client = accept(server,(SOCKADDR *)&cli,&cli_len);
if(client == 0)
return -1;
return 1;
}
i have not done socket programming before this is my first time i am doing it
so if there are any mistakes please let me know
Thanks and regards
Harshal shete
|
|
|
|
|
something in the back of my brain said: "sock.sin_port = 0" would let the OS select the port....
|
|
|
|
|
yes that is true but how i can access that port number??
|
|
|
|
|
maybe you can reverse use the sock.sin_port after the connection has been occured with
port = ntohs(sock.sin_port) from the socket.
|
|
|
|