|
Do this Tools | Options. Find Projects | VC++ Directories. Change the order of the Include Files (select from the combobox at the upper right). Just move the desired directories to the top, even add new ones if you wish
|
|
|
|
|
Hi all,
I am currently doing a project where I need to be able to have a imaging framework.
Although the framework itself runs pretty smooth, the CPaintDC of MFC kills me.
The SetPixelV is extremely slow, so I want to use another way of doing this.
I know it is possible to create a CDC in memory, but how can I put a bitmap created from this CDC put on the surface a CWnd subclassed control?
Any suggestions?
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
 bitblt.
Code snippet to help you (heavily edited and content deleted):
BOOL DoChart(CallContextObj *pCallContextObj)
{
CDC oMemDC;
CBitmap *pOldBmp;
CBitmap oBmp;
long lWidth = 300;
long lHeight = 200;
pCallContextObj->GetParameterValue("ChartWidth",&lWidth);
pCallContextObj->GetParameterValue("ChartHeight",&lHeight);
CRect oBmpSize(0,0,lWidth,lHeight);
oMemDC.CreateCompatibleDC(NULL);
int iOldMapMode = oMemDC.SetMapMode(MM_TEXT);
CWindowDC dcScreen(NULL);
oBmp.CreateCompatibleBitmap(&dcScreen,oBmpSize.Width(), oBmpSize.Height());
pOldBmp = oMemDC.SelectObject(&oBmp);
WORD wChartType = 88;
pCallContextObj->GetParameterValue("ChartType",&wChartType);
BOOL bRetval = FALSE;
char caHeaders[512];
strcpy(caHeaders,"Invalid Chart Type");
switch (wChartType)
{
case 0:
bRetval = DoLineChart(pCallContextObj,&oMemDC,caHeaders,oBmpSize);
break;
case 1:
bRetval = DoBarChart(FALSE,pCallContextObj,&oMemDC,caHeaders,oBmpSize);
break;
case 2:
bRetval = DoBarChart(TRUE,pCallContextObj,&oMemDC,caHeaders,oBmpSize);
break;
case 3:
bRetval = DoOpenHiLowCloseChart(pCallContextObj,&oMemDC,caHeaders,oBmpSize);
break;
case 4:
bRetval = DoPieChart(pCallContextObj,&oMemDC,caHeaders,oBmpSize);
break;
}
if (bRetval)
{
LPSTR cpBuf = pCallContextObj->GetOutputBufferPtr();
long lQuality = 75;
pCallContextObj->GetParameterValue("ImageQuality",&lQuality);
char caContentType[256];
long lDataSize = WriteImage(oBmp,cpBuf,pCallContextObj->GetOutputBufferSize(),caHeaders,(DWORD)lQuality);
if (lDataSize > 0)
{
pCallContextObj->SuppressHeaders();
pCallContextObj->GetMimeType("x.jpg",caContentType);
sprintf(caHeaders,"Content-Type: %s%sContent-Length: %d%s%s",caContentType,cpCRLF,lDataSize,cpCRLF,cpCRLF);
if (pCallContextObj->ServerSupportFunction(HSE_REQ_SEND_RESPONSE_HEADER,"200 OK",0,(LPDWORD)caHeaders) || ::GetLastError() == 10054)
pCallContextObj->WriteClient((LPVOID)cpBuf,(LPDWORD)&lDataSize);
*cpBuf = 0;
}
else
bRetval = FALSE;
}
oMemDC.SetMapMode(iOldMapMode);
oMemDC.SelectObject(pOldBmp);
oMemDC.DeleteDC();
onwards and upwards...
|
|
|
|
|
Here is a starting point. Search for serial and/or com in the headings.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
Hi..
I have problems with makeing a scale in GDI.
What i make is : I draw on a memory DC then BitBlt on a window..
I want to make 2 things :
1-Set the origin of the memory DC to lower left corner instead of upper left.
2-change the scale : for example when i call LineTo(hdc,0,10) it draws 100 PX for example not 10.
after drawing on memory DC I BitBlt on the window that may or may not has its coordinates systems changed.
can this be done using SetViewportExt and SetWindowExt ?
thank you in advance
|
|
|
|
|
Will SetViewportOrg() or SetWindowOrg() help?
hspc wrote:
...it draws 100 PX for example not 10.
This sounds like a map mode issue. Check out SetMapMode() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
thank you
SetMapMode() is not enough..
using it I can set the mapping mode to MM_ANISOTROPIC but then i must use SetViewportOrg() or SetWindowOrg() to set the scale ..
the question is how ?
|
|
|
|
|
i have insert a combo box with 2 choices. i create a member variable for that combo as VALUE. what is correct way to pickup the data selected?
|
|
|
|
|
http://www.codeproject.com/combobox/combobox_tut.asp
|
|
|
|
|
Hello!
I have got task to write easy security tool for MS Windows 98. It must deny access to specified local CD-ROM device. I think one of the possible solution is to stop corresponding device driver on demand. So the question is: which win32 functions should i use for enumerating devices and stopping drivers? Or should it be done by other way? Or may be you know the right "search string" for MSDN or Google to find good explanation?
Sorry for my bad English.
Thank you!
|
|
|
|
|
stasik garifulin wrote:
should i use for enumerating devices
You can do it with Windows Management Instrumnetation(WMI) classes. Search fot it in MSDN or google.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
ayyy,
im doing a device countrol system interfacing telephone...that is user calls....select the device to be activated ....my vc++ program triggeres the givn device connected with my modem to be activated.....but to make this happen we need some functions of TAPI...coud any one help me out with some sample codes or reference....
waiting..
Nick.
|
|
|
|
|
Prabha Govind Perumal wrote:
but to make this happen we need some functions of TAPI...coud any one help me out with some sample codes or reference....
The Platform SDK has plenty of TAPI samples.
You can also try
http://www.julmar.com/samples.htm[^]
or search this forum for TAPI as there have been many similar questions answered.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
I'm creating own file browser based on CListCtrl - report mode.
I need to display the same folder's icon as windows explorer do.
I'm using SHGetFileInfo() to get the image.
My problem is that (in Windows XP - not tested in older systems)
the image is displayed with ugly solid black shadow around icon, (my list control has white background)
where system displays nice gradual shadow of the icon.
But when I set this icon into icon static control, it is displayed correctly.
Code I use to create image list :
m_listImg.Create(16,16,ILC_COLOR32|ILC_MASK,0,10);
CBitmap bmpTmp;
bmpTmp.Attach(::LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FILELIST),
IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION|LR_LOADTRANSPARENT));
m_listImg.Add(&bmpTmp, RGB(255,0,255));
SHFILEINFO fi;
SHGetFileInfo("C:\\",0,&fi,sizeof(fi),SHGFI_ICON|SHGFI_SMALLICON);
m_listImg.Replace(9,fi.hIcon);
Any ideas ?
Thank you !
rrrado
|
|
|
|
|
I generally just use the shell's image list, rather than copying the images into my own. First, set the list control to use shared image lists (so you don't delete the shell's list!) by setting the LVS_SHAREIMAGELISTS style. Then:
UINT uFlags = SHGFI_USEFILEATTRIBUTES|SHGFI_SYSICONINDEX|SHGFI_ICON|SHGFI_SMALLICON;
SHFILEINFO sfi;
HIMAGELIST hIL = (HIMAGELIST)::SHGetFileInfo(_T("BogusFilename.dat"),
FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), uFlags);
if ( NULL != hIL )
m_ListCtrl.SetImageList(CImageList::FromHandle(hIL), LVSIL_SMALL);
if ( NULL != sfi.hIcon )
::DestroyIcon(sfi.hIcon);
Then, just use the SHGFI_SYSICONINDEX flag in your call to SHGetFileInfo() to find the index into the shell's list of the icon you want.
Oh yeah, one more thing - make sure your program includes a manifest so that the new WinXP controls are used. Otherwise, they won't know how to handle alpha channels...
How do you move in a world of fog, That's always changing things?
Makes me wish that i could be a dog, When i see the price that you pay.
|
|
|
|
|
This is working, thank you !
But the problem is that i need to display not only system icons, but also couple of my icons, co I can't directly use system image list
rrrado
|
|
|
|
|
I'll try to duplicate and then rebuild system's image list
Seems that CImageList::Create() will always create image list with 1-bit mask, which is not enough for alpha channel
rrrado
|
|
|
|
|
Hi,
I just upgraded a portion of my code from int to __int64, everything looked fine but the only problem is that it looks like this data type could not be serialized.....
Anyone know a 64bit data type in MFC that can be serialized ?
Shay\
error C2593: 'operator <<' is ambiguous
error C2679: binary '>>' : no operator defined which takes a right-hand operand of type '__int64' (or there is no acceptable conversion)
|
|
|
|
|
It is not one of the supported data types that the CArchive class has provided overloaded operators for. So, you will need to use CArchive Write and Read methods, passing the address of the __int64 var.
onwards and upwards...
|
|
|
|
|
Thanks, but one more thing
When I use ar.Write or ar.Read, it looks for a pointer to a buffer.
It looks like when I read, it read more that needed, even though I specified 64 in the second paramter.
So....
If I need to serialize a 64 bit number using write, should it be:
ar.Write (&number,64)?
and read back:
ar.Read (&number,64);
|
|
|
|
|
first off, your __int64 variable is NOT 64 bytes long. It is 64 BITS long, which, when divided by 8 bits per byte, is 8 bytes. So, you should pass 8 for the second param ( or sizeof(__int64) ).
ar.Write(&number,8);
-- or --
ar.Write(&number,sizeof(__int64));
onwards and upwards...
|
|
|
|
|
dooooooooooouuuuuuuuuuughhhhhhhhhhh !!!!!!!!!
Thanks for pointing my stupidity, that's an excellent proof for why you should not skip lunch.
Shay
|
|
|
|
|
Try using the LARGE_INTEGER data type. Text between asterisks is text quoted directly from the MSDN documentation on the data type
***********************
LARGE_INTEGER
The LARGE_INTEGER structure is used to represent a 64-bit signed integer value.
Note Your C compiler may support 64-bit integers natively. For example, Microsoft® Visual C++® supports the __int64 sized integer type. For more information, see the documentation included with your C compiler.
typedef union union
{ struct
{ DWORD LowPart;
LONG HighPart;
}; LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
*************************************
hope this helped!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Darn. Beat me to it. I was going to suggest doing something similar and then using the standard CArchive operators on the smaller bits.
Steve S
|
|
|
|
|