|
You can easily write your own DDX_* function to do validation.
This can be an option for you if all your fields are of the same type. Otherwise you will still end up with a lot of different functions you must implement. The easiest way to to do this is to set a breakpoint on your current DDX_* function call, step in and see what it does. Then write your own handler with your own error handling. This is mostly copy&paste work. I have done this many times, not having your problem, but e.g to get user data from a selected row in a CList and such.
|
|
|
|
|
Thank you for your reply, i am already in the process of doing this, it is really disapointing how the "original" DDX system is non-configurable when it comes to "what to do when validating"...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Code-o-mat wrote: What i did was to create a few dialogs with a whole bunch of edit controls on them that let the user hammer in all kinds of data, mostly numbers, when the OK button is hit, i called UpdateData to move the user's entries into integer values and then check these for correctness and display a message box if something's wrong. This works ok as long as the user entered something into the edit fields, but if the user leaves one empty, then during the Dataexchange process a nice little "Please enter an integer" message box is spit up...
While not a direct solution to your problem, you should consider disabling the OK button until all the edit controls are non-empty. This works for other controls, too. You can ensure that items in comboboxes and listboxes have been selected, checkboxes have been checked, etc, all before enabling the OK button.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Code-o-mat wrote: before calling DoDataExhcnage put a "0" into every numeric edit field on the dialog that is empty
Unless 0 (zero) is a valid input.
Watched code never compiles.
|
|
|
|
|
Hi,
My application requires printing of data on different printers.
Is it possible to ensure that after a printer has been chosen (that may not be the default printer), the print layout is in Landscape mode?
I have looked at examples from MSDN, mfcdvmdvcnet.exe (I can't remember the Q number), but that seems oriented to using the default printer, whereas I want to ensure that after printer selection the print format is landscape using the DEVMODE structure.
EDITTED TO ADD - is there also anyway to detect the name of the chosen printer after it has been selected if it is not the default printer?
EDITTED TO CLARIFY - I have two printers, printer1 - the default A4 printer, and printer2 - my A3 printer. When I print I want to select printer2 and set it to be Landscape. How do I, using EnumPrinters or an alternative, get the name of the now selected printer, printer2, and change the DEVMODE to ensure that Landscape is used?
If anyone has a pointer to some code, or an article, that would be great.
TIA
Tony
modified on Wednesday, April 14, 2010 6:06 AM
|
|
|
|
|
maycockt wrote: EDITTED TO ADD - is there also anyway to detect the name of the chosen printer after it has been selected if it is not the default printer?
Are you using PrintDlg() for this? If so, look at the hDevNames member of the PRINTDLG structure.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
This might help you I guess :
void CYourApp::SetupDefaultPrinter()
{
UpdatePrinterSelection(FALSE);
if (m_hDevMode == NULL)
DEVMODE* pDevMode = (LPDEVMODE)::GlobalLock(m_hDevMode);
if(pDevMode)
{
pDevMode->dmFields |= DM_ORIENTATION;
pDevMode->dmOrientation = DMORIENT_LANDSCAPE
::GlobalUnlock(m_hDevMode);
}
}
Njoy...
|
|
|
|
|
I have a excel file . having refrences on various cells like =a1+b1 and =c3*f2 like that
it has about 100 cells having reference. but when get the excel calculate event I could not find
which cell value change having reference .
Trioum
|
|
|
|
|
trioum wrote: but when get the excel calculate event I could not find
which cell value change having reference .
What do you mean by this?
|
|
|
|
|
I didn't get you. Could you please explain in a bit details?
|
|
|
|
|
trioum wrote: but when get the excel calculate event I could not find
which cell value change having reference
are you looking fro function or reference cell ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
How to get column width of each columns in the ListView Control
|
|
|
|
|
You may use, for instance, ListView_GetColumnWidth macro.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Hi Guys,
As i was working i got a problem. as i have to open a file, i simply call CreateFile and it Opens it. now if some application like MS Excel ect have open it previously, it is not letting me open the file.. now if it is about sharing voilation, how notepad manages the file to open it?? i think i am clear to whar i require
Expecting some Quick responce..
HARSH
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.
|
|
|
|
|
My guess is that Notepad opens the file for reading only (and only tries to open it for writing if the user wants to save, at which point it will also fail), when Excel or Word or the likes opens the file it probably allows other processes to read the file, but not to write to them (this would explain how you get a "open for reading only" option from Word if you try to open a document that is opened by another word instance/another user's word...). Can it be that when you use CreateFile to open the file you try to open it for writing?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
|
aks. wrote: What is the difference between MPEG-4 and MPEG-4 VKI version?
Maybe the same difference there is between a C++ forum and Google .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: C++ forum and Google.
Heh heh
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
I had a requirement of do screen scraping on windows. I want to capture words which are available on active window along with the pixels.
So can any one help me out how to do this....?
Thanks
John.
|
|
|
|
|
First get the window handle of that pixel you want,
then get the text of this window
Hope it helps
www.logicsims.ir
|
|
|
|
|
John502 wrote: I had a requirement of do screen scraping on windows. I want to capture words which are available on active window along with the pixels.
So can any one help me out how to do this....?
are you scrapping from custom window or generic window?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I want to scrape text from custom window... From the custom window it self i just want to find out where is that text (what i am trying to search) is avaialable. Once i get the pixel pisitions of that text then i want to scrape that..
This is my requirement... Please help me out with your suggestions...
Thanks
John...
|
|
|
|
|
hi i want to move button control on mouse LButton down with no Resize and position must be saved within the dialog.
How it can be done.
|
|
|
|
|
First, commas, full-stops and semicolons has a meaning also in natural langage:
Your question can be:
"hi, I want to move A button control on mouse LButton down, with no Resize; position must be saved within the dialog.
How it can be done?"
or
"hi I want to move button controls on mouse LButton down with no Resize and position. Must be saved within the dialog.
How it can be done?"
And they are quite different questions.
Assuming the first, since a control is a window, just use MoveWindow (note: mouse coordinates are obtained in screen coordinates, while move window requires parent client coordinates, so do the proper translation with ScreenToClient ).
I don't understand what you mean with "saved within the dialog": if you mean "saved within the dialog RESOURCE", then give a look to http://msdn.microsoft.com/en-us/library/ms648004(v=VS.85).aspx[^].
Consider also that, unless you are writing a "resource management tool", modifying the resource result in modifying the "exe", and this is not, in general, a good idea: what does it happen if multiple users attempt to to modify your "exe" if it is shared across a network?
It is better to save the control positions in a file stored in a user specific directory (you can get the path with SHGetFolderPath , giving CSIDL_APPDATA as a CSIDL) and, when loading the dialog, change the controls positions (again, with MoveWindow ) accordingly to such file (if existent) before showing the dialog.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|