|
C++ is not VB. as the previous answers said, you have to overload the event handler by yourself... WM_KILLFOCUS event occurs when the focus is about to leave from a control to another. there, you can make the tests and only if the content is validated, you call the base class (CWnd ) OnKillFocus() handler to allow it to process the focus change...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
How about sub-classing the CComboBox class, override the OnKillFocus message handler and set the focus to the combobox if the data is erroneous?
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
that's what I do
void Neworder::OnKillfocuscurrency()
{
CComboBox* pcpp = (CComboBox*)GetDlgItem(IDC_currency);
if (CB_ERR == pcpp->FindStringExact(-1,m_devise) )
{
pcpp->SetFocus();
}
else
{
}
}
I learn my self
|
|
|
|
|
Have you made sure that your handler is correctly mapped in the message map and that it actually gets called?
Set a breakpoint in the message handler and debug the application to find out whether your handler gets called or not and if it does verify that the statement pcpp->SetFocus() is executed.
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
I have automated MS word using VC++(MFC) version 6.0 . I create a MS Word Document. In this document i want to insert in the footer "2 of 12" format. Where 2 is the page number and 12 is the total number of pages. Please provide the solution for the same.
Thanking you.
|
|
|
|
|
Sachinpatole wrote: In this document i want to insert in the footer "2 of 12" format.
I think it's something like:
{ PAGE } of { NUMPAGES }
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Yes,
I want to display
(PAGE) of (NUMPAGES).
How can i do it?
Pls reply
Thankx
|
|
|
|
|
Sachinpatole wrote: How can i do it?
I already showed you. Did you try my suggestion?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I didnt get you. Will you please resend me the suggestion. Basically i want to display the footer as "3 of 5" where 3 is the page number and 5 is the total number of pages. I have to achieve this in my VC++ 6.0 (MFC) code where i have created the word document using automation. I have to set the footer as above mentioned, in the MS Word document created through automation.
Please do the needful at the earliest.
Thanking you
|
|
|
|
|
Sachinpatole wrote: Will you please resend me the suggestion.
See here.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi dudes!
I have an especial electronical device that I connect to my computer through USB, and there's a USB-serial driver that emule the RS232 communication through USB.
That's ok.
The fact is that many times I must to point to Control Panel -> Sistem -> Hardware -> Devices -> Comm Ports to see which comm port the device is using.
I want to developed an small application, with just a button. Then when I press it, a MessageBox shows the Comm Port used for that device.
What API function/s should use in the button click event handler to get that kind of information, (in fact, it is the same that control panel display in Comm Ports).
Thank very much guys!
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Help to run my project in Sevice mode
Getting error 1053 , when trying to start from service mode
dil
|
|
|
|
|
Error 1053 means ERROR_SERVICE_REQUEST_TIMEOUT
It seems as if your code isn't responding to some kind of event.
If you want a more detailed answer, please give more details about the problem.
|
|
|
|
|
LPCTSTR name123 = "sangaraju" ;
SC_HANDLE hSCManager =( OpenSCManager(NULL,NULL,SC_MANAGER_CREATE_SERVICE));
SC_HANDLE hi = OpenService(hSCManager,name123,SERVICE_ALL_ACCESS );
SC_HANDLE hSCreate = CreateService(SCManager,name123,name123 ,SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS,SERVICE_AUTO_START,SERVICE_ERROR_IGNORE,
"\"d:\\Shu.exe\"",NULL,NULL,NULL,NULL,NULL);
and then Closed the services......
Opened the Windows services
i found Startup type = automatic , and status is empty
But when iam trying to start in the servics , Error which iam getting is
Error 1053 : " The service did not respond to the start or control request in timly fashion"
Please help me Kakan.......
Thanks in advance
|
|
|
|
|
Hello.
Your servce code has to respond on different messages, such as start, stop, pause e.t.c.
As well as responding to queries from the OS...
I think you will have to do your homework on this one (study), or (quicker, i think). Follow the advice from ThatsAlok and check out XYNTService.
Use it as it is or study the code. It's very informational (Is that an English word? )
Kakan
|
|
|
|
|
kakan wrote: It's very informational (Is that an English word? )
look like to be
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
It felt good when I wrote it. But then I began to wonder.
Anyway, as long as the reader gets the message, anything goes (as far as I'm concerned)
|
|
|
|
|
Help to run my project in Se
dil
|
|
|
|
|
usha_dolly wrote: Help to run my project in Se
I believe you want to run your program as service. This link will help :-
http://www.codeproject.com/system/xyntservice.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
-- modified at 6:45 Tuesday 6th December, 2005
|
|
|
|
|
|
I create another dialog box from my main dialog box. I want to show it and remove it when i want, without the user's will. I call the show function and the remove function from different places, and 90% I am able to remove it. For the other 10% I tried calling DestroyWindow() to remove, or calling it in the class destructor. I also tried overriding PostNcDestroy() and calling CDialog::PostNcDestroy() inside, etc. OnDestroy(), PostNcDestroy() and OnNcDestroy() are called respectively, but I keep seeing the dialog box, it is not removed. Can someone please help me? How can I destroy it properly?
Thanks in advance
To show:
pOtherBox = new COtherBox();<br />
BOOL ret = pOtherBox->Create(IDD_OTHERBOX, this);<br />
<br />
pOtherBox->SetWindowPos(&this->wndTopMost,<br />
left,top,width,height,<br />
SWP_NOREPOSITION|SWP_NOSENDCHANGING|SWP_NOACTIVATE|SWP_SHOWWINDOW);
To remove:
if(pOtherBox!=NULL)<br />
{<br />
delete pOtherBox;<br />
pOtherBox = NULL;<br />
}
|
|
|
|
|
To dismiss the modeless dialog box, simply call:
pOtherBox->DestroyWindow();
And also implement:
void COtherBox::PostNcDestroy()
{
delete this;
}
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
|
gpswamy wrote: how to get window handle pls
In MFC :-
AfxGetApp()->GetSafeHwnd();
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
In MFC, If you need the window handle of the current window, then it is m_hWnd
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|