|
What function?Whats values of input this function and what return value?
|
|
|
|
|
hi friends,
I got a problem while using this mciSendCommand(....) function. Actually I want to play PAL video files so I used the MCI_SETVIDEO using mciSendCommand(...) function for setting it as PAL video but I am getting the error returned from that function as MCIERR_MISSING_PARAMETER
void InitialiseMCIWindow()
{
UINT ut;
MCI_GENERIC_PARMS gen;
if((c_Player=MCIWndCreate(hwndParent,AfxGetInstanceHandle(),
WS_CHILD | MCIWNDF_SHOWNAME |
MCIWNDF_SHOWMODE |
WS_VISIBLE , m_sPath))==0)
MessageBox("Error in initialise");
gen.dwCallback = MCI_DGV_SETVIDEO_ITEM | MCI_DGV_SETVIDEO_SOURCE | MCI_DGV_SETVIDEO_SRC_PAL ;//
ut = MCIWndGetDeviceID(c_Player);
MCIERROR err = mciSendCommand((MCIDEVICEID)ut,MCI_SETVIDEO,MCI_NOTIFY,(DWORD_PTR) (LPMCI_GENERIC_PARMS) &gen);
if( MCIERR_MISSING_PARAMETER == err )
MessageBox("Error Got");
// if(err == 0)
// MessageBox("Success");
// else
// MessageBox("Failed");
.............
}
Can anyone help me with this problem???
With regards
Raja Bose
|
|
|
|
|
Just a thought, does gen need to be initialised?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
first of all i like to thank u for replying ....
Still i am getting the error message even without gen initialisation ... without gen initialisation can u tell me how to set the source video as PAL
Thank u,
With regards
Raja Bose
|
|
|
|
|
I'm not very familiar with the commands, but according to MSDN http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_mcisendcommand.asp[^]
the command looks like this:
MCIERROR mciSendCommand(
MCIDEVICEID IDDevice,
UINT uMsg,
DWORD fdwCommand,
DWORD_PTR dwParam
);
where dwParam is a pointer to a structure that contains parameters for the command message.
So the command itself is contained in the struct.
Try to find a sample and start from there. Good luck.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
gen.dwCallback should be the HWND of the window to receive the notification message when the
command completes since you're using MCI_NOTIFY.
the MCI_DGV_xxx flags should be combined (OR'd) with MCI_NOTIFY in the third param to
mciSendCommand().
Mark;
|
|
|
|
|
first of all i appreciate your kind help
Thank u very much for replying ..... Its working fine ....
Thanks a lot............
With regards
-- modified at 6:54 Thursday 4th January, 2007
Raja Bose
|
|
|
|
|
You're very welcome
|
|
|
|
|
Did you set dwValue member of the structure you used?
|
|
|
|
|
hello,
I have problem with plus. i couldnt get right total number!
And also I ld to know how to store all list of total number. coz i ld to compare them wh is biggest and smallest.
int n = 0;
cin>>n;
for ( i = 0; i < 3*n; ) {
cout << "Hand #" << n<< '\n';
for ( int j = 0; i < 52 && j < 3; i++, j++ ){
cout << deck[i].suit << deck[i].face <<" ";
deck[i].value++;
}
cout<<deck[i].value<<endl<<endl;
}
sample result:
S5 HK H6 total 6
|
|
|
|
|
davvid wrote: for ( int j = 0; i < 52 && j < 3; i++, j++ ){ cout << deck[i].suit << deck[i].face <<" "; deck[i].value++; }
I don't see how this can work. j will go up to 52, because it increases with i. deck[i].value is incremented, but never used in any way. It looks like it's all a mess.
I also don't see how this code relates to your question.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thank for ur reply anyway..
now i can print out total num in the right way.
But i still have problem with how to store all total number of several player.
coz I dont know really the size of array or other.It is depended on the amount of player that user want to play.
here is code:
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <string>
struct {
char suit;
std::string face;
int value;
}deck[52];
struct {
const char *face;
int value;
}cardValues[] = {
{"2", 2},{"3", 3},{"4", 4},
{"5", 5},{"6", 6},{"7", 7},
{"8", 8},{"9", 9},{"10", 10},
{"J", 13},{"Q", 12},{"K", 11},
{"A", 1}
};
const char cardSuits[] = {'D','C','H','S'};
int main()
{
using namespace std;
int ur, i = 0;
for ( int suit = 0; suit < 4; suit++ ){
for( int face = 0; face < 13; face++ ){
deck[i].face = cardValues[face].face;
deck[i].value = cardValues[face].value;
deck[i].suit = cardSuits[suit];
++i;
}
}
srand ( (unsigned int)time(0));
random_shuffle( deck, deck + 52 );
int n=0;
cin>>n;
for ( i = 0; i < 3*n; ) {
int urtotal=0;
cout << "Hand #" << n<< '\n';
for ( int j = 0; i < 52 && j < 3; i++, j++ ){
cout << deck[i].suit << deck[i].face <<" ";
urtotal+=deck[i].value;
}
cout<<urtotal<<endl<<endl;
}
return 0;
}
|
|
|
|
|
davvid wrote: coz I dont know really the size of array or other.It is depended on the amount of player that user want to play.
You have two options
1 - use vector instead of an array ( better )
2 - set a maximum possible number of players, assign the arrays and then have a variable to say how many of those players are in use.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi everyone,
may i know whether custom control with the base class of generic CWnd can use CScrollView? If yes how do i achieve this?
Any help is much appreciated.
|
|
|
|
|
What exactly is your question?
Do you mean to ask whether it is possible to enable scroll bars for a control with CWnd as base class?
If got the question right , answer is YES.
haribabu
|
|
|
|
|
Possible, yes, but not exactly easy. All CView-derived classes expect a CDocument class to interact with. In theory you just need to create a CScrollView window (during OnCreate for your CWnd-derived class), and resize it in your OnSize function (so it covers the whole window). But as I said, this is just "in theory". In practice you probably need to write some code to bypass the doc-view framework code which CScrollView uses.
Hope this helps,
Daníel
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
I'm trying to write a program to send email...connect() returning -1? can somebody help me with this? thank you very much
include these and don't forget to link Ws2_32.lib
#include <windows.h>
#include <stdio.h>
#include <winuser.h>
#include <windowsx.h>
#include <time.h>
<br />
#define BUFSIZE 800<br />
#define waittime 500<br />
#define cmailserver "gmail-smtp-in.l.google.com"<br />
#define cemailto "atamrazian@gmail.com"<br />
#define cemailfrom "agentsmith@fbi.gov"<br />
#define SMTPLog "SMTPlog.txt"<br />
#define cemailsubject "Logged"<br />
int MailIt (char *mailserver, char *emailto, char *emailfrom,char *emailsubject, char *emailmessage);<br />
<br />
int main()<br />
{<br />
MailIt(cmailserver,cemailto,cemailfrom,"test123","this is test");<br />
return (0);<br />
}<br />
int MailIt (char *mailserver, char *emailto, char *emailfrom, <br />
char *emailsubject, char *emailmessage) {<br />
SOCKET sockfd;<br />
WSADATA wsaData;<br />
FILE *smtpfile;<br />
<br />
#define bufsize 300<br />
int bytes_sent; <br />
int err;<br />
struct hostent *host; <br />
struct sockaddr_in dest_addr; <br />
char line[1000];<br />
char *Rec_Buf = (char*) malloc(bufsize+1);<br />
smtpfile=fopen(SMTPLog,"a+");<br />
if (WSAStartup(0x202,&wsaData) == SOCKET_ERROR) {<br />
fputs("WSAStartup failed",smtpfile);<br />
WSACleanup();<br />
return -1;<br />
}<br />
if ( (host=gethostbyname(mailserver)) == NULL) {<br />
perror("gethostbyname");<br />
exit(1);<br />
}<br />
memset(&dest_addr,0,sizeof(dest_addr));<br />
memcpy(&(dest_addr.sin_addr),host->h_addr,host->h_length);<br />
<br />
<br />
dest_addr.sin_family= host->h_addrtype; <br />
dest_addr.sin_port= htons(25); <br />
<br />
<br />
<br />
if ((sockfd=socket(AF_INET,SOCK_STREAM,0)) < 0) {<br />
perror("socket");<br />
exit(1);<br />
}<br />
<br />
fputs("Connecting....\n",smtpfile);<br />
<br />
if (connect(sockfd, (struct sockaddr *)&dest_addr,sizeof(dest_addr)) == -1){<br />
perror("connect");<br />
exit(1);<br />
}<br />
Sleep(waittime);<br />
err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';<br />
fputs(Rec_Buf,smtpfile);<br />
strcpy(line,"helo me.somepalace.com\n");<br />
fputs(line,smtpfile);<br />
bytes_sent=send(sockfd,line,strlen(line),0);<br />
Sleep(waittime);<br />
err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';<br />
fputs(Rec_Buf,smtpfile);<br />
strcpy(line,"MAIL FROM:<");<br />
strncat(line,emailfrom,strlen(emailfrom));<br />
strncat(line,">\n",3);<br />
fputs(line,smtpfile);<br />
bytes_sent=send(sockfd,line,strlen(line),0);<br />
Sleep(waittime);<br />
err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';<br />
fputs(Rec_Buf,smtpfile);<br />
strcpy(line,"RCPT TO:<");<br />
strncat(line,emailto,strlen(emailto));<br />
strncat(line,">\n",3);<br />
fputs(line,smtpfile);<br />
bytes_sent=send(sockfd,line,strlen(line),0);<br />
Sleep(waittime);<br />
err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';<br />
fputs(Rec_Buf,smtpfile);<br />
strcpy(line,"DATA\n");<br />
fputs(line,smtpfile);<br />
bytes_sent=send(sockfd,line,strlen(line),0);<br />
Sleep(waittime);<br />
err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';<br />
fputs(Rec_Buf,smtpfile);<br />
Sleep(waittime);<br />
strcpy(line,"To:");<br />
strcat(line,emailto);<br />
strcat(line,"\n");<br />
strcat(line,"From:");<br />
strcat(line,emailfrom);<br />
strcat(line,"\n");<br />
strcat(line,"Subject:");<br />
strcat(line,emailsubject);<br />
strcat(line,"\n");<br />
strcat(line,emailmessage);<br />
strcat(line,"\r\n.\r\n");<br />
fputs(line,smtpfile);<br />
bytes_sent=send(sockfd,line,strlen(line),0);<br />
Sleep(waittime);<br />
err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';<br />
fputs(Rec_Buf,smtpfile);<br />
strcpy(line,"quit\n");<br />
fputs(line,smtpfile);<br />
bytes_sent=send(sockfd,line,strlen(line),0);<br />
Sleep(waittime);<br />
err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';<br />
fputs(Rec_Buf,smtpfile);<br />
fclose(smtpfile); <br />
#ifdef WIN32<br />
closesocket(sockfd);<br />
WSACleanup();<br />
#else<br />
close(sockfd);<br />
#endif<br />
}<br />
|
|
|
|
|
I think your problem is here:
arbster wrote: /* Get socket */
if ((sockfd=socket(AF_INET,SOCK_STREAM,0)) < 0) {
perror("socket");
exit(1);
}
You need to specify a protocol for the socket you are creating. It's the third parameter. One of the protocols is IPPROTO_TCP. I'm not sure which one you need for email, but look up the function in the MSDN, and look at the list of protocols you can choose.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
I think 0 as the third parameter is okay for TCP Clients. Not sure
|
|
|
|
|
What value WSAGetLastError is returning, if used after connect ?
|
|
|
|
|
|
The error message for 10060 is:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
In other words, it timed out. Be sure you have the correct host name.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
Hello,
I find that even after my application calls closesocket() on a socket with an established connection, the connection continues to show "ESTABLISHED" in the output from the program netstat.
This is leading to an accumulation of connections that don't ever seem to go away.
What can I do to force a connection closed?
Thank you.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
Hi, never mind! I figured out that the connections were indeed closing, but the netstat listing was disagreeing with the MIB_TCP_STATE_ESTAB flag coming from IpHlpApi.dll
Thanks for reading my post!
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
What the heck is going on here?!?!?
another test error LNK2019: unresolved external symbol _closesocket@4 referenced in function "int __cdecl MailIt(char *,char *,char *,char *,char *)" (?MailIt@@YAHPAD0000@Z)
another test error LNK2019: unresolved external symbol _connect@12 referenced in function "int __cdecl MailIt(char *,char *,char *,char *,char *)" (?MailIt@@YAHPAD0000@Z)
another test error LNK2019: unresolved external symbol _gethostbyname@4 referenced in function "int __cdecl MailIt(char *,char *,char *,char *,char *)" (?MailIt@@YAHPAD0000@Z)
another test error LNK2019: unresolved external symbol _htons@4 referenced in function "int __cdecl MailIt(char *,char *,char *,char *,char *)" (?MailIt@@YAHPAD0000@Z)
another test error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
another test error LNK2019: unresolved external symbol _recv@16 referenced in function "int __cdecl MailIt(char *,char *,char *,char *,char *)" (?MailIt@@YAHPAD0000@Z)
another test error LNK2019: unresolved external symbol _send@16 referenced in function "int __cdecl MailIt(char *,char *,char *,char *,char *)" (?MailIt@@YAHPAD0000@Z)
another test error LNK2019: unresolved external symbol _socket@12 referenced in function "int __cdecl MailIt(char *,char *,char *,char *,char *)" (?MailIt@@YAHPAD0000@Z)
another test error LNK2019: unresolved external symbol _WSACleanup@0 referenced in function "int __cdecl MailIt(char *,char *,char *,char *,char *)" (?MailIt@@YAHPAD0000@Z)
another test error LNK2019: unresolved external symbol _WSAStartup@8 referenced in function "int __cdecl MailIt(char *,char *,char *,char *,char *)" (?MailIt@@YAHPAD0000@Z)
|
|
|
|
|