|
this is a way, yes, use a pointer's pointer.
In fact, i doubt it too, but should be try.
Yes,Free Code project~~~~
|
|
|
|
|
if I use _RecordsetPtr *pRs it will get me compiler errors ... _RecordsetPtr it is already a pointer ... and his sizeof is 4
|
|
|
|
|
Hi,
I would like to convert a hexadecimal value to decimal. is there any method in C++ available for me to do that??
For example :
The hexadecimal value of '5a' should be converted to 90 in decimal.
Thanks.
|
|
|
|
|
long lVal = 0x5a;
Yes,Free Code project~~~~
|
|
|
|
|
Given a hex value as a string representation, you could use
strtol or _tcstol to convert using a given base. In your case, this would be 16.
something like:
TCHAR czHex[] = _T("5a");<br />
TCHAR* pzStop = NULL;<br />
long nValue;<br><br />
nValue = _tcstol(czHex, &pzStop, 16);<br />
std::wcout<<_T("Hex Value: ")<<czHex<<_T(" equals: ")<<nValue<<std::endl;<br />
should to the trick. I'm sure there are other ways.
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
RChin wrote:
"..Even my comments have bugs!"
Inspired by Toni78
I had no idea that I inspired you! Thank you for noticing my signature.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
How I control the size of a window meta file when paste it?
example:
//write a WMF and put it into the clipboard.
void copy()
{
CMetaFileDC * m_pMetaDC = new CMetaFileDC();
CRect rc(0,0,20000,20000);
m_pMetaDC->CreateEnhanced(GetDC(),_T ("c:\\test.wmf"),&rc,"name");
//drawing the lines in the DC.....
HENHMETAFILE hMF= m_pMetaDC->CloseEnhanced();
//copy to the clipboard
OpenClipboard();
EmptyClipboard();
::SetClipboardData(CF_ENHMETAFILE,hMF);
CloseClipboard();
}
//then paste the file in a CRichEditView.
void CMyView::PasteIt()
{
GetRichEditCtrl()->Paste();
//clear the clipboard
OpenClipboard();
EmptyClipboard();
CloseClipboard();
}
In windows2000, I can control the size of the metafile with the third parameter of the function CreateEnhanced.But in Win98, the parameter have no function. Why? How control the size in win98?
Thanks a lot.
Yes,Free Code project~~~~
|
|
|
|
|
I have some bitmap buttons i edited thier images in the resource editor and im using the CBitmapButton::AutoLoad() member my problem is that the grey color the editor has doesnt match the grey color or buttons or windows is there a way to give it that windows grey look or does anyone know the exact rgb value of the windows default grey color?
|
|
|
|
|
I don't know the exact grey color of buttons but I can tell you this much. What you are looking for might not be the best solution. In Windows, the default colors can be changed thus making your buttons look awkward. You have no way of knowing before hand what the background color would be. If you implement a bitmap button and set its background color to the dialog box color, it might work on your system, but it might not work on other systems.
To draw a bitmap button with transparent background you need to use a mask when painting the bitmap. So you need to have two bitmaps, one that stores the normal image and the other one that has the mask. A mask is nothing but an image that corresponds to the original but the background is white and the foreground is black. You need to perform the following operations:
1. Output the normal bitmap by XOR-ing it with the target device
2. Output the mask bitmap by AND-ing it with the target device at the exact location of the original bitmap.
3. Output the normal bitmap by XOR-ing it with the target device.
At the end you will have a transparent button.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Can you give a code example?
|
|
|
|
|
I am sorry but I am away from my normal workstation, so I at this moment don't have access to my code. What I described is kind of involving, and it doesn't consists of just a few lines of code, so I cannot reproduce it right now. You need to create a CBitmapButton derived class, and then override DrawItem if I remember it correctly. Then you need to use BitBlt to perform bitwise operations. However, to avoid flicker you should not write directly to the target device. You should create a bitmap in the memory and perform the operations there. Sorry that I cannot help you with source code.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
private:
CButton Comps[5];
CRegKey reg;
.......
(reg.Open(HKEY_LOCAL_MACHINE, "Software\\ShutDown") == ERROR_SUCCESS ) {
reg.QueryDWORDValue("NumOfComputers", num);
POINT pt1, pt2;
pt1.x = 20; pt1.y = 20;
pt2.x = 120; pt2.y = 50;
ULONG Cname_sz;
char buf[20];
CString cn, Cname;
for (int i=0; i< maxComps; i++) {
CRect tmpRect(pt1, pt2);
LPCTSTR val = (LPCTSTR) itoa(i, buf, 10);
int len = Cname.GetLength();
reg.QueryStringValue(val, (Cname.GetBuffer(len)), &Cname_sz);
Comps[i].Create(_T(Cname), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX,
tmpRect, this, 1210+i);
pt1.y += 30; pt2.y += 30;
Cname.Empty();
}
.........
Best Regards,
exceter
|
|
|
|
|
Exceter wrote:
reg.QueryDWORDValue("NumOfComputers", num);
Exceter wrote:
reg.QueryStringValue(val, (Cname.GetBuffer(len)), &Cname_sz);
These functions don't exist (I am talking about VC++ 6.0, I don't know about .NET). You need to use QueryValue. I didn't check the rest of the code. You need to compile it and read the errors that the compiler will give you. I am sure that the compiler will complain very loudly by saying that QueryDWORDValue does not exist, and the same thing can be said about the rest of the code.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
reg.QueryDWORDValue("NumOfComputers", num);
reg.QueryStringValue(val, (Cname.GetBuffer(len)), &Cname_sz);
These functions exists in VC7, they do not make the error. The error is I think with the CButton array, because if I make a sinlge button (not array) the program works, that is, the dialog and the button are created.
|
|
|
|
|
reg.QueryStringValue(val,(Cname.GetBuffer(len)), &Cname_sz);
Comps[i].Create(_T(Cname),
WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX,
tmpRect, this, 1210+i);
pt1.y += 30; pt2.y += 30;
Cname.Empty();
I do see something wrong with your code(but then again it is 3:43 am for me and I am very tired). Again I have never used VC7 so I could be wrong again, but a call to GetBuffer should be followed by a call to ReleaseBuffer (before you can use any other CString functions). Therefor, after QueryStringValue make a call to ReleaseBuffer.
Exceter wrote:
These functions exists in VC7, they do not make the error.
I didn't know that, that's why I refered VC6.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Yes, I gorgot to Release the buffer, thanks.
but, now I have an error in ReleaseBuffer()!!!
the error message is:
file:c:/...vc7//atlmfc/include/atlsimpstr.h
line: 718
Expression: nLength <= GetData()->nAllocLength
|
|
|
|
|
Could well be a buffer overrun then. When you do GetBuffer() instead of using the length, try specifying something like 512.
Steve S
[This signature space available for rent]
|
|
|
|
|
Greate, it works. thanx.
but, how to make it to work with Getbuffer()?
well, in this program I know the estimated sizes of the buffer, but if it exceeds the buffer size I've shoen there?
|
|
|
|
|
private:
CButton Comps[5];
CRegKey reg;
.......
(reg.Open(HKEY_LOCAL_MACHINE, "Software\\ShutDown") == ERROR_SUCCESS ) {
reg.QueryDWORDValue("NumOfComputers", num);
POINT pt1, pt2;
pt1.x = 20; pt1.y = 20;
pt2.x = 120; pt2.y = 50;
ULONG Cname_sz;
char buf[20];
CString cn, Cname;
for (int i=0; i< maxComps; i++) {
CRect tmpRect(pt1, pt2);
LPCTSTR val = (LPCTSTR) itoa(i, buf, 10);
int len = Cname.GetLength();
reg.QueryStringValue(val, (Cname.GetBuffer(len)), &Cname_sz);
Comps[i].Create(_T(Cname), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX,
tmpRect, this, 1210+i);
pt1.y += 30; pt2.y += 30;
Cname.Empty();
}
.........
|
|
|
|
|
what is your problem with this piece of code?
Don't try it, just do it!
|
|
|
|
|
Hi Folks,
Iam trying to find out what is the message generated when double clicked on the titlebar of a window.Iam interested with both the messages that is generated during normal to maximize and maximize to normal movement of the window.
Your help is highly appreciable.
Regards,
pradeep
|
|
|
|
|
Use Spy++.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Hi,
I have rect i want to fill with transparent gradient
( so that one will see what's below the rect ).
The function should look like :
void DrawTransparentGradient(CDC* pDC, CRect* pRect,COLORREF clrStart,COLORREF clrEnd);
Anyone knows how to implement it ?
Thanks a lot!
|
|
|
|
|
You want to do an alpha blend. GDI+ has a few functions that will do that for you.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I'll look for it , hopefully it will help
Thanks
|
|
|
|
|