|
how can i monitor all register sub keys in the selected root regiter key.
and display the register key name,value ans status in list control.
how can i do it?
|
|
|
|
|
|
You can use :
char lszValue[255];
CString str ;
HKEY hKey;
LONG returnStatus;
DWORD dwType=REG_SZ;
DWORD dwSize=255;
returnStatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Key path separeted by \\", 0L, KEY_ALL_ACCESS, &hKey);
if (returnStatus == ERROR_SUCCESS)
{
returnStatus = RegQueryValueEx(hKey,"value you want to read", NULL, &dwType,(LPBYTE)&lszValue, &dwSize);
if(returnStatus == ERROR_SUCCESS)
{
str = (LPCTSTR)lszValue;
}
}
RegCloseKey(hKey);
Cheers
"Peace of mind through Technology"
|
|
|
|
|
kiranin wrote: how can i monitor all register sub keys in the selected root regiter key.
By using RegNotifyChangeKeyValue() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Plz Can U explain the procedure......how i willl do it.?
|
|
|
|
|
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
PabloN wrote: ...when i move my groupbox the radio button won't.
This is normal behavior with VS v6. Has that changed with VS 2005?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I build a dialog based MFC program.
in the file "StdAfx.h" I add the following code,which is used to define a global variable of type CString .
#ifndef jjjjjjjjjjjjjjjjjjj
#define jjjjjjjjjjjjjjjjjjj
CString StrGlobal;
#endif
and then I use it in another file "newfile.cpp"
#include "stdafx.h"
extern CString StrGlobal;
void fun()
{
StrGlobal = _T("KDKDK");
}
when I build the program, following link error shows up:
Linking...
StdAfx.obj : error LNK2005: "class CString StrGlobal" (?StrGlobal@@3VCString@@A) already defined in newfile.obj
why dose this happen? and how can I fix it ?
Thank you very much!!!
-------------------
I am learning C++ and English
|
|
|
|
|
You've got the extern in the wrong file: It should be in the .h file.
Steve
|
|
|
|
|
I build a dialog based MFC program.
in the file "StdAfx.h" I add the following code,which is used to define a global variable of type CString .
#ifndef jjjjjjjjjjjjjjjjjjj
#define jjjjjjjjjjjjjjjjjjj
CString StrGlobal;
#endif
and then I use it in another file "newfile.cpp"
#include "stdafx.h"
extern CString StrGlobal;
void fun()
{
StrGlobal = _T("KDKDK");
}
when I build the program, following link error shows up:
Linking...
StdAfx.obj : error LNK2005: "class CString StrGlobal" (?StrGlobal@@3VCString@@A) already defined in newfile.obj
why dose this happen? and how can I fix it ?
Thank you very much!!!
-------------------
I am learning C++ and English
|
|
|
|
|
move the declaration
CString StrGlobal; to stdafx.cpp or make the varaiable static
nave
|
|
|
|
|
yes, I make it static and it works. thank you so much.
but ,could you please explain to me briefly the reason?
-------------------
I am learning C++ and English
|
|
|
|
|
The .h file might have been include by multiple cpp file. so while compiling , the variable will be present in the vtable of obj file corresponding to each cpp. so while linking, linker will find multiple object and generates the error since it dosen't know to which obj it have to link.
nave
|
|
|
|
|
ewighell wrote: #ifndef jjjjjjjjjjjjjjjjjjj
#define jjjjjjjjjjjjjjjjjjj
CString StrGlobal;
#endif
#ifndef jjjjjjjjjjjjjjjjjjj
#define jjjjjjjjjjjjjjjjjjj
extern CString StrGlobal;
#endif
ewighell wrote: #include "stdafx.h"
extern CString StrGlobal;
void fun()
{
StrGlobal = _T("KDKDK");
}
#include "stdafx.h"
CString StrGlobal;
void fun()
{
StrGlobal = _T("KDKDK");
}
Nibu thomas
Software Developer
|
|
|
|
|
For backup purpose Windows OS makes an Emergency Repair Disc(ERD) through Windows Backup Utility.In That
it makes a folder named RegBack, where it copies all registry values to files. I want to do the exactly same in my
program through VC++. Can anybody give me some direction please.I need help
nirmal
|
|
|
|
|
Hi
you can use the shellExecute for invoking the backup process from your VC++ apllication.
For windows Xp: you can call ShellExecute on rstrui.exe
For Windows 2000: you can call ShellExecute on ntbackup.exe
Cheers
"Peace of mind through Technology"
|
|
|
|
|
How does this help to copy registry keys/values to a file?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
See RegSaveKeyEx() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hello frnds,
I developed one application of video capturing.I used CCD Camera for this application and it display capturing window.now i want to draw a line on this capturing window but i could not draw line on it.when i run program first time it display line but when i start captuing th line disappear.I have attach the capture window on picture box.line show only after when i disconnect capturing(using capDriverDisconnect) from the capture window. if any one have solution plz send me.
The Following Code is for Attachment of Capturewindow with Picture Box.
void CSawingSystemView::OnCaptureStart()
{
// TODO: Add your command handler code here
HwndCapture = NULL;
GetDlgItem(IDC_MAIN_PICTURE_WINDOW,&hWndPicWind);//This is PictureBox Handle
::GetWindowRect(hWndPicWind,&PictureRect); //hWndPicWind is Global
capGetDriverDescription(1,DriverName,sizeof(DriverName),DriverVer,sizeof(DriverVer));
HwndCapture = capCreateCaptureWindow("Capture",WS_CAPTION|WS_VISIBLE | WS_CHILD,0,0,PictureRect.right,PictureRect.bottom,hWndPicWind,IDC_MAIN_PICTURE_WINDOW);
if(HwndCapture != NULL)
{
if(capDriverConnect(HwndCapture,1))
{
::SendMessage(HwndCapture,WM_CAP_GET_SEQUENCE_SETUP,sizeof(CapDriver),(LPARAM)(LPVOID)&CapDriver );
if( CapDriver.fHasDlgVideoDisplay == 0) AfxMessageBox("Not Support Video Dislplay");
if( CapDriver.fHasDlgVideoFormat == 0) AfxMessageBox("Not Support Video Format");
if( CapDriver.fHasDlgVideoSource == 0) AfxMessageBox("Not Support Video Source");
CAPTUREPARMS CapturePara;
double FramesPerSec;
FramesPerSec = 1000;
::SendMessage(HwndCapture,WM_CAP_GET_SEQUENCE_SETUP,sizeof(CapturePara),(LPARAM)(LPVOID)&CapturePara);
CapturePara.dwRequestMicroSecPerFrame = (1000000 / FramesPerSec);
::SendMessage(HwndCapture,WM_CAP_SET_SEQUENCE_SETUP,sizeof(CapturePara),(LPARAM)(LPVOID)&CapturePara);
if(!capPreviewScale(HwndCapture,true))
AfxMessageBox("Error in capPreviewScale");
if(!(::SendMessage(HwndCapture,WM_CAP_SET_PREVIEW,FALSE,0)))
AfxMessageBox("Error in capPreview");
if(!(::SendMessage(HwndCapture,WM_CAP_SET_OVERLAY,TRUE,0)))
AfxMessageBox("Error in capOverlay");
if(!(::SendMessage(HwndCapture,WM_CAP_SET_PREVIEWRATE,1,0)))
AfxMessageBox("Error in capPreviewRate");
}
else
{
AfxMessageBox("Specified Capture Driver cannot be connected to the Capture Window");
}
}
else
{
AfxMessageBox("Error In Creation of CaptureWindow");
}
}
And in OnPaint I has code like this;
void CSawingSystemView::OnPaint()
{
CPaintDC dc(this); // device context for painting
int center_x,center_y;
CPen cPen,*cOldPen;
CWnd *cWndPicWnd;
cPen.CreatePen(PS_SOLID,1,RGB(255,255,0));
//CaptureWndHandle = GetDlgItem(IDC_MAIN_PICTURE_WINDOW);
CaptureWndDc = GetDlgItem(IDC_MAIN_PICTURE_WINDOW)->GetDC();
GetDlgItem(IDC_MAIN_PICTURE_WINDOW)->GetWindowRect(&PictureRect);
cOldPen = CaptureWndDc->SelectObject(&cPen);
center_x = (PictureRect.right - PictureRect.left)/2;
center_y = (PictureRect.bottom - PictureRect.top)/2;
if(CaptureWndDc != NULL)
{
CaptureWndDc->MoveTo(center_x - 10,center_y);
CaptureWndDc->LineTo(center_x + 10,center_y);
CaptureWndDc->MoveTo(center_x ,center_y - 10);
CaptureWndDc->LineTo(center_x ,center_y + 10);
}
}
ok............
|
|
|
|
|
hello frnds,
I developed one application of video capturing.I used CCD Camera for this application and it display capturing window.now i want to draw a line on this capturing window but i could not draw line on it.when i run program first time it display line but when i start captuing th line disappear.I have attach the capture window on picture box.line show only after when i disconnect capturing(using capDriverDisconnect) from the capture window. if any one have solution plz send me.
The Following Code is for Attachment of Capturewindow with Picture Box.
void CSawingSystemView::OnCaptureStart()
{
// TODO: Add your command handler code here
HwndCapture = NULL;
GetDlgItem(IDC_MAIN_PICTURE_WINDOW,&hWndPicWind);//This is PictureBox Handle
::GetWindowRect(hWndPicWind,&PictureRect); //hWndPicWind is Global
capGetDriverDescription(1,DriverName,sizeof(DriverName),DriverVer,sizeof(DriverVer));
HwndCapture = capCreateCaptureWindow("Capture",WS_CAPTION|WS_VISIBLE | WS_CHILD,0,0,PictureRect.right,PictureRect.bottom,hWndPicWind,IDC_MAIN_PICTURE_WINDOW);
if(HwndCapture != NULL)
{
if(capDriverConnect(HwndCapture,1))
{
::SendMessage(HwndCapture,WM_CAP_GET_SEQUENCE_SETUP,sizeof(CapDriver),(LPARAM)(LPVOID)&CapDriver );
if( CapDriver.fHasDlgVideoDisplay == 0) AfxMessageBox("Not Support Video Dislplay");
if( CapDriver.fHasDlgVideoFormat == 0) AfxMessageBox("Not Support Video Format");
if( CapDriver.fHasDlgVideoSource == 0) AfxMessageBox("Not Support Video Source");
CAPTUREPARMS CapturePara;
double FramesPerSec;
FramesPerSec = 1000;
::SendMessage(HwndCapture,WM_CAP_GET_SEQUENCE_SETUP,sizeof(CapturePara),(LPARAM)(LPVOID)&CapturePara);
CapturePara.dwRequestMicroSecPerFrame = (1000000 / FramesPerSec);
::SendMessage(HwndCapture,WM_CAP_SET_SEQUENCE_SETUP,sizeof(CapturePara),(LPARAM)(LPVOID)&CapturePara);
if(!capPreviewScale(HwndCapture,true))
AfxMessageBox("Error in capPreviewScale");
if(!(::SendMessage(HwndCapture,WM_CAP_SET_PREVIEW,FALSE,0)))
AfxMessageBox("Error in capPreview");
if(!(::SendMessage(HwndCapture,WM_CAP_SET_OVERLAY,TRUE,0)))
AfxMessageBox("Error in capOverlay");
if(!(::SendMessage(HwndCapture,WM_CAP_SET_PREVIEWRATE,1,0)))
AfxMessageBox("Error in capPreviewRate");
}
else
{
AfxMessageBox("Specified Capture Driver cannot be connected to the Capture Window");
}
}
else
{
AfxMessageBox("Error In Creation of CaptureWindow");
}
}
And in OnPaint I has code like this;
void CSawingSystemView::OnPaint()
{
CPaintDC dc(this); // device context for painting
int center_x,center_y;
CPen cPen,*cOldPen;
CWnd *cWndPicWnd;
cPen.CreatePen(PS_SOLID,1,RGB(255,255,0));
//CaptureWndHandle = GetDlgItem(IDC_MAIN_PICTURE_WINDOW);
CaptureWndDc = GetDlgItem(IDC_MAIN_PICTURE_WINDOW)->GetDC();
GetDlgItem(IDC_MAIN_PICTURE_WINDOW)->GetWindowRect(&PictureRect);
cOldPen = CaptureWndDc->SelectObject(&cPen);
center_x = (PictureRect.right - PictureRect.left)/2;
center_y = (PictureRect.bottom - PictureRect.top)/2;
if(CaptureWndDc != NULL)
{
CaptureWndDc->MoveTo(center_x - 10,center_y);
CaptureWndDc->LineTo(center_x + 10,center_y);
CaptureWndDc->MoveTo(center_x ,center_y - 10);
CaptureWndDc->LineTo(center_x ,center_y + 10);
}
}
ok............
|
|
|
|
|
I am writing one dialog based program. Now by default the "space bar" is doing the same things as the "enter key". I want the space bar to be disabled. Can you please tell me how to do that?
|
|
|
|
|
Handle the PreTranslateMessage of dialog class and write following code
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_SPACE)
{
pMsg->wParam=NULL ;
}
}
Regards
Amar Sutar
|
|
|
|
|
Its working fine. Thank you.
|
|
|
|
|
Plz check whehter u have the same effect even after u have changed the focus to some other controls in the dialog.
nave
|
|
|
|
|
You can override the PreTranslateMessage() method
Knock out "T" from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|
|