|
hi guys,
DO anyone know what is the reason that i can only play avi file which is original in Microsoft, but when i import a avi format from external i cannot play it..
How can i play my avi in animation control by displaying it full on the screen?
Pls advice, am using VC++ 2003 MFC.
Thanks ..
|
|
|
|
|
I think Animation Controls [^] will be helpful for you and also it has description of this control
|
|
|
|
|
Hi
thanks white sky..dun get what u mean.
The avi file i play can't be display full on the animation control box.
SOme avi file cannot even display on the animation control
Pls advice..
Thanks !!
|
|
|
|
|
I said before use of MCI functions but you said I can't you them Animation control can show avi file that are standard
|
|
|
|
|
I also said before you'll probably need to use some other method (Windows multimedia, for example)
to get the flexibility you need. An animation control isn't going to do it.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi guys,
How do u write using MCI to open and open a avi file??
do i need to specify any box etc animation ctrl box??
Tks
|
|
|
|
|
You can play the AVI to a window - Playing a Device[^]
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi guys,
I have tried to add a bitmap on my picture control using the add resource method.
this is the code that i place on my button the display the bitmap.
void CPictureDlg::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
CBitmap Bmp;
Bmp.LoadBitmap(IDB_BITMAP1);
m_pic.SetBitmap(Bmp);
}
However no picture was display on the picture control please advice..
Thanks in advance.
|
|
|
|
|
Who is actually drawing the picture?
How does it know the picture has changed?
Try invalidating the window (or button) that is supposed to display the picture.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hi,
There is no drawing of picture involved,just one click on the button to display the bitmap.
However seem like the my source code is not working..
Pls advice.
|
|
|
|
|
Set Bitmap to true on the property window of Button and use of global CBitmap,now what happens?
|
|
|
|
|
Hi all:
Say:
char *string = NULL, *buffer = NULL;
int string_len = 0;
fgets(buffer);
string_len = strlen(buffer);
buffer[string_len] = '\0';
string = malloc(string_len+1);
strncpy(string, buffer, string_len);
return string;
Is my codes correct?
Thank you
|
|
|
|
|
Its been a while since if coded in C, but did you allocate memory for buffer?
You should free the memory allocated for string as well.
|
|
|
|
|
That is what confuses me, David.
This is what I thought:
I have to put the string I read into somewhere (e.g. into a buffer) before I can use strlen() to get the length of the string.
Is there another way to accomplish this task? E.g. how do I know the length of the string I read before I put it to a buffer?
Thanks
|
|
|
|
|
But where do you allocate memory for *buffer?
What about this:
char* buffer = new char[10];
gets(buffer);
char* st=buffer;
printf("%s %s",st,buffer);
delete buffer;
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Hi VuNic:
Thank you for your reply.
I am still wondering if there is a way for me somehow get the length of the word I will read without declaring a pointer (buffer) which points to a char array of certain length?
Thank you
|
|
|
|
|
Are you supposed to stick to "C" ? or you have the option of using std::string s?
why not use them? or you need to go for linked lists. like :
typedef struct stringz
{
char c;
struct stringz* next;
}st;
st* str =(st*)malloc(sizeof(stringz));
st* head = str;
char c;
while(c=getch())
{
if(c==13)
break;
str->c=c;
printf("%c",str->c);
str->next=(st*)malloc(sizeof(stringz));
str=str->next;
}
str->next=NULL;
str =head;
while(str->next!=NULL)
{
printf("%c",str->c);
str=str->next;
}
purely dynamic , hey but never mess up trying your own stringz!. If allowed, I suggest you go with std::string.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
|
Uhmmm – No!
To use standard C functions – you need to provide the size of the buffer. C does not create or expand buffers for you – you have to request them manually. Normally you can get away with allocating a buffer that is as large as or larger than you expect to need and just make the call one time.
Off the top of my head, if you need something that resembles dynamic allocation in C:
typedef struct st_MyStringBuffer
{
size_t length;
char* buffer;
} MyStringBuffer;
int MyBuffer_Init(MyStringBuffer* pMine)
{
if( pMine )
{
memset(pMine, 0, sizeof(MyStringBuffer));
return(1);
}
return(0);
}
void MyBuffer_Free(MyStringBuffer* pMine)
{
if( pMine )
{
free(pMine->buffer);
MyBuffer_Init(pMine);
}
}
char* MyBuffer_AddString(MyStringBuffer* pMine, const char* pStr)
{
size_t len;
if( !pMine || !pStr )
return(NULL);
len = strlen(pStr) + 1;
if( !pMine->buffer )
{
pMine->buffer = malloc(len);
if( !pMine->buffer )
return(NULL);
pMine->buffer[0] = '\0';
pMine->length = len;
}
else
{
len += pMine->length;
if( !realloc(pMine->buffer, len) )
return(NULL);
pMine->length = len;
}
return strcat(pMine->buffer, pStr);
}
char* YourFunction()
{
char temp_buffer[256];
MyStringBuffer my_string_buffer;
MyBuffer_Init(my_string_buffer);
while( fgets(temp_buffer, 256, file_ptr) )
{
if( !MyBuffer_AddString(my_string_buffer, temp_buffer) )
{
MyBuffer_Free(my_string_buffer);
break;
}
}
return( my_string_buffer->buffer );
}
Well that was fun! Of course you could eliminate MyStringBuffer and just do esentially the same thing it does in your function. The advantage of a method like this is that now you can reuse MyStringBuffer any where you need to use that functionality, without having to rewrite it each time.
Any way I did not test the code, so I do not know if it works as expected.
Study the code and try to figure out what it is doing and why.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
|
Hi:
I wanted to read whatever I receive from stdin to stdout and quit the program. Below is my function:
while(scanf("%s", buffer) != EOF) {
for (i = 0; i < strlen(buffer); i++) {
buffer[i] = tolower(buffer[i]);
}
printf("%s ", buffer);
}
The function actually keeps looping forever. It does echo whatever from stdin to stdout, but it does not quit after one go. I am wondering why?
Thank you.
|
|
|
|
|
Question withdrawn. I have found a solution.
|
|
|
|
|
C_Zealot wrote: I have found a solution
what was it?
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Hi:
Simply another approach,
I wrote:
gets(buffer); /*Read a string into the buffer*/
for (i = 0; i < strlen(buffer); i++) { /*Convert each char in the string to its low case*/
buffer[i] = tolower(buffer[i]);
}
printf("%s", buffer); /*Print it at once*/
It can be confusing because whoever reads this can not access my whole program.
But my problem was solved.
Thanks
|
|
|
|
|
Not sure why noone has mentioned it yet, but if you have it, strlwr(...) is likely a faster/better way to lowercase the string in buffer .
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|