|
Maybe you can get the printer driver manufacturer to support WM_DEVICECHANGE then you can actually be notified that the power has come or gone...
Marriage slows down your coding, a baby slows it down even more!
|
|
|
|
|
Hi,
I am working on an application that requires user to submit registration information to my company.
There are a couple options for me.
1) bring up an email & pre-type all registraion
information to the body but I am not sure
it's doable or not.
2) create a submit button and send the information
to our server but it requires some work in back end.
Is there any better way to do it? If not, is
that possible to pre-type the email?
Can someone give me some ideas/suggestions?
Thanks,
Kevin
|
|
|
|
|
Sure. You could use MAPISendMail (PSDK) to send mail from the application. You could easily provide the registration information in your desired format within the message object, and just show the user a read-only copy (out of niceness).
To the same end, there are also third-party add-ins that you can add to your app to handle mail sending.
Remember, though, that if you want to process these incoming registration messages automatically, some SMTP servers change the content of email messages. For example, my office e-mail scans for viruses and adds a line indicating the messages has been scanned for viruses at the bottom of the message.
--
I've killed again, haven't I?
|
|
|
|
|
Hi,
Thanks for your suggestion.
After reading http://www.codeproject.com/internet/cimapi.asp,
I am able to send email from my application.
However, it got a minor issue.
My email body is about 10 lines with about 200 characters.
I have "\r\n" to separate each line. The AfxMessageBox
displayed the text correctly, 10 separate lines.
But, the mail.Text ( ) concatenated my data to a
huge BIG string.
Do you know what caused the problem?
Thanks,
Kevin
|
|
|
|
|
I just tried the CIMapi and the mail I sent with "\r\n" as a line separator came across as individual lines as expected.
Have you checked the email message source to see if your CRLFs are coming through at all and just not getting displayed?
--
I've killed again, haven't I?
|
|
|
|
|
Hi,
I found the problem.
The problem was caused by my Thunderbird, Mozilla.
When I tested the same excutable on other
machine with Outlook Express. Everything
came out fine.
Thank for your help!
Kevin
|
|
|
|
|
Is there a reliable quick way to find the 4th Wednesday of every month using the "COleDateTime".
|
|
|
|
|
Just off the top of my head, assuming you want the 4th Wednesday of nMonth in nYear:
1. Create a COleDateTime for the 1st of nMonth in nYear at noon.
2. Use GetDayofWeek to find out what day it is.
3. Determine nOffset, how many days it is 'til the first Wednesday of nMonth.
4. Create a COleDateTimeSpan of (nOffset + 21) days.
5. Add this COleDateTimeSpan to the COleDateTime from step 1.
--
I've killed again, haven't I?
|
|
|
|
|
I am having some trouble on one machine, with an application written using CFtpConnection. I narrowed it down in a test program to a Cmd Prompt app that has the following code inside its tmain():
cerr << "Starting\n";
CInternetSession *pInetSession = new CInternetSession;
cerr << "Got session\n";
CFtpConnection *pFtpConn =
pInetSession->GetFtpConnection(servername);
cerr << "Got connection\n";
while (true);
On the control PC this program does what's expected -- prints the three lines and then hangs (if servername is a valid machine name) or prints two lines and exits with an "Abnormal termination" message (if servername is not valid). On the machine where I'm having trouble, regardless of servername the program will print two lines and then exit with no status message. Could WININET have some kind of corruption? Everything was working fine on this computer until this morning and I can't see what changed in the mean time. I can run ftp from the prompt and establish a connection fine. Any ideas? I am tearing my hair out here.
Thanks
|
|
|
|
|
Use endl instead of \n .
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
cerr flushes every time you write data to it. I acknowledge that it's better practice to use endl but that's not affecting this test program.
|
|
|
|
|
My bad. I glanced right over cerr and just assumed it was cout .
Have you tried catching CInternetException ?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
So find out what went wrong.
try
{
cerr << "Starting\n";
CInternetSession *pInetSession = new CInternetSession;
cerr << "Got session\n";
CFtpConnection *pFtpConn =
pInetSession->GetFtpConnection(servername);
cerr << "Got connection\n";
while (true);
}
catch (CInternetException* e)
{
TCHAR err [1024];
e->GetErrorMessage(err, 1024);
cerr << "Big ol' uh-oh: " << err << endl;
e->Delete();
}
--
I've killed again, haven't I?
-- modified at 14:15 Thursday 5th January, 2006
|
|
|
|
|
It still exits with no message. I think rather than throwing a structured exception, WININET is calling exit(). I also added a handler for (...) and it did not execute either.
|
|
|
|
|
OK -- now I have uninstalled Dr. Watson on the machine in question and sure enough, when I run the test program, it gets to the GetFtpConnection call and then aborts with "The instruction at "0xaddress" referenced memory at "0xaddress"".
|
|
|
|
|
Hello Friends,
I'm developing an application, Where sound data has to be captured from a pci based "sound card" and the processed data has to again fed back to the sound card so that it can be listened by plugging-in a headphone.
I've used Microsoft Visual C++ 6.0 as a platform and DirectX commands for capturing the soundand processing it.This part(CApturing and processing) works well ,but i'm not able to stream the data back to the card.
Can anyone help me in this or refer to any directx programs which does this kind of an process.
Thank You In Advance
Rajeev
|
|
|
|
|
Hi,
I have an MFC application with a main window and a child window. Since my main window shouldn't have any menu/toolbars, I have to use a button on child window to close the whole application. For example, when I click the close button on the child window it calls the close routine in the main application and the whole application should terminate and exit. But, when i am trying to implement this, I am getting illegal memory reference at the point when I am destroying the main application (sometimes at the point when I destroy the child window).
Anyone have any ideas on this issue. I would also like to know if there is any way to implement this (terminating and exiting the main MFC application from child window).
thanks,
-Pav
|
|
|
|
|
Try POSTING a WM_CLOSE message to your main application window and see if that helps. I think you are resulting in a crash because you are directly calling the main close function, which is problematic, since your child window is busy processing an existing message (button click). By posting to main window, you decouple the two events and regular processing of close sequence can occur.
Marriage slows down your coding, a baby slows it down even more!
|
|
|
|
|
Hi,
thanks for the reply. The command WM_CLOSE basically calls Destroywindow() function if I am right. I noticed that there is no error when I close the main application from the child window only when I didnt use any of the buttons or options on child window. My child window contains buttons which call functions defined in main application window. But the crash happens only when I try to close the main application after using any of the child window buttons and I noticed this crash happens when I try to close and destroy the child window from main application.
here is the code-
void main_application::OnClose()
{
...
...
...
child_window_instance->DestroyWindow(); <------
delete child_window_instance;
DestroyWindow();
}
void child_window::OnClose()
{
parent->OnClose();
}
I am getting error at the line marked with arrow. Any suggestions?
thanks,
-Pavan
|
|
|
|
|
In your child window OnClose, you might be setting up a circular dependency.
It calls parent close, which calls child destroy, which results in child close, etc.
I would mereely POST a message to parent to close - call
PostMessage(hParentWindow, WM_CLOSE, 0, 0);
instead of directly calling the parent->OnClose();
This would give your child window OnClose a chance to return from its processing first.
Marriage slows down your coding, a baby slows it down even more!
|
|
|
|
|
Sorry if I am asking to much. So what you are suggesting is, instead of calling parent->OnClose() in Childwindow's OnClose function, its better to use PostMessage function in the place of the above command in Childwindow's OnClose function. Is my interpretation right?
If so, then can you tell me how to call that function in childwindow's OnClose function? From where can i get the handle for the parent window(main application)?
I was still not able to understand how come it is closing application with out errors when i try to close without using any of the options in child window and just clicking on the close button.
thanks,
-Pavan.
-- modified at 16:45 Thursday 5th January, 2006
|
|
|
|
|
Yes.
If your 'parent' is already a CWnd, then you can use parent->m_hWnd as the window handle.
Otherwise, AfxGetApp()->m_pMainWnd->m_hWnd should be the main window handle.
Or you can try
CWnd* pWindow = AfxGetMainWnd( );
pWindow->m_hWnd
would be main window handle.
Because the main parent window closing does not seem to invoke the child closing directly. I think if you call DestroyWindow the OnClose is not called. However, if you are IN the child and closing, then you were getting into trouble.
Marriage slows down your coding, a baby slows it down even more!
|
|
|
|
|
I can use parent->m_hWnd, but how can I pass 4 parameters using the CWnd::PostMessage function? it accepts only 3 parameters. Whereas the Windows SDK's PostMessage takes 4 parameters.
-Pavan.
|
|
|
|
|
parent->PostMessage(WM_CLOSE);
Marriage slows down your coding, a baby slows it down even more!
|
|
|
|
|
Thanks, I have just used the same command. But still I am getting the same error while I am closing the child window (Access Violation error) to be detail -
In debug mode it is giving as follows-
'Unhandled exception in mainapplication.exe :xC0000005: Access Violation'
and then in the stack it is pointing to memory 00000000 address
and sometimes in this mode it is also pointing to a statement in AFXWIN.H like WinProc(msg,wparam,lparam)
In actual execution mode it is giving as-
a crash error and then 'The instruction at "some address" referenced memory at "some address". the memory could not be read'
-Pavan
|
|
|
|