|
Hi,
I want to show the progress bar as animation. Can any one give me an example to show how to use CAnimationCtrl
Thanks
|
|
|
|
|
this is the easiest control ever use,
just add an animate control on a dialog box,
add a variable of type CAnimateCtrl.
in the OnInitDialog() function call the function Open() and Play().
remember to call function Close() in ua dlg box's OnClose() function or onDestroy()
like this.
//////////////////////////
m_ctlMyAnimation.Open(_T("C:\\Windows\System32\\migwiz\\progress.avi"));
m_ctlMyAnimation.Play();
////////////////////////
remember that this avi shud be some of those simple animation files, not music video or moviz, a good example is that microsoft dog that shows up when yu are searching.
::OnButtonStop()
{
m_ctlMyAnimation.Stop();
}
::OnClose()
{
m_ctlMyAnimation.Close();
}
|
|
|
|
|
Hi,
I have used the following code
m_avi.Open(IDR_AVI1);
m_avi.Play(0,-1,-1);
but its giving debug assert at open function
whats the problem
|
|
|
|
|
Dhiraj kumar Saini wrote: whats the problem
Find out for yourself what the problem is - use the debugger to find out what assert is being called.
Alternatively, put a break point in your code and use the Step Into debug option to follow through the MFC code.
Have you tried having the avi as a file, and using Open ("myfile.avi")? Does that work?
I suspect you'll either not have the avi properly embedded as a resource, or IDR_AVI1 means different things in different places (it is only defined in resource.h?), or maybe as the wrong resource type.
Good luck,
Iain.
|
|
|
|
|
how/where is IDR_AVI1 defined? Does it contain a valid path for the AVI File
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
The problem is resolved but now i am having a new problem
I having a CMainDlg class for Parent dialog on which i am painting CVisitorDlg as a child dialog.
I have used CAnimateCtrl in CMainDlg which I want to show when a user clicks a button on CMainDlg. But during clicking this button the CVisitorDlg dialog (Child Dialog is being repainted as it is fetching data from server. But the CAnimateCtrl is showing the animated images after the child dialog is repainted and not during fetching the data.
Please tell what to do.
|
|
|
|
|
Dhiraj kumar Saini wrote:
Please tell what to do.
1/ Go on, tell us the solution! I'd like to know if one of my 4 guesses was right.
2/ If it is a new problem, then post a new question - you'll get more people reading it.
Iain.
|
|
|
|
|
And the reason for the problem getting resolved was....?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Actually the avi file was corrupt
|
|
|
|
|
are you doing all this in your main thread, then in this case it would get blocked in the process of receiving the data from the server. you should create another thread and implement some notification method to inform the UI that the data download is completed.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Yes I am doing it in the main thread. Can u tell how to make a new thread so that it works fine
|
|
|
|
|
Here[^] is an excellent article that I suggest you read. Threads can't be explained in three lines, this is a very deep subject.
|
|
|
|
|
Example[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Is there any way?
My application needs to generate a graphic that fit the paper for printing.
(DPIs of printers might varify.)
system
modified on Friday, September 5, 2008 4:53 AM
|
|
|
|
|
hi, you need a to use a standard unit to define the size of ua graphic other than using pixels e.g inches, coz if you use pixels , each printer will come with different aspect ratios of the pixel units, and you cud have a printer whose one inch long on paper , is say 100 pixels while on the screen of your computer it could have been 150 pixels making an inch of your image so you end up having a different image on paper .
this is what i advise you to do. and i give an example of making some cells and they'll print same way thy appear on screean
define 2 variables in the header file of your view call them,
int m_nCellWidth and m_nCellHeight;
Inside the Draw function of your view
put this code.
m_nCellWidth = pDC->GetDeviceCaps(LOGPIXELSX);
m_nCellHeight = pDC->GetDeviceCaps(LOGPIXELSY)/4;
what does this function do before assingning some values in your integers.
the Function GetDeviceCaps(PARAMS) is a member of pDC (screen or printer) and it returns (depending on parameters) the number of pixels of the Devise context that make up one inch of y-axis (if PARAMS are LOGPIXELSY) or x - axis (if PARAMS are LOGPIXELSX);
now you have a unit that is equivalent to a quarter of an inch on y axis (vertical axis) of any printer m_nCellHeight and another m_nCellWidth representing a an inch on x-axis.
it's not a must you divide by 4, to make a quarter inch unit for y-axis, you can still use a full inch, it's olnly that the example i want to give you requires a quarter of an inch unit.
now put this code.
//////////////////////////////////////
int nMyPageHeight = (20 * m_nCellHeight ); // about 20 cells
int nMyPageWidth = (5* m_nCellWidth); // about 5 columns
for (int i=0; i <nmypageheight i="" mode="hold">{
// draw horizantal lines from left to right
pDC->MoveTo(0,i * m_nCellHeight);
pDC->LineTo(nMyPageWidth ,i * m_nCellHeight);
}
for (int j=0; j <nmypagewidth j="" mode="hold">{
// draw vertical lines top of page to bottom
pDC->MoveTo(j *m_nCellWidth ,0);
pDC->LineTo(j *m_nCellWidth ,nMyPageHeight);
}
////////////////////////////////////////////////////
now try to print your image and see what happens.
note that the print function calls the OnDraw() function of the view class and passes pDC, pointer to the printer, so if you call this code in another function other than the draw, make sure you call the Function from the OnDraw() function and pass pDC to it, dont use CClientDC(),
|
|
|
|
|
I think if generate a graphic according to the paper size for printing,
the graphic will not be scaled.
I wrote as below. I'm not sure whether it works (no printer on hand). And it seems lack of a print pool, doesn't it? When it's printing, how to make it like MS Word?
void CFigDlg::OnBnClickedBtnPrint()
{
using namespace Gdiplus;
CPrintDialog dlg(TRUE,
PD_RETURNDC|PD_ALLPAGES|PD_USEDEVMODECOPIES|PD_NOPAGENUMS|PD_HIDEPRINTTOFILE|PD_NOSELECTION,
this);
if (dlg.DoModal()==IDOK) {
DEVMODE *pDM=dlg.GetDevMode();
HDC hDC=dlg.GetPrinterDC();
CDC dc;
dc.Attach(hDC);
int dpi_x=dc.GetDeviceCaps(LOGPIXELSX);
int dpi_y=dc.GetDeviceCaps(LOGPIXELSY);
Size size;
size.Width=INT(pDM->dmPaperWidth*dpi_x/2.54f);
size.Height=INT(pDM->dmPaperLength*dpi_y/2.54f);
if (bool(m_pFig)) {
Bitmap *pBm=m_pFig->GenBitmap(size);
Graphics g(hDC);
g.DrawImage(pBm,0,0);
delete pBm;
}
}
}
system
|
|
|
|
|
Hi
I have done a project in VC++ 6.0 and now I want to upgrade few parts in the code so I have to increase the array size and variable type in the code If I change the array size also it is not reflecting in the code As soon as I place Mouse pointer on the variable name in the code.
Please help its urgent.
Regards
Murali
|
|
|
|
|
Murali_mom wrote: Please help its urgent.
Yes sir, right away...
Murali_mom wrote: If I change the array size also it is not reflecting in the code As soon as I place Mouse pointer on the variable name
DEBUGGING[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
VC6 (maybe VB6 too...) was terrible about losing track of information about your code.
Close it down, and use Task Manager to make sure the process goes away too. Then delete the ncb file for that workspace, and run VC6 again.
It will regenerate the classes on the left pane, and hopefully also the same information is used for mousing over things.
Iain.
|
|
|
|
|
Thanks for your answer it worked
|
|
|
|
|
LPDEVMODE CPrintDialog::GetDevMode() const
{
if (m_pd.hDevMode == NULL)
return NULL;
return (LPDEVMODE)::GlobalLock(m_pd.hDevMode);
}
I search in dlgprnt.cpp, no ::GlobalUnlock(m_pd.hDevMode) .
system
|
|
|
|
|
MSDN:For movable memory objects, GlobalLock increments the count by one, and the GlobalUnlock function decrements the count by one. For each call that a process makes to GlobalLock for an object, it must eventually call GlobalUnlock.
Did you check that you link to kernel32.lib and have windows.h included?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
If I need to free the resource, I have to call ::GlobalUnlock(m_pd.hDevMode) .
I seems not so good.
And I tried not to free it, no memory leak.
I don't know which way is ok.
system
|
|
|
|
|
HI,everyone.
I have used the stream I/0 to write myOwn.exe file in the source.exe file.When the combined file is executed,it can read myOwn.exe out and create two processes to execute them(This procedure is achieved in myOwn.exe).But I think this method is a little stupid.
Do you have any other great idea to combine them to a single,in which the two .exe files can be executed by turns?
modified on Wednesday, September 17, 2008 9:57 PM
|
|
|
|
|