|
|
Hi,
is it possible to fire an OLE Control Event out of a Class wich is simply derived from a wrapper class of an ActiveX Control?
for example: I have derived a class of CMSFlexGrid (the wrapper class of the MSFlexGrid ActiveX Control) and now I want to fire an userdefined Event wich should be handled by the parent window (Dialog)
Thanks in advance!!!
|
|
|
|
|
I need to read in from a file an array of structs and I don't know how. I have a file with a score and the frequency that it occurs the struct is set up as;
struct stats
{
int score;
int frequency;
};
the file contains 10 lines set up as score frequency
how do I set up the array and read it in from a file?
|
|
|
|
|
|
hi,
i have a code which works in normal user mode. but fails to send request when lauched from service.
it is giving ERROR_WINHTTP_SECURE_FAILURE (12175) im using ssl and digest authentication.
here is my code..
m_hIntOpen = WinHttpOpen(L"HereIm", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0)
m_hIntConnect = WinHttpConnect(m_hIntOpen,m_oszDomain, INTERNET_DEFAULT_HTTPS_PORT , 0)
BOOL bResults = WinHttpAddRequestHeaders( m_hOpenReq,MY_REQUEST_HEADER,-1,
WINHTTP_ADDREQ_FLAG_ADD )
WinHttpSetCredentials (m_hOpenReq,WINHTTP_AUTH_TARGET_SERVER,WINHTTP_AUTH_SCHEME_DIGEST,m_oszUserName,m_oszPassword,NULL)
inHttpSendRequest( m_hOpenReq,WINHTTP_NO_ADDITIONAL_HEADERS, 0,
lpvPostData, dwcbPostData,
dwcbPostData, 0))
any solutions?????
thanx
gP
|
|
|
|
|
gP_t_gr8 wrote:
WinHttpSetCredentials (m_hOpenReq,WINHTTP_AUTH_TARGET_SERVER,WINHTTP_AUTH_SCHEME_DIGEST,m_oszUserName,m_oszPassword,NULL)
Are you sure m_oszUserName and m_oszPassword has correct values, when running as service ?
suhredayan There is no spoon.
|
|
|
|
|
yes. these are some predefined values..
|
|
|
|
|
Hello
I want to enter a name from the user in console based program. I used gets function as written below
char name[40];
cout <<"Enter Name "; (i also checked puts here)
gets(name);
cout <<"Enter age ";
cin>>age;
But it prints message "Enter Name " and then with out prompting me for name, it goes to next statement i.e. "Enter age ".
Can anyone tell me why this happens or please tell me any other way to get input in array on console screen.
Thanks
Aqeel A. Mirza
cout <<"We Believe in Excellence";
|
|
|
|
|
Imho it's best not to mix STL (cin , cout ) and standard (printf , gets , etc.) I/O. Try this instead:
char name [40];
printf ("Enter name: ");
gets (name);
char age [40];
printf ("Enter age: ");
gets (age);
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Limit the number of characters obtained from the stream that are to be put into the char array.
With gets, an error will occur when the number of characters entered is greater than the char array holder.
const int MAX_LENGTH = 20;
char szName[MAX_LENGTH];
cout << "Enter name: ";
cin.get(szName, MAX_LENGTH);
|
|
|
|
|
Hello
Thanks for reponse
When i use cin.get, program terminates without prompting me for other values
i.e. age, class, phone no.
Please tell me what i should do.
We Believe in Excellence
|
|
|
|
|
Sorry, I forgot to mention that the stream needs to be cleared. So, I wrote this bit of code and made it a static method.
This happens when you have a cin followed by another cin. I learnt about this recently as I too completed a similar task to yours. (Body of code was copied from another forum's thread)
// Purpose : Clear the Input stream
void ClearInputStream(istream& inputstream)
{
inputstream.clear();
while (inputstream.get() != '\n')
{}
};
|
|
|
|
|
Thank you, ddducky (Sorry! I do not know your name). This solves my problem.
cout <<"We Believe in Excellence"
|
|
|
|
|
Is there any message or virtual in MFC that asks the consumer "Can this control loose focus?" and sends the CWnd* or HWND of the control the user is trying to set focus to in the message or virtual?
I'm working on code where when the user leaves a control, the code needs to validate the control's data immediately. If the data is not valid, then a "bad user" messagebox shows and the control must retain focus. There is an exception though. If the user clicks on the "Cancel" or "Close" button or the "x" on the top right, then that's allowed because the user obviously wants to shut down the form so no validation is required.
But then it gets even more complex. The form has a dirty flag so if the form is "dirty", when the form shuts down, I have to ask the user if he/she wants to save the data. If the user clicks "Yes", then the control that previously had focus must be validated first. If it is invalid, then I have to set focus back to it.
From what I've researched, WM_KILLFOCUS is just a notification that the API sends in the middle of the focus change process. What I want is something that allows me to abort the focus change process completely.
I've put PostMessage code in my WM_KILLFOCUS handler to try to get around this but it gets really squirly and the logic just seems unstable. It gets really messy when the user tries to go from one property page to another on a property sheet.
Any ideas?
Peteman_R
Boise, Idaho
|
|
|
|
|
|
Doing validating on WM_KILLFOCUS is a lousy idea. You are much better off doing the validating "on the fly" while the user is entering the data. If the data is invalid give the user a visual feed back such as changing the background colour of the control. Also disable the OK button if any of the controls on the form are in an invalid state.
There is no worse experience for the user than not being able to leave a control that has invalid data so he can do something else and then come back to finish off later.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I've read the article WM_KILLFOCUS is the wrong time to do field validation over and over again and I agree with it in general.
I've mentioned this to my company's design department and they said that the usablity requirements of the feature dictate that we must validate when the user tries to leave the control otherwise, then user can run into all sorts of problems in the future. I've been tempted to tell them to re-design the form so the requirement is not necessary but if the company did that, it would cost a lot of money in the form of time to not only re-design the form but to also re-code it.
What I'm currently doing now is in OnKillFocus, I'll determine that the control's data is invalid, then I'll post a WM_USER message to the form. When the form responds to the WM_USER message, it shows the appropriate messagebox and sets focus to the control. It gets messy though when the user selects a different property page. Also if the user uses an accelerator key to run the button, OnKillFocus is never called.
One idea I'm working on is to write a global catch of WM_LBUTTONDOWN and to catch accelerator key messages as well as the tab message. Then send a "CanKillFocus" message to the control that has focus and to the control's parent. If the response is false, then I would just eat the message. Then I could write a custom SetFocus method in all my controls (They all use a common template) and have it to do the same. I would just have to communicate to my programming department colleagues that they need to use new functionality to set focus to controls--especially on a form that does focus validation.
I'm currently putting together a dummy app to see if this idea would really work or if it would cause even more problems in the future.
Peteman_R
Boise, Idaho
|
|
|
|
|
PeteMan_R wrote:
they said that the usablity requirements of the feature dictate that we must validate when the user tries to leave the control
They're forgetting that the user may be FORCED to leave the control (without wanting to do so), eg: when another application (eg: an IM window) demands focus.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks all -
I found one solution. My Onkillfocus checks whether the current focus is on any of the data entry controls. If yes, then only validate else skip the validation. In this way, user is not forced to erase the wrong data if he wishes to leave the screen.
|
|
|
|
|
Hi everyone,
Is there any way to send infromation to a computer in a local network using the mac address of the network adapter?
If there is...Tell me please!
Cheers,
Thanks.
|
|
|
|
|
I'm not sure what you mean by "send information".
Communication between networked computers is usually done using some form of client/server communication, although there are other less-optimal ways (eg: polling a shared resource) to send information.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
Ravi wrote:
I'm not sure what you mean by "send information".
For example sending a string to a client.
using mac address,
Is it possible?
Cheers,
Thanks.
|
|
|
|
|
You can't magically send data to a MAC address. A transmission protocol needs to be established between the sending and receiving computers.
See Sébastien Lachance's excellent article[^] for a set of classes that makes this easy to do.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I have written a code for putting a text over an image using CxImage but when I'm putting it on the right side of the image the end of the text dissapears just like if the image doesn't end where I see it end, but a little further to the right.
This problem does not exist when I put an image over another image in the right side, probably because it must calculate the extra 'space' it has.
Can anyone tell me why and how to fix it?
Thanks
|
|
|
|
|
I have one abstract class and several classes which are all derived from the abstract class.
How can I create all of those classes without calling each constructor? The way I found is via the CRuntimeClass::CreateObject method and enter the RUNTIME_CLASS(Classname) in an array. So I can easily add classes by simply adding them to an array. Is there another solution, because I am not allowed to have any parameters within my constructors with this solution?
And how can I detect by a keyword which class to create? The keywords are static member variables in the classes. How can I dynamically compare those keywords with a given keyword without creating the classes and then instanciate the appropriate class?
Thanks for any help.
Konrad
|
|
|
|