|
Alexandre GRANVAUD wrote: i'd need text file format (like .regs are)
Which is what RegSaveKey() does.
"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
|
|
|
|
|
no it saves a .dat file which is (i verified it with notepad) a binary file not a text file : a proprietary fileformat
|
|
|
|
|
My bad. I was thinking of the "export" feature of regedit.
"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
|
|
|
|
|
oh it can interest me too
i'd like a commandline export feature from regedit, does it exist ?
|
|
|
|
|
Alexandre GRANVAUD wrote: i'd like a commandline export feature from regedit, does it exist ?
No, regedit does not support command-line arguments.
"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
|
|
|
|
|
is there another way to extract .reg files from commandline ?
|
|
|
|
|
Alexandre GRANVAUD wrote: is there another way to extract .reg files from commandline ?
Other than rolling your own, not that I know of. Using the registry API, it wouldn't be that difficult.
If you are considering doing this for the sole purpose of comparing two registry keys, don't bother writing to disk first. That would be just too much time. Write to some data structure in memory instead.
"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
|
|
|
|
|
|
|
Guys,
I am attempting to take a drawing context, basically the entire area of a dialog box and save it as a bitmap so that I can open it up in Paint. I understand that I might be able to take a screen shot using Print Screen, but I only want the drawing area, not the menu and borders etc... This is my code, as far as I can tell it works until I make the call to GetDIBits. This function returns 0, and when I call GetLastError() it returns ERROR_FILE_NOT_FOUND. The function GetDIBits remarks that I must pass an bitmap that isn't selected into a DC. Could somebody give me a hint about where I am going wrong? I am not sure how to unselect an object from a DC, or how to create a copy of the DC after I Blt in the viewing area.
<br />
GetClientRect(hDlg, &rc);
<br />
hdc = GetDC(hDlg);
<br />
blankDC = GetDC(NULL);<br />
<br />
rc.bottom -= (GetSystemMetrics(SM_CYHSCROLL)+GetSystemMetrics(SM_CYEDGE));<br />
<br />
hSavedXYContext = CreateCompatibleDC(hdc);
hSavedXYBitmap = CreateCompatibleBitmap(hdc, rc.right-rc.left,rc.bottom-rc.top); <br />
<br />
hUnSelectedBitmap= CreateCompatibleBitmap(hdc,rc.right-rc.left,rc.bottom-rc.top);<br />
<br />
SelectObject(hSavedXYContext, hSavedXYBitmap); <br />
<br />
BitBlt(hSavedXYContext,0,0,rc.right-rc.left, rc.bottom-rc.top,hdc,0,0,SRCCOPY);<br />
<br />
<br />
<br />
<br />
GetObject(hSavedXYBitmap,sizeof(BITMAP),(LPSTR)(&bmp));<br />
<br />
cClrBits = (WORD)(bmp.bmPlanes*bmp.bmBitsPixel);<br />
<br />
cClrBits = 32;<br />
<br />
pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFOHEADER));<br />
<br />
<br />
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);<br />
pbmi->bmiHeader.biWidth = bmp.bmWidth;<br />
pbmi->bmiHeader.biHeight = bmp.bmHeight;<br />
pbmi->bmiHeader.biPlanes = bmp.bmPlanes;<br />
pbmi->bmiHeader.biBitCount = bmp.bmBitsPixel;<br />
<br />
pbmi->bmiHeader.biCompression = BI_RGB;<br />
<br />
pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biWidth + 15)/16 <br />
* pbmi->bmiHeader.biHeight * cClrBits;<br />
<br />
pbmi->bmiHeader.biClrImportant = 0;<br />
<br />
<br />
pBitmapInfoHeader = (PBITMAPINFOHEADER)pbmi;<br />
<br />
lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED,pBitmapInfoHeader->biSizeImage);<br />
<br />
GetDIBits(hdc,hUnSelectedBitmap,0,(WORD) pbmi->bmiHeader.biHeight,<br />
lpBits,pbmi,DIB_RGB_COLORS);<br />
<br />
Thanks in advance,
Joe
|
|
|
|
|
Before you make a call to GetDIBBits call SelectObject again to release your selected bitmap.
|
|
|
|
|
TheDelChop wrote: I am not sure how to unselect an object from a DC
like this:
HBITMAP hTheDCsOriginalBitmap = SelectObject(hSavedXYContext, hSavedXYBitmap);
... all the other stuff
// when you're done:
SelectObject(hSavedXYContext, hTheDCsOriginalBitmap);
|
|
|
|
|
Another way to deselect a GDI object is to first save your DC context with CDC::SaveContextDC then restore it with CDC::RestoreContextDC when you finish with the objects you selected.
|
|
|
|
|
I have one handle of DC which contains Bitmap Data I want to save this Data
in File How to get it done.
Shall I use CArchive Class if yes then How???
pls anybody having knowedge regarding it pls let me know .It's urgent
There Is Nothing Right & Wrong
|
|
|
|
|
There's no built-in serializaton for DCs or bitmaps.
Saving a DC to a file wouldn't be of any use since the DC wouldn't be valid when read from the
file.
Probably the easiest way to save the bitmap to a file is to
1) use SelectObject() to restore the DC's original bitmap and obtain the HBITMAP for the bitmap
you want to save
2) create a CImage object
3) Use the CImage::Attach() method to attach the HBITMAP to the CImage object
4) Use CImage::Save() to save the bitmap to a file
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
How can I find the selected item index in listview???
suppose I have number of items in my list view and I have select five or six items randomly then how can I find the index of that selected items and subitems?
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Hi,
Enumerate through the items and test each one;
CListCtrl &ctrl = GetListCtrl();
for (int j = 0; j < nCount; j ++)
{
if (ctrl.GetItemState(j, LVIS_SELECTED) == LVIS_SELECTED)) {
}
}
--
=====
Arman
|
|
|
|
|
Hi!
Thanks actually i have try to do it in other way ,
following way,
but in the array I got double values for one selected item now i will go through the
steps you given.
Actually i am working on win32(unicode).
but its ok.
Thanks
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Arman Z. Sahakyan wrote: Enumerate through the items and test each one;
Maybe a bit inefficient in large lists
There's also CListCtrl::GetFirstSelectedItemPosition()/CListCtrl::GetNextSelectedItem()
(LVM_GETNEXTITEM for non-MFC) too.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Are you sure these APIs do not sequentially traverse all the elements by returning those with the specified style (e.g. selected ones)? I'm pretty sure it is so.
--
=====
Arman
|
|
|
|
|
Arman Z. Sahakyan wrote: Are you sure these APIs do not sequentially traverse all the elements by returning those with the specified style (e.g. selected ones)?
Nope, I'm not sure!
Never mind then!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: GetFirstSelectedItemPosition()/
What is Equivalent in win32????
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
amitmistry_petlad wrote: What is Equivalent in win32????
LVM_GETNEXTITEM
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I make it so:
void CMyListView::OnItemchangedRulelist(NMHDR* pNMHDR, LRESULT* pResult)
{ NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
POSITION pos = m_clcList.GetFirstSelectedItemPosition();
while (pos)
{ int nPos = m_clcList.GetNextSelectedItem(pos);
}
*pResult = 0;
return;
}
Edit: I forgot to say that the list im using is one of the extended lists here in codeproject (i don't remember which one )
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|