|
Hello Friends
I am using drawImage from GDIPLUS in OnPaint().And Mine image is getting flickered too much.How can i reduce it?
Thanks & Regards
Yogesh
|
|
|
|
|
You may use double buffering technique. Have a look at (one of) the following CodeProject articles:
http://www.codeproject.com/info/search.aspx?artkw=double+buffering&sbo=kw[^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
+1 for using the CP search instead of google!
Watched code never compiles.
|
|
|
|
|
Thanks.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
in addition, handle WM_ERASEBACKGROUND message and simply return TRUE from there without calling base class's message handler. This will discard the flickering due to background painting. Remember, you have to paint the background from OnPaint (use double buffering )
modified on Thursday, March 24, 2011 9:13 AM
|
|
|
|
|
Hi
Also create a memory DC and select this image to this DC. And use this DC as the Source in API BitBlt, StretchBitBlt etc.
Hope this helps
Nitheesh George
http://www.simpletools.co.in
|
|
|
|
|
this method works very well for drawing at high rates
|
|
|
|
|
The first step (before investigating possible solutions, such as double buffering) is to figure out why the flicking is occuring. Can you provide any more details? When does it flicker? Does the image resize if the window size is altered? Are you using the CS_HREDRAW and CS_VREDRAW[^] class styles?
Steve
|
|
|
|
|
hi,Its Flickering whenever some update happen like if i zoom,scroll etc.
It looks like tht OnPaint is calling and that is makeing flickering bcoz onpaint m using drawimage().
Regards
Yogesh
|
|
|
|
|
I am trying to insert a variable in a SQL string but am not having any success in finding the proper sytax. I am coding in C++. Listed below is code section I am trying to figure out. This code is part of an ADO routine that adds a field in an Access Database.
char Value[40];
printf("Input A String");
scanf("%s",Value);
sSQLCommand = L"ALTER TABLE TableIn ADD @Value nvarchar(20)";
com->CommandText = sSQLCommand;
Unfortunately what gets added to the database as a field is @Value.
|
|
|
|
|
wchar_t sqlCommand[1024];
wsprintf(sqlCommand, L"ALTER TABLE TableIn ADD %s nvarchar(20)", Value);
|
|
|
|
|
Superman,
Excellent! You pointed me in the right direction. After some modifications, the following code works:
char sSQLCommand[100];
char TempField[50];
printf("Input Field");
scanf("%s",TempField);
sprintf_s(sSQLCommand,"ALTER TABLE TableIn ADD %s nvarchar(20)",TempField);
|
|
|
|
|
Next, read about SQL injection[^] to understand why code like that is dangerous.
|
|
|
|
|
You should avoid this coding style as it may lead to some serious problems. Google SQL Injection, you yourself will understand.
|
|
|
|
|
I need an existing linkable chat control for client/server communication, which is readonly and text-only.
When users say something, chat contents are added to the control.
Texts displayed on the control have multiple types of links, such as user-name, comments, advertisements and something else. If clicking on those links, related events or messages are submitted to the control's parent or itself, so that I can show further info by types of those links, i.e. show pop-up menu or show some windows.
Thanks
BTW: or any idea to develop the control easily?
|
|
|
|
|
|
Hi, dear all,
I am creating a MFC DLL utility program that will be used by client application through exported functions in DLL.
Now I have to problem about how to create a modeless dialog in MFC dll. I searched some examples about creating modeless dialog in MFC exe application. Usually they create a dialog pointer in View class and initialize it as:
m_pDlg = new CMymfc9Dialog(this);
But my program is MFC DLL, there is no CView class, how can I initialize the m_pDlg? what argument should I pass to it?
Thanks!
|
|
|
|
|
You can simply pass NULL to CDialog constructor as parent window. In this case, MFC searches a proper one. If it doesn't find any, dialog's parent window is set to the main application window.
You also don't have to use above constructor for modeless dialog boxes. You can use default constructor then you can specify parent window later by Create() function.
m_pDlg = new CMymfc9Dialog();
m_pDlg->Create(IDD_MYMFC9DIALOG, NULL);
m_pDlg->ShowWindow(SW_SHOW);
|
|
|
|
|
Thanks!
Now I use pMatTable = new CMatTable(this->m_pMainWnd); pass main window as parent window, it works now.
|
|
|
|
|
In your DLL, put this function:
void MyDLLClass::ShowDialog(CWnd *pWnd)
{
m_pDlg = new CMymfc9Dialog(pWnd);
} In your app, call the ShowDialog() function.
|
|
|
|
|
|
Hi,
From your posting, I think that you wanted to a dialog box which is added a resource in your MFC dll. If I am right, It is a matter of simple. Please see the sample below.
extern "C" __declspec(dllexport) showMyDialog(CWnd *parent)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
CDialog *myDialog = new CDialog(IDD_DIALOG1, parent);
myDialog->ShowWindow(SW_NORMAL);
}
Make sure that you release the allocated memory in WM_NCDESTROY message handler code.
Then about the code. There is a problem when we want to show a dialog from an MFC DLL. The MFC will using main application resource handle to find the specified resource. If you not specify the AFX_MANAGE_STATE(AfxGetStaticModuleState( )); at the begginig of the exported function, the MFC framework will try to find the resource in main application's resource. If the specified resource not found, then the showWindow fails and if found, MFC will try to load that resource may causing an unexpected behaviour. For more infomation see the MSDN documentation of AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
Hope this helps
Thanks
Nitheesh George
Nitheesh George
http://www.simpletools.co.in
|
|
|
|
|
Thanks for reminding me, I do get application crash since I didn't use AFX_MANAGE_STATE(AfxGetStaticModuleState()) at first.
|
|
|
|
|
Hello everyone
I have a graduation project and
I need to know how to convert an image (black & white) to a file (zero & one) in the VC++
and OpenCv ?
Or in other words how can Read image as a File ??
Can anyone help me :/
|
|
|
|
|
You really need to give more input than that. What is the format of your 'image'? Is that a HBITMAP, or some other data structure? What format should the output file have? Raw/jpg/bmp/gif?
Shatha88 wrote: Can anyone help me :/
Probably not, as it is right now.
|
|
|
|