|
<code>TCHAR</code> szStr[20]= <code>_T(</code>"12.45.67.89"<code>)</code>;
HKEY hKey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
_T("SYSTEM\\CurrentControlSet\\Services\\SNMP\\Parameters\\s1"),
0, KEY_ALL_ACCESS, &hKey) != ERROR_SUCCESS)
{
printf("\nError opening the desired subkey (doesn't exist?).\n");
}
else
{
if (RegSetValueEx(hKey, _T("public"), NULL, REG_SZ, <code>(const BYTE *)</code>szStr, <code>(_tcslen(szStr)+1)*sizeof(TCHAR)</code>) == ERROR_SUCCESS)
printf("\nThe value of the key was set successfully.\n");
else
printf("\nError setting the value of the key.\n");
<code>RegCloseKey(hKey);</code>
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanks Mark Salsbery
the above sample program is working fine, am able to enter the Ip Address properly.
thanks a lot
|
|
|
|
|
Hi,
I am using a CListCtrl in a dialog box. The column headings are initialized in OnInitDialog() function.
Now what i want a certain butoon on Dialog box the Column header should change dynamically.
Please Tell me how to do this.
Thanks in Advance.
Dhiraj Kumar Saini
|
|
|
|
|
Well, work it through...
You have a CListCtrl, and you want to do something with the header.
CHeaderCtrl *pHeader = m_pMyListCtrl->GetHeaderCtrl ();
Now you can manipulate the header.
Looking at the docs for CHeaderCtrl, you have a "setitem" function.
It takes an item number, and a HD_ITEM struct. Burrowing deeper, you just have to set the mask of the struct to say "my text field is valid", and the text field to your new string.
HD_ITEM hdItem = {0};
TCHAR buf [128];
lstrcpy (buf, _T("Hello"));
hdItem.mask = HDI_TEXT;
hdItem.pszTest = buf;
pHeader->SetItem (n, &hdItem);
That's all nicely untested, but should work a treat.
Good luck,
Iain.
|
|
|
|
|
Hello, I have used the following code
HD_ITEM hdItem = {0};
TCHAR buf [128];
int n=GetSelectedVisitorIndex();
CString IPAddress=-T("122.56.78.99)"
CString str=_T("Visitor Details:")+IPAddress;
_tcscpy(buf, str );
hdItem.mask = HDI_TEXT;
hdItem.pszTest = buf; // can almost certainly cast from a constant string.
pHeader->SetItem (n, &hdItem);
but it is giving error:
Error 15 error C2039: 'pszTest' : is not a member of '_HD_ITEMW' c:\Documents and Settings\Shy\Desktop\IPAddress\SourceCodes17-09-08\Source Code 06Dec2007\GetFootDlg.cpp 82
Please tell me whats the error
|
|
|
|
|
Dhiraj kumar Saini wrote: 'pszTest' : is not a member of '_HD_ITEMW
Look at the documentation for HD_ITEM, and read about each member variable of the struct. You should spot my (cough, cough) deliberate mistake.
Iain.
|
|
|
|
|
Hi all,
i m using a Property sheet,here im set a font over the property sheet but when i run the application the property pages of property sheet not shown in seted font.
so please tell me how can i set the font of property sheet or property pages.
thank in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
"_$h@nky_" wrote: im set a font over the property sheet
HOW are you setting the font for the property sheet? It should simply take the font built into the dialog resource you are giving it, so if you're overriding that, then timing will matter a lot.
Iain.
|
|
|
|
|
Helo,
I have two file types (i.e. .res and .ems). The extension '.res' files are in c:\AAS\ResultFiles\ folder and the extension '.ems' files are in c:\AAS\EmissionFiles\ folder. By defaul CFileDialog Opens the '.res' directory. when user selects the file type I want to change the directory according to the file type.
Can any body give an idea to do this using MFC.It should work in Windowx XP OS.
Thank you.
|
|
|
|
|
You can use the CFileDialog::m_ofn.lpstrInitialDir data member and set it to the desired directory.
|
|
|
|
|
Have you tried assigning a value to lpfnHook and see what messages that hook function receives when you interact with the dialog (specifically the "Files of type" combobox)?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi ,
I am using "VC++ 2008 Express Edition" and was trying to compile one
VC ++ project taken from this site only, there i came acros the errors which indicates that MFC lib and headers are not shipped by default in VC+ 2008 Express edition.
So can you please tell me how to get them so that i could compile my project for Speech-to-Text project, i am using latest SDK with all
other Libs and headers.Early reply will be appreciated as i need it despirately.
Best Regards,--Raj
|
|
|
|
|
Go buy VS, simple as that.
You can't have VS express and MFC. Go and spend some bucks & learn how to research while you're at it.
|
|
|
|
|
Oki enhzflep,
Once i will purchase the programme, i will be able to compile all those programmes including MFC Hederas and libraries?
If Yes, please share the link where i could purchase that from and any estimated prise.
I am ready to spend bucks, but main thig is ignorance with me ..
Please share with me how to purchase and where purchase from . i am brand new to this Forum and as well as into programming as well ..
|
|
|
|
|
Yup. paid-for VS comes with MFC and will let you compile the examples that use the SAPI.
Also, if you are a student at a recognised (by Microsoft) educational institution or have an International Student Card you can download a copy (for free) of Visual Studio Pro from Microsoft under their Dreamspark program.
You can get Info on VS here:
http://msdn.microsoft.com/en-us/vs2008/products/cc263903.aspx[^]
Make sure you check the available features before purchasing a copy. as an example, if you want to do development for mobile devices then you are unable to use Visual Studio Standard. etc, etc.
seriously dude, www.google.com - try it, it's fantastic.
Ah whatever...
|
|
|
|
|
Does anyone know how to get the level of pressure to use the touchpad with C / C + +?
I could not find any function of the API for this, use only one with C #.
|
|
|
|
|
Hi,
How can I have a HANDLE to my own running process? I want to raise its priority class.
|
|
|
|
|
Ehhh, will ::GetCurrentProcess() do?
Ehh, again after modification...
No, probably not since you want to call ::SetPriorityClass() with a real handle. Use ::OpenProcess()[^] with PROCESS_SET_INFORMATION access right.
Actually I was right from the start even though I pulled it from the memory cache in my head...
Have a look at the sample for ::SetPriorityClass() here[^], it uses ::GetCurrentProcess() to get the process handle.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
modified on Wednesday, September 17, 2008 9:38 AM
|
|
|
|
|
CdrTools is a collection of CD/DVD authoring tools. Its native language is C
and it compiles in Unix. I would like to know if anybody had converted the source code of cdrtools to VC++ or .Net and compiled in Visual Studio?
I am writing an application in MFC for CD/DVD burning, in which i want to use the cdrtools source..
|
|
|
|
|
Dear friends,
I want to draw a rectangle on mouse move. When i press a left button and move it, the rectangle must be move like in paint. In paint when we want to cut something we press left button and drag it. I also want same. When i move the mouse it just draw the rectangle using MFC class and VC++. My mail ID is mohiuddin_vu@yahoo.co.in
Mohiuddin
|
|
|
|
|
Sk Mohiuddin wrote: I want to draw a rectangle on mouse move
And what is your trouble about?
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]
|
|
|
|
|
Nothing.
|
|
|
|
|
Actually I know you haven't troubles, Hamid.
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]
|
|
|
|
|
bool fInCapture;
CPoint RubberBandPoint;
CRect RubberBandRect;
void DrawRubberBandRect();
CMyWnd::CMyWnd()
{
fInCapture = false;
}
void CMyWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
CWnd::OnLButtonDown(nFlags, point);
SetCapture();
fInCapture = true;
RubberBandPoint = point;
RubberBandRect.SetRect(point.x, point.y, point.x, point.y);
DrawRubberBandRect();
}
void CMyWnd::OnMouseMove(UINT nFlags, CPoint point)
{
if (fInCapture)
{
DrawRubberBandRect();
RubberBandRect.SetRect(RubberBandPoint.x, RubberBandPoint.y, point.x, point.y);
DrawRubberBandRect();
}
CWnd::OnMouseMove(nFlags, point);
}
void CMyWnd::OnLButtonUp(UINT nFlags, CPoint point)
{
if (fInCapture)
{
DrawRubberBandRect();
ReleaseCapture();
fInCapture = false;
}
CWnd::OnLButtonUp(nFlags, point);
}
void CMyWnd::DrawRubberBandRect()
{
CClientDC dc(this);
int nPenWidth = 4;
CPen DrawPen(PS_SOLID, nPenWidth, RGB(0x80,0x80,0x80));
CPen *pOldPen = dc.SelectObject(&DrawPen);
CGdiObject *pOldBrush = dc.SelectStockObject(NULL_BRUSH);
int OldROPMode = dc.SetROP2(R2_XORPEN);
dc.Rectangle(&RubberBandRect);
dc.SetROP2(OldROPMode);
dc.SelectObject(pOldBrush);
dc.SelectObject(pOldPen);
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How can a nice guy like you be a friend of such a bad guy as led mike?
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]
|
|
|
|