|
The warnings mention ways you can fix it...
You could go through and change all the source code to use the new, "safe" functions.
or
You can define _CRT_SECURE_NO_DEPRECATE to suppress the warnings:
If you're using a makefile, add
/D "_CRT_SECURE_NO_DEPRECATE"
to the compiler command line.
or
If there's a pre-compiled header file (or maybe at the top of every header file) you can add
#pragma warning(disable : 4996)
or
#define _CRT_SECURE_NO_DEPRECATE 1
to suppress the warnings.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
This does not fix the errors (first and last two lines).
|
|
|
|
|
tmp0 wrote: This does not fix the errors (first and last two lines).
Do you mean the first and last two of the errors you listed?
I don't have the makefile or the code so I can't imagine what the errors are.
If you have no support from the author then you pretty much have to dig in there and fix them
to make it compatible with the newer compiler/CRT/etc.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have a simple graph : 1st VideoCapture Source -> A simple class derived from ISampleGrabber ->
When i add ISampleGrabberFilter , ActiveMovie Windows appers automatically , i cannot give its ownership to my
main windows in MFC. I have a method called SetupVideoWindow :
void SetupVideoWindow(HWND owner)
{
this->OwnerWindow = owner;
this->VideoWindow->put_Owner((OAHWND)this->OwnerWindow);
this->VideoWindow->put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN);
this->VideoWindow->put_MessageDrain((OAHWND)owner);
this->VideoWindow->put_Visible(OATRUE);
this->VideoWindow->put_AutoShow(OAFALSE);
}
If i build and render graph then play it without adding ISampleGrabber , ActiveMovieWindow doesnt appear.
How can i solve this problem , or may i use a transform filter instead of it ?
THANK YOU VERY MUCH
|
|
|
|
|
I have a program that will connect to an FTP site with InternetConnect() if I use my Windows dialer.
If I try to connect to the FTP site using another dialer there is no connection to FTP site.
My Windows dialer has my user name and password for my ISP, but the other dialer does not, it just dials and connects.
I am confused, how can the other dialer connect without my ISP username and password? This is probably why I cannot connect to FTP site.
I can make a connection with the other dialer using HTTP settings and using a www.myspace.net address, but if I switch over to FTP settings and use ftp.myspace.net, no connection.
Please excuse me if I sound confused, I am, and I can't seem to get my brain wrapped around these concepts.
Thanks for any help.
|
|
|
|
|
frqftgbdafr wrote: I can make a connection with the other dialer using HTTP settings and using a www.myspace.net address, but if I switch over to FTP settings and use ftp.myspace.net, no connection.
Are you sure there's an FTP server available at the target site that is listening on the specified
port? It sounds like there isn't HTTP servers and FTP servers are not the same.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi all,
I have created the button in my project like this:
<br />
CBitmapButton m_mainSettings;<br />
<br />
DDX_Control(pDX, IDC_MAIN_SETTINGS, m_mainSettings);<br />
m_mainSettings.LoadBitmaps(IDB_BITMAP1);<br />
m_mainSettings.SizeToContent();<br />
All works good, except greyed frame arround bitmap.
So I need to add a transparent color for the bitmap.
Please help me to resolve the problem.
-- modified at 14:38 Sunday 17th June, 2007
|
|
|
|
|
AFAIK, CBitmapButton doesn't support transparent colors.
You could derive a class from CBitmapButton, override the DrawItem() method, and draw the bitmaps
yourself using transparency, perhaps with GDI+ or masked bitmaps. CBitmapButton uses BitBlt()
to draw the bitmaps.
An easier (IMO) approach would be to use a toolbar control. There you can use image list(s)
which will handle transparency and true-color bitmaps easily.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
How can i do features below on a video stream, with sample grabber ?
Are there any sample for this in directshow samples of MS ?
4:3
16:9
Crop
Stretch
BEST REGARDS
|
|
|
|
|
Hi,
I have created a project in MFC and had choosen Windows Explorer style during wizrd.
I was able to add new command handlers for most of the toolbar buttons. But I
cannot add/edit command handlers for Open, Save and Save As... toolbar buttons
and menu items in the project. I think they are handled autmatically by MFC somehow,
but i want to use my code insted of the default.
Can anyone please help me out?
|
|
|
|
|
Hi,
In my project,I have to draw icon over a bitmap every 250msec.
My problem is that sometimes the drawing over the bitmap is flickering
in a very annoying way.
I know that I need to draw over the bitmap using double buffering,
and looked over some articles about it,but failed to understand
how to do it.
I can't use the classes of those articles (Safety issues... ).
Can anyone help me understand how to improve my drawing technique???
I use the following piece of code:
void Frm_WkAtol::OnTimer(UINT_PTR nIDEvent)
{
m_AtolCorridorBitmap.Invalidate();
CDialog::OnTimer(nIDEvent);
}
void AtolCorridorBitmapClass::OnPaint()
{
CStatic::OnPaint();
CRect CorridorRect;
CDC *pDC = GetDC();
static int x = 0;
pDC->SetTextColor(RED_COLOR);
pDC->SetBkMode(TRANSPARENT);
GetClientRect(&CorridorRect);
szCaption.Format(_T("Test %d") , x++);
pDC->ExtTextOut(CorridorRect.left, CorridorRect.top + 30 , ETO_OPAQUE , NULL , szCaption , NULL);
DrawIcon(pDC->m_hDC, CorridorRect.left , CorridorRect.top , m_hUavInsideAtolCorridorIcon);
ReleaseDC(pDC);
}
With best regards,
Eli;P
|
|
|
|
|
How about only invalidating only the rectangle that changes, then the only bit that needs redrawing is the icon, rather than the whole bitmap. I'd consider a separate overlaid windowless control if that doesn't work. Otherwise you need to incorporate the icon directly into the bitmap data so each change only redraws that area of the screen once. Remember to catch the erase background message and tell windows not to erase or you'll get really bad flicker whatever you do.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Here's an example of a double-buffered bitmap static control class...
#pragma once
class CDblBufferedStatic : public CStatic
{
DECLARE_DYNAMIC(CDblBufferedStatic)
protected:
HBITMAP hStaticBitmap;
CSize BackBufferSize;
CDC BackBufferDC;
CBitmap BackBufferBitmap;
void InitBackBuffer();
public:
void RedrawBackBuffer();
public:
CDblBufferedStatic();
virtual ~CDblBufferedStatic();
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
};
#include "stdafx.h"
#include "MyApp.h"
#include "DblBufferedStatic.h"
#include ".\dblbufferedstatic.h"
IMPLEMENT_DYNAMIC(CDblBufferedStatic, CStatic)
CDblBufferedStatic::CDblBufferedStatic()
{
hStaticBitmap = 0;
}
CDblBufferedStatic::~CDblBufferedStatic()
{
}
BEGIN_MESSAGE_MAP(CDblBufferedStatic, CStatic)
ON_WM_PAINT()
ON_WM_ERASEBKGND()
END_MESSAGE_MAP()
void CDblBufferedStatic::InitBackBuffer()
{
hStaticBitmap = GetBitmap();
if (hStaticBitmap)
{
BITMAP bitmapstruct;
::GetObject(hStaticBitmap, sizeof(BITMAP), &bitmapstruct);
BackBufferSize.cx = bitmapstruct.bmWidth;
BackBufferSize.cy = bitmapstruct.bmHeight;
CWindowDC WindowDC(this);
BackBufferDC.CreateCompatibleDC(&WindowDC);
BackBufferBitmap.CreateCompatibleBitmap(&WindowDC, BackBufferSize.cx, BackBufferSize.cy);
<code>
BackBufferDC.SelectObject(&BackBufferBitmap);
}
}
void CDblBufferedStatic::RedrawBackBuffer()
{
if (hStaticBitmap)
{
CDC TempDC;
TempDC.CreateCompatibleDC(&BackBufferDC);
CBitmap SrcBitmap;
SrcBitmap.Attach(hStaticBitmap);
CBitmap *pOldBitmap = TempDC.SelectObject(&SrcBitmap);
BackBufferDC.BitBlt(0, 0, BackBufferSize.cx, BackBufferSize.cy, &TempDC, 0, 0, SRCCOPY);
TempDC.SelectObject(pOldBitmap);
SrcBitmap.Detach();
<code>
CRect CorridorRect;
static int x = 0;
BackBufferDC.SetTextColor(RED_COLOR);
BackBufferDC.SetBkMode(TRANSPARENT);
GetClientRect(&CorridorRect);
szCaption.Format(_T("Test %d") , x++);
BackBufferDC.ExtTextOut(CorridorRect.left, CorridorRect.top + 30 , ETO_OPAQUE , NULL , szCaption , NULL);
DrawIcon(BackBufferDC.m_hDC, CorridorRect.left , CorridorRect.top , m_hUavInsideAtolCorridorIcon);</code>
}
}
void CDblBufferedStatic::OnPaint()
{
if (hStaticBitmap == 0)
InitBackBuffer();
if (hStaticBitmap)
{
RedrawBackBuffer();
CPaintDC dc(this);
dc.BitBlt(0, 0, BackBufferSize.cx, BackBufferSize.cy, &BackBufferDC, 0, 0, SRCCOPY);
}
else
{
CStatic::OnPaint();
}
}
BOOL CDblBufferedStatic::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
If you make your m_AtolCorridorBitmap a CDblBufferedStatic object, then you can do this in
response to the timer message:
void Frm_WkAtol::OnTimer(UINT_PTR nIDEvent)
{
m_AtolCorridorBitmap.Invalidate();
m_AtolCorridorBitmap.UpdateWindow();
CDialog::OnTimer(nIDEvent);
}
This should be flicker free
Hope you can extract something useful from this!
MArk
-- modified at 11:10 Monday 18th June, 2007
*edit* removed line that was there for testing
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
I couldn't ask for a better answer.
It is working perfect.
After reading your code - it seems to be so simple...
THANK YOU VERY MUCH
With best regards,
Eli
|
|
|
|
|
Hi Mark,
Just one more question....
I'm using the http://www.codeproject.com/listctrl/ReportControl.asp[^] in order to display a list control with different
rows color and icons.
The problem is that I need to update the list every 250msec,
and guess what......the list is not flicker free...
I know that updating a list control is very expensive,
but I was wondering if I can use the double buffering technique
also for the list control(which is owner drawn).
With best regards,
Eli
|
|
|
|
|
What happens if you use WM_SETREDRAW...
m_ListCtl.SendMessage(WM_SETREDRAW, (WPARAM)FALSE, 0);
...
...do stuff with the listview contents...
...
m_ListCtl.SendMessage(WM_SETREDRAW, (WPARAM)TRUE, 0);
m_ListCtl.Invalidate();
m_ListCtl.UpdateWindow();
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
Instead of sending WM_SETREDRAW message,I'm using
m_ListCtrl.SetRedraw() and m_ListCtrl.SetRedraw(FALSE).
But still,the list control is blinking.
I thought that double buffering drawing will solve the problem,but since the control is owner drawn,I don't have
access to the drawing functions....
Maybe it is not possible???
Thanks,
Eli
|
|
|
|
|
It should be possible - You may have to do most of the drawing yourself.
In the source you linked to, the author is only providing custom colors although the framework is
there to do the drawing.
What parts flicker specifically? Is it the text on the background?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
Thanks for your patience
Mark Salsbery wrote: What parts flicker specifically? Is it the text on the background?
No,Only the background is flickering(and not allways).
I don't know if this could help,but the following function is being called
every time that the list needs to be updated(i.e every 250msec).
void Frm_WKFailureList::UpdateList(iGendevBit::BitMatrixResultListType &p_FailuresListRef)
{
iGendevBit::BitMatrixResultClass *CurrentElement;
dDbsrvNotif::notificationTextType NotifText;
COLORREF SeverityColor;
UINT uiCurrentRow = 0;
UINT uiCurrentErrorsCounter = 0;
m_FailureList.SetRedraw(FALSE);
if (p_FailuresListRef.GetElementNum() > MAX_VISIBLE_ITEM_WITH_NO_SCROLL)
{
m_FailureList.SetColumnWidth(2 , 30);
}
else
{
m_FailureList.SetColumnWidth(2 , 48);
}
uiCurrentErrorsCounter = p_FailuresListRef.GetElementNum();
p_FailuresListRef.ScanInit(bTypesCnt::FROM_TAIL);
while ((CurrentElement = p_FailuresListRef.ScanNext()) != NULL)
{
switch(CurrentElement->m_Severity)
{
case iGendevBit::SLIGHT:
SeverityColor = RGB(255 , 255 , 0);
break;
case iGendevBit::MEDIUM:
SeverityColor = RGB(255 , 255 , 0);
break;
case iGendevBit::SEVERE:
SeverityColor = RGB(255 , 0 , 0);
break;
}
dDbsrvNotif::GetNotifText(NotifText , CurrentElement->m_NotiffId);
CString szError , szTime;
szError = NotifText;
szTime = CurrentElement->m_FailureTime.GetFormattedTod(bTimeTod::HH_MM_SS);
if (m_FailureList.GetItemCount() < (uiCurrentRow + 1))
{
m_FailureList.InsertItem(uiCurrentRow , _T(""));
}
static int x = 0;
szTime.Format(_T("%d") , x++);
m_FailureList.SetItemText(uiCurrentRow , 0 , szTime);
m_FailureList.SetItemText(uiCurrentRow , 1 , szError);
CHECK_LIST_ENUM IsCheckListExist = NO_CHECK_LIST;
SetLineBkColorAndIcon(uiCurrentRow , SeverityColor , IsCheckListExist);
uiCurrentRow++;
m_bListIsEmpty = FALSE;
}
if (uiCurrentRow < m_LastErrorsCounter)
{
for (UINT uiIndex = uiCurrentRow ; uiIndex < m_LastErrorsCounter ; uiIndex++)
{
m_FailureList.DeleteItem(uiIndex);
}
}
m_FailureList.SetRedraw(TRUE);
m_LastErrorsCounter = uiCurrentRow;
}
Anyway - thanks for your help,
I really appreciate it.
With best regards,
Eli
|
|
|
|
|
Hi.
I want to change some of the display properties of a computer through code.
I want to change the properties which appears on
Right click on desktop-->Properties-->Appearance Tab-->‘Effects..’ button on right bottom corner.
In that I want to uncheck all the options except ‘Show window contexts while dragging’ option.
How can I achieve this through code?
Sameer Thakur
|
|
|
|
|
Use the SystemParametersInfo API function.
|
|
|
|
|
Hi Rechi.
Thanks for reply.
I searched SystemParametersInfo() function in MSDN. I saw all the parameters which one can either access or change through that function.
But unfortunately I did not find the parameter which will help me to change the properties that I want to change.
Sameer Thakur
|
|
|
|
|
hi
how I can send numbers to play with speakers???
for example I have a an array of numbers same as:
123
2324
546
97
-65
and then I want send these numbers to sound card and then I heard sounds from
speakers.
|
|
|
|
|
Do you want to send them as DTMF tones like on a touch-tone telephone?
You can use the site http://www.dialabc.com/sound/generate/ to create an audio file containing the DTMF tone for each digit. Once you have that, all you have to do is play them in the correct sequence using PlaySound(), DirectSound, OpenAL, or your chosen sound output API.
|
|
|
|
|
Say, I have thread A and thread B, with one mutex M.
A currently owns mutex M. B is waiting on mutex M.
A then releases mutex M, and tries to reacquire it right away:
ReleaseMutex(M);
WaitForSingleObject(M, INFINITE);
Who gets the mutex? A or B?
|
|
|
|
|