|
At this point I am not... That is what I am looking to do. I cannot use an external tool as this is part of an integrated application. Therefore I have been working on methods of deinterlacing use odd scan line averaging. This does not work all that well. "Yet"
|
|
|
|
|
Ok, you experienced programs will probably get a laugh out of this one but here goes anyway:
Is there any way to have an owner drawn list box be a bitmap (I have successfully loaded it and everything) but still use LB_ADDSTRING and all the other Win32 messages that work on standard list boxes?
When I say bitmap, basically a nicely drawn square "window" with a nice border and nice shading?
If not, what are, if any, the Win32 messages analogous to WM_CTLCOLORLISTBOX that will change the scroll bar and the vertical strip that it lies on...and also the black border around the list box (if created with CreateWindow...)
Thanks in advance.
|
|
|
|
|
You can subclass the listbox and then handle the WM_NCPAINT ! It handles the border and no client region drawing ! In MFC it`s way much simpler ! Derive a class from CListBox and in the WM_NCPAINT do this for a cool border :
FrameRect(HDC,&clientRect,GetSysColorBrush(COLOR_HIGHLIGHT))
with the toolbar ... i didn`t have much luck on it either !
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
Thanks for that one...subquestion: does your book of knowledge extend a little into regions and how to properly set them for owner drawn buttons so they can be circular instead of square? I have a posted a thread on this: Regions, but haven't gotten any replies unfortunately...
|
|
|
|
|
I have need to convert double values to string representations that exclude a presentation of a decimal and can provide a variable number of significant digits. Should I develop a class to do this or is there some easier/faster way?
double ValueA = 3.9876;
CString TwoSigDigits = "39"
CString ThreeSigDigits = "398"
CString FourSigDigits = "3987"
If it helps the double values will always be positive and less than 1000.
Thanks.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
I don't know of any available code, but it seems like all you need is a function to convert doubles to strings with a given number of significant digits. First you need to round the value and then add insignificant zeros if required.
If you need help writing this code, let me know.
Regards,
Alvaro
Quitters never win. Winners never quit. But those who never win and never quit are idiots. -- despair.com
|
|
|
|
|
Thanks Alvaro. I'll put a class together to do the stuff. It'll be a nice relaxing way to spend the afternoon Maybe I'll post it next week as an article.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
CString z, a;
a.Format("%f", ValueA)
a.Remove('.');
z = a.Left(N);
|
|
|
|
|
Thanks Brian. That's just the ticket.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
Am I doing something wrong here? Because this crashes on the marked line.
Oh and how would I create a DC that is compatible with a bitmap that I want to select into it?
CDC dc;<br />
CBitmap bmp;<br />
<br />
<br />
bmp.CreateCompatibleBitmap(&dc, width, height);<br />
CBitmap *old = (CBitmap*)dc.SelectObject(bmp);<br />
<br />
<br />
dc.SelectObject(old);
|
|
|
|
|
|
I can't believe it compiled with out that.
Jason Henderson "You must be the change you wish to see in the world." - Gandhi
articles profile
|
|
|
|
|
Really eh?
Should have caught that...
|
|
|
|
|
CGDIObject has an override that will cast it to some type that SelectObject likes - but i think it's the wrong value, or it's not attached to the CGDIObject anymore, or something really strange and unexpected.
i've been bitten by it a number of times.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
Jason Henderson wrote:
I can't believe it compiled with out that.
The beauty of conversion operators designed by... um, less experienced designers. If you weren't aware - MFC is (almost?) the hallmark of bad C++ design.
|
|
|
|
|
Ah! I am used to not noticing things like that unless the compiler errors :p
Thanks, I'll see what I can patch up. But what about the 2nd question? How do I create a compatible CD for a bitmap?
|
|
|
|
|
HDC hdcScreen,hdcCompatible;
HBITMAP hbmScreen;
hdcScreen = ::CreateDC("DISPLAY", NULL, NULL, NULL);
hdcCompatible = ::CreateCompatibleDC(hdcScreen);
hbmScreen = ::CreateCompatibleBitmap(hdcScreen,width,height);
::SelectObject(hdcCompatible, hbmScreen);
Now draw in the hdcCompatible !
/**/
PBITMAPINFO CreateBitmapInfoStruct(HBITMAP hBmp)
{
BITMAP bmp;
PBITMAPINFO pbmi;
WORD cClrBits;
GetObject(hBmp, sizeof(BITMAP), (LPSTR)&bmp);
cClrBits = (WORD)(bmp.bmPlanes * bmp.bmBitsPixel);
if (cClrBits == 1) cClrBits = 1;
else
if(cClrBits <= 4) cClrBits = 4;
else
if (cClrBits <= 8) cClrBits = 8;
else
if (cClrBits <= 16)cClrBits = 16;
else
if (cClrBits <= 24)cClrBits = 24;
else cClrBits = 32;
if (cClrBits != 24) pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFOHEADER)+sizeof(RGBQUAD) * (2^cClrBits));
else pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFOHEADER));
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pbmi->bmiHeader.biWidth = bmp.bmWidth;
pbmi->bmiHeader.biHeight = bmp.bmHeight;
pbmi->bmiHeader.biPlanes = bmp.bmPlanes;
pbmi->bmiHeader.biBitCount = bmp.bmBitsPixel;
if (cClrBits < 24)
pbmi->bmiHeader.biClrUsed = 2^cClrBits;
pbmi->bmiHeader.biCompression = BI_RGB;
pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biWidth + 7) /8 * pbmi->bmiHeader.biHeight * cClrBits;
pbmi->bmiHeader.biClrImportant = 0;
return pbmi;
}
void CreateBMPFile(LPTSTR pszFile, PBITMAPINFO pbi,HBITMAP hBMP, HDC hDC)
{
HANDLE hf;
BITMAPFILEHEADER hdr;
PBITMAPINFOHEADER pbih;
LPBYTE lpBits;
DWORD dwTotal;
DWORD cb;
BYTE *hp;
DWORD dwTmp;
pbih = (PBITMAPINFOHEADER) pbi;
lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbih->biSizeImage);
GetDIBits(hDC, hBMP, 0, (WORD) pbih->biHeight,lpBits, pbi, DIB_RGB_COLORS);
hf = CreateFile(pszFile,GENERIC_READ | GENERIC_WRITE,(DWORD) 0, (LPSECURITY_ATTRIBUTES) NULL, CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL);
if(hf == INVALID_HANDLE_VALUE)
return;
hdr.bfType = 0x4d42;
hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) +pbih->biSize + pbih->biClrUsed * sizeof(RGBQUAD) + pbih->biSizeImage);
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) + pbih->biSize + pbih->biClrUsed * sizeof (RGBQUAD);
WriteFile(hf, (LPVOID) &hdr, sizeof(BITMAPFILEHEADER), (LPDWORD) &dwTmp, (LPOVERLAPPED) NULL);
WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER)+ pbih->biClrUsed * sizeof (RGBQUAD), (LPDWORD) &dwTmp, (LPOVERLAPPED) NULL);
dwTotal = cb = pbih->biSizeImage;
hp = lpBits;
while (cb > sizeof(hp)) {
WriteFile(hf, (LPSTR) hp, (int) sizeof(hp),(LPDWORD) &dwTmp, (LPOVERLAPPED) NULL);
cb-= sizeof(hp);
hp += sizeof(hp);
}
WriteFile(hf, (LPSTR) hp, (int) cb,(LPDWORD) &dwTmp, (LPOVERLAPPED) NULL);
CloseHandle(hf);
GlobalFree((HGLOBAL)lpBits);
}
/*have fun*/
To save use this :
PBITMAPINFO pbi=CreateBitmapInfoStruct((HBITMAP)hbmScreen);
CreateBMPFile(d.m_ofn.lpstrFile,pbi,(HBITMAP)hbmScreen,(HDC)hdcCompatible);
DeleteObject(hbmScreen);
DeleteDC(hdcCompatible);
DeleteDC(hdcScreen);
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
|
I would like change all the text font on a CListCtrl, and I don't know make it !
I can change the CListCtrl font but not the text inside List !
Please Help Me !
MyEden
MyEden
|
|
|
|
|
Open up the .rc file, search for the IDD of the dialog involved.
look where the font is defined, something like this:
FONT 8, "MS Sans Serif", 0, 0, 0x1
type in the font you want instead e.g:
FONT 9, "Verdana", 0, 0, 0x1. This will change font in whole dialog, but you could just put a clistctrl in a child window, and use this child dialog instead of clistctrl everywhere.
"Life begins at 140"
|
|
|
|
|
One solution is customdraw.
OnNMCustomdrawList(...)
{
NMLVCUSTOMDRAW *pLVCD = reinterpret_cast<nmlvcustomdraw *="">(pNMHDR);
*pResult = CDRF_NEWFONT;
pLVCD->nmcd.hdc = someFontHandle;
return pResult ;
}
Kuphryn
|
|
|
|
|
Hello,
I've found something curious:
In a dialog based app in which I used xml and HTML, I was modifying HTML contents and using XML in the same class...
The surprise has arised when I have noticed that when I've separated the XML Class and the HTML class, the HTML part needed the msxml.dll imported too in order to work...
I suppose that this is just a coincidence and that I could use another header file included or another import (at least) I'd like to know how to do it in order not to import the msxml.dll (if I don't want to use xml...)
NOTE:
if I don't import that dll the compiler doesn't know anything about this declaration:
IHTMLDocument2Ptr m_pHTMLDoc; Thank you in advance.
|
|
|
|
|
it would be nice if we could use the xml parsing engine with no microsoft dll ! yeah ... well things are like this ! all the objects you use are contained by it ! no msxml.dll no ms parsing ! do your own parser !
it`s quite hard !
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
OK, that's great, but what happens when you have a lot of work and you cannot do every brick of your house? and moreover, what happens when tecnologies get improved and you can benefit yourself from improvements done by Microsoft (or someone else)?
I don't think that an own parser would be the solution, and moreover, my question was not about how to avoid that dll for xml parsing, is in order to avoid using that dll in order to avoid it's needing in using html com pointers...
Although all said above, thank you for your interest.
|
|
|
|
|
Hi!
I'm writing a Win32 application (not MFC) and i have done everything about dialog boxes and their controls.
The problem is that i want to read from a *.mdb(MSACCESS) file and write in it.
, and i don't know how to do it.
I tried to use an ActiveX control (Microsoft ADO data control version 6.0 (OLEDB)) and it didn't work.
The truth is that i don't know how to use an ActiveX control or to "play around" with databases.
My program is very simple: just to add some phones, names, adresses etc in a database
and then read them!
this is the first program i'm making with a database
I know that it would be easier to use MFC... but i want to do that in Win32 SDK app.
I just want to see how it works..
Can anyone tell me what should i use or do ???
|
|
|
|
|