I got rid of AVISaveOptions (with much pain) by using the debugger and finding out the values of the AVICOMPRESSOPTIONS structure after the dialog returned, and then hardwiring those values. It may be the case that you have to set lpParms with the result of a GlobalAlloc (as opposed to just pointing it to a static long somewhere), because I tried that and it didn't work (but I may have done something else wrong then). I've put in microsoft video 1 and cinepak as two examples. I've only tried this on one machine so far. ...from (variation of) writeavi.c //turn on or off popup int DoPopupSelection = 0; _fmemset(&opts, 0, sizeof(opts)); if(DoPopupSelection) { //old path, using dialog if (!AVISaveOptions(topParent, 0, 1, &ps, (LPAVICOMPRESSOPTIONS FAR *) &aopts)) { toglErr("toglSimpleAvi::open()\n" "error getting save options"); toglErr("user message, error opening avi file " "(error on save options)"); Cleanup(); if(topParent != NULL) { DestroyWindow(topParent); } return 1; } } else { //new path, using hardwired values //this is microsoft video 1 compression opts.fccHandler = 0x6376736d; opts.dwQuality = 10000; //100% quality, 9000 would be 90%, etc. opts.dwFlags = 8; opts.lpParms = (LPVOID *)GlobalAlloc(NULL, 4); opts.cbParms = 4; *((long*)opts.lpParms) = 75; //this is cinepak opts.fccHandler = 0x64697663; opts.dwQuality = 10000; //100% quality, 9000 would be 90%, etc. opts.dwFlags = 8; opts.lpParms = (LPVOID *)GlobalAlloc(NULL, 4); opts.cbParms = 4; *((long*)opts.lpParms) = 0x726c6f63; //uncompressed is all 0's I believe, (so just let ride //from _fmemset(&opts, 0, sizeof(opts)); } hr = AVIMakeCompressedStream(&psCompressed, ps, &opts, NULL); if (hr != AVIERR_OK) { toglErr("toglSimpleAvi::open()\n" "error creating compressed stream"); toglErr("user message, error opening avi file " "(couldn't create compressed stream)"); Cleanup(); return 1; } ...Submitted By: Jeff Mauldin (2002/01/18)
case that you have to set lpParms with the result of a GlobalAlloc (as opposed to just pointing it to a static long somewhere), because I tried that and it didn't work (but I may have done something else wrong then). I've put in microsoft video 1 and cinepak as two examples. I've only tried this on one machine so far. ...from (variation of) writeavi.c //turn on or off popup
int DoPopupSelection = 0; _fmemset(&opts, 0, sizeof(opts)); if(DoPopupSelection) {
//old path, using dialog
if (!AVISaveOptions(topParent, 0, 1, &ps,
(LPAVICOMPRESSOPTIONS FAR *) &aopts)) {
toglErr("toglSimpleAvi::open()\n"
"error getting save options");
toglErr("user message, error opening avi file "
"(error on save options)");
Cleanup();
if(topParent != NULL) { DestroyWindow(topParent); }
return 1;
}
} else {
//new path, using hardwired values //this is microsoft video 1 compression
opts.fccHandler = 0x6376736d;
opts.dwQuality = 10000; //100% quality, 9000 would be 90%, etc.
opts.dwFlags = 8;
opts.lpParms = (LPVOID *)GlobalAlloc(NULL, 4);
opts.cbParms = 4;
*((long*)opts.lpParms) = 75; //this is cinepak
opts.fccHandler = 0x64697663;
opts.dwQuality = 10000; //100% quality, 9000 would be 90%, etc.
opts.dwFlags = 8;
opts.lpParms = (LPVOID *)GlobalAlloc(NULL, 4);
opts.cbParms = 4;
*((long*)opts.lpParms) = 0x726c6f63; //uncompressed is all 0's I believe, (so just let ride
//from _fmemset(&opts, 0, sizeof(opts));
} hr = AVIMakeCompressedStream(&psCompressed, ps, &opts, NULL);
if (hr != AVIERR_OK) {
toglErr("toglSimpleAvi::open()\n"
"error creating compressed stream");
toglErr("user message, error opening avi file "
"(couldn't create compressed stream)");
Cleanup();
return 1;
} ...Submitted By: Jeff Mauldin (2002/01/18)
对lpParams的赋值仍然不是很清楚