|
Hi all,
I am new to VC++, I am developing an dll file using VC++, in this i want to put an entry in my windows registry. For example:
SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\test\\test , in this path i want to write some value in the key test.
Plese suggest me
Thanks in advance
Know is Drop, Unknown is Ocean
|
|
|
|
|
Use RegCreateKeyEx for creating the path in the registry, the second parameter is where you'll set the path that you said. You can create the values in your registry by using RegSetValueEx. RegCloseKey will close the registry item that you opened.
|
|
|
|
|
Thanks for your suggestion. Dnt mistake me, plz give me some sample code's or link to learn this.
Thankyou once again
Know is Drop, Unknown is Ocean
|
|
|
|
|
|
Thankyou very much for your kindly help
Know is Drop, Unknown is Ocean
|
|
|
|
|
Exelioindia wrote: plz give me some sample code's or link to learn this.
Is that something you are incapable of?
"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
|
|
|
|
|
You can also try for -
CWinApp::WriteProfileInt/CWinApp::WriteProfileString and CWinApp::GetProfileInt/CWinApp::GetProfileInt
|
|
|
|
|
Thanks for your suggestion. Dnt mistake me, plz give me some sample code's or link to learn this.
Thankyou once again
Know is Drop, Unknown is Ocean
|
|
|
|
|
|
for me CRegKey class provided by Atl is best!
"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
|
|
|
|
|
Use below function
BOOL WriteToRegistry(HKEY hRegRootPath, CString strRegPath, CString strRegAttribute, long lValue)
{
CRegKey key;
CString strAttributeValue;
strAttributeValue.Format("%u", lValue);
if(key.Create(hRegRootPath, strRegPath) == ERROR_SUCCESS)
{
if (key.SetValue(strAttributeValue,strRegAttribute) == ERROR_SUCCESS)
{
key.Close();
return TRUE;
}
}
return FALSE;
}
call the function as shown in example below...
WriteToRegistry(HKEY_LOCAL_MACHINE, "SOFTWARE\\ABC\\DEF", "NUM",1);
Rahul Vaishnav
|
|
|
|
|
Thanks for your code. I am getting some error with the above code. Is this an VC++ code?, sorry if i am wrong.
Errors:
error C2061: syntax error : identifier 'CString'
error C2065: 'CRegKey' : undeclared identifier
error C2065: 'CString' : undeclared identifier
error C2065: 'key' : undeclared identifier
error C2065: 'lValue' : undeclared identifier
error C2065: 'strAttributeValue' : undeclared identifier
.............
Any header files has to included?
Thankyou once again
Know is Drop, Unknown is Ocean
|
|
|
|
|
Exelioindia wrote: Is this an VC++ code?,
If you have to ask such a question, then a project involving the registry is way beyond your grasp. Start with something less ambitious, please!
"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
|
|
|
|
|
|
Californian2 wrote: He's rude to everybody...
If my bluntness offends you, ignore it. You'll find that my sentiments (toward newbie laziness) are supported by the professionals. If I said something that was indeed incorrect, I'll admit such, and have done so in the past.
Californian2 wrote: ...when he tried...
Note the operative word "tried." I certainly don't claim to know any answer, but I do give most of them a try. As a matter of fact, I spent nearly ten minutes reproducing the question of which you speak, and my suggestion was spot on. While Mark's suggestion was more in with what you were after, that just supports the old adage of there being more than one way to skin a cat.
"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
|
|
|
|
|
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)
|
|
|
|