|
I have used this code for my project in VC++ MFC(Dialog based application)
goto Tools->Options->select directories tab
select "win32" in "platform" combobox & select "Include files" in "Show Directories for:" Combobox.
suppose VC++ is installed on D: drive
add following directories..
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
D:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE
include "atlbase.h" file also
then use my given function...
Rahul Vaishnav
|
|
|
|
|
Hi all,
Is there a way in MAPI to convert HTML to mime for example
<HTML>
<HEAD>
<TITLE></TITLE>
<STYLE TYPE="text/css">
<!--
.Product
{
font-size:14pt;
font-weight:700;
font-family:arial, sans-serif;
}
.feature
{
font-size:10pt;
font-weight:700;
font-family:arial, sans-serif;
color:#7C5828;
}
.description
{
font-size:10pt;
font-weight:400;
font-family:arial, sans-serif;
}
-->
</STYLE>
</HEAD>
<BODY LINK="#7C5828" ALINK="#7C5828" VLINK="#7C5828">
<TABLE WIDTH=100% CELLPADDING=5 CELLSPACING=0 SUMMARY="">
<TR VALIGN="top" >
<TD ALIGN="center" BGCOLOR="#FAEBA4">
<IMG SRC="1.jpg" ALT="">
</TD>
<TD><ID ID="greeting">Thank you for using Microsoft® Office Outlook® 2003! </ID>
<ID ID="Intro"> This version of Outlook includes new capabilities designed to help you access, prioritize, and act on communications and information so that you may use your time more efficiently and more easily manage the ever-increasing flow of incoming e-mail.</ID><br><br>
<ID ID="Idea">To give you some idea of what is possible with Outlook 2003, we have put together a list of our favorite new features.
</ID><br><br>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
to:
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:#7C5828;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:#7C5828;
text-decoration:underline;}
p.product, li.product, div.product
{mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:14.0pt;
font-family:Arial;
font-weight:bold;}
p.feature, li.feature, div.feature
{mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:10.0pt;
font-family:Arial;
color:#7C5828;
font-weight:bold;}
p.description, li.description, div.description
{mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:10.0pt;
font-family:Arial;}
span.feature1
{font-family:Arial;
color:#7C5828;
font-weight:bold;}
span.description1
{font-family:Arial;
font-weight:normal;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=3DEN-US link=3D"#7C5828" vlink=3D"#7C5828" alink=3D"#7C5828">
<div class=3DSection1>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p> </o:p></span></font></p>
<table class=3DMsoNormalTable border=3D0 cellspacing=3D0 cellpadding=3D0 =
width=3D"100%"
style=3D'width:100.0%'>
<tr>
<td valign=3Dtop bgcolor=3D"#FAEBA4" =
style=3D'background:#FAEBA4;padding:3.75pt 3.75pt 3.75pt 3.75pt'>
<p class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font =
size=3D3
face=3D"Times New Roman"><span style=3D'font-size:12.0pt'><img =
width=3D32
height=3D32 id=3D"_x0000_i1025" =
src=3D"cid:image001.jpg@01C7FC54.44EF62E0"><o:p></o:p></span></font></p>
</td>
<td valign=3Dtop style=3D'padding:3.75pt 3.75pt 3.75pt 3.75pt'>
<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><span =
class=3Dfeature1><ID ID=3D"greeting"><font
size=3D2 color=3D"#7c5828" face=3DArial><span =
style=3D'font-size:10.0pt'>Thank you
for using Microsoft® Office Outlook® 2003! =
</ID></span></font></span><span
class=3Ddescription1><ID ID=3D"Intro"><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt'>This version of Outlook includes new =
capabilities
designed <span style=3D'font-style:italic'>to help you access, =
prioritize,
and act on communications and information</span> so that you may =
use your
time more efficiently and more easily manage the ever-increasing flow =
of
incoming e-mail.</ID></span></font></span><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'><br>
<br>
<span class=3Ddescription1><ID ID=3D"Idea"><font face=3DArial>To give =
you some idea
of what is possible with Outlook 2003, we have put together a list of =
our
favorite new features. =
</font></ID></span></span></font><o:p></o:p></p>
</td>
</tr>
Apologies for the long codes I just want to show a concrete example
Thanks,
Jj
|
|
|
|
|
Hi all. Im trying to make a function to try to attempt something, but when it fails try "one" more time and then move on to the next thing.
So far i've made something that doesnt look close to what i have to do.
<br />
#include <iostream><br />
#include <string><br />
#include <windows.h><br />
using namespace std;<br />
<br />
int main()<br />
{<br />
string test="Testing this";<br />
string test1="Testing the other side";<br />
if(test == test1){<br />
while(test == test1){<br />
Sleep(9000);<br />
cout << "Match " << endl;<br />
}<br />
}<br />
else{<br />
cout << "No match! " << endl;<br />
}<br />
return 0;<br />
}<br />
Any suggestions? Thanx in advance!
|
|
|
|
|
Well the “while” loop will run forever, unless you end the process via the “Windows Task Manager”, because neither string is ever going to change. Of course you do not need to worry about that, because “test” is never going to equal “test1”, so the “while” loop will never run.
I recommend that next time you try to explain what you are attempting to do. The odds are that someone who frequents CP has already tried it.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Try this one -
CString test="Testing this";
CString test1="Testing the other side";
int count = 0;
while (test != test1)
{
Sleep(90);
if (count++ == 10)
break;
}
|
|
|
|
|
dellthinker wrote: Im trying to make a function to try to attempt something...
Such as?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi all,
in my project i need to run a timer 10msec in that i have to incerement a counter, as well as parally i have to run 8 timers with different speeds. now that timer gives me a count of 10 sec for 15 sec of time. i.e the timer takes minimum of 15 msec to execute now what i can to ?
thanks in Advance
EssPee
|
|
|
|
|
Windows is not a real-time operating system. So, you will never be able to Sleep exactly for 10 msec. Depending on a lot of things, this can vary up to 15 msec (as you experienced).
|
|
|
|
|
In addition to Cédric's advice I suggest you read this[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
You should be using multimedia timers for increased accuracy. A window timer must pass through the window message loop which will cause increased non-uniform intervals.
As Cédric stated, you cannot guarantee that the operating system will *always* fire the timer callback within a specified timeframe. This is because of how the XP/Vista and prior operating system kernels interrupts have been implemented. However you can ask the operating system to increase the resolution from its default value of 64Hz (about 15ms) to the maximum possible value.
#include <mmsystem.h>
#pragma comment(lib,"winmm.lib")
TIMECAPS tc;
if (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(TIMECAPS)))
{
TRACE1(_T("Setting system time resolution to: %d"),tc.wPeriodMin);
timeBeginPeriod(tc.wPeriodMin);
}
http://msdn2.microsoft.com/en-us/library/ms713416.aspx[^]
Best Wishes,
Randor (David Delaune)
|
|
|
|
|
not possible on Window Enviornment.. i have worked for weeks to reach out to this conclusion.. actulaly if your company can afford RealTime system.. then go for it.. it really helpful in longterm!
"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 created a cleanup function in a dialog that will be created modeless. I can call it in either of the following functions. Is there any recomendation?
DestroyWindow()
{
Cleanup();
} or
OnDestroy()
{
Cleanup();
}
-- modified at 0:39 Friday 21st September, 2007
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
OnDestroy does the trick
FYI from msdn:
DestroyWindow is a place holder for performing cleanup. Because DestroyWindow is a virtual function, it is shown in any CWnd-derived class in Class View. But even if you override this function in your CWnd-derived class, DestroyWindow is not necessarily called. If DestroyWindow is not called in the MFC code, then you have to explicitly call it in your own code if you want it to be called.
---
Yours Truly, The One and Only!
devmentor.org
Design, Code, Test, Debug
|
|
|
|
|
Thanks. Got my 5
DevMentor.org wrote: OnDestroy does the trick
MSDN sais DestroyWindow not OnDestroy , or am I loosing any points?
However, DestroyWindow calls OnDestry actually, but after destroying the window, if I remember truly.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
I have never has any issues with doing things in OnDestroy( )
Yes by this time the window has been destroyed.
---
Yours Truly, The One and Only!
devmentor.org
Design, Code, Test, Debug
|
|
|
|
|
DevMentor.org wrote: I have never has any issues with doing things in OnDestroy( )
I'm not sure. I think it would be safer to use DestroyWindow. As an example consider the following scenario:
I have a dialog class in which I create a worker thread and give a pointer to the dialog to that thread to post it's messages back to the dialog. I forget to use a safe message posting and write pWnd->PostMessage instead of ::PostMessage(pWnd->GetSafeHwnd(),... inside the thread.
I think here I'll have a problematic exit. The window is destroyed before the thread being stopped. So if the thread manages to send another message, the problem arise.
Please correct me if I'm wrong. Thank you so much in advanced.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
Is there a way for the main thread to tell the worker thread to exit?
You need to get this setup first. If you got this setup then it's a simple matter of the main thread waiting on the worker thread to exit.
Look at the WaitForSingleObject( ) API
Basically you need to make this call from the main thread and pass the API the handle to the worker thread....the main thread will block until the worker thread dies and then you do the clean up with the main thread when it resumes.
Does that make sense?
---
Yours Truly, The One and Only!
devmentor.org
Design, Code, Test, Debug
|
|
|
|
|
Thank you very much for your help. Beacause of the first help you provided, I don't have any other question.
I was just thinking about how each function might make trouble.
In our scenario of course we terminate threads truly and use waiting mechanisms. The problem here is that if we stop threads in Cleanup function and call this function after main window is destroyed, and inside the thread (before cleanup is called) we try to access the window, the call will fail with an error because the main window already destroyed in DestroyWindow but cleanup has not been called yet. Before we call cleanup and attempt to stop thread, in OnDestroy, the thread might need to send a message to the already destroyed window.
This is a really rare situation, but I think I encountered a simmilar problem already and now found what was wrong.
I hope it is clearer now. I'm sorry English is not my native language and I, some times, encounter problems describing what I mean.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
You're welcome,
I am just trying to help you think things out as you best understand your code.
I hope you manage to solve the problem! Your English is fine
---
Yours Truly, The One and Only!
devmentor.org
Design, Code, Test, Debug
|
|
|
|
|
DevMentor.org wrote: I am just trying to help you think things out as you best understand your code.
Thanks. Your help is really appreciated.
DevMentor.org wrote: Your English is fine
Thank you so much. I have more confidence now
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
Cool!
---
Yours Truly, The One and Only!
devmentor.org
Design, Code, Test, Debug
|
|
|
|
|
Hello everyone!
Is there a way to mess with other application's controls? I need to capture input from a text box from a specific program.
Thanks in advance!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Yes, it's called subclassing. Basically you can steal any messages from the other window, modify it it, eat it, pass it on, or do whatever you want with it.
Been awhile since I've done it, but you can replace an existing windows WndProc with your own, using SetWindowLong and GWL_WNDPROC.
There are a ton of articles on CP, but can't seem to locate the one I was thinking of...
[edit] Look at CWnd::SubclassWindow or CWindowImpl::SubclassWindow if using ATL/WTL. [/edit]
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
You can also use hooking to do the same.
Search for PasswordSpy by Brian Friese in codeproject for an example.
|
|
|
|
|
Lord Kixdemp wrote:
Is there a way to mess with other application's controls? I need to capture input from a text box from a specific program.
WM_GETTEXT and WM_GETTEXTLENGTh will help!, and for reteriving Window Handle of particular Control! use FindWindow Api
"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
|
|
|
|