|
|
Hi,All,I am developing an ACTIVEX control embedded in IE, which is used to display continuous jpegs captured from a server.Firstly I wrote my ACTIVEX control in MFC,and call InvalidateControl() to realize control window redraw.It is ok.Then I rewrote my ACTIVEX in ATL,most of the code regards to grapic are same,but this time since InvalidateControl() can not be called in ATL based control, I call FireViewChange() to realize control window redraw time by time.However,I found that the control window got flicker when it is redraw.What happened and how to deal with?
please contact:
max_xiayi@hotmail.com
|
|
|
|
|
Hi
I have made one DCOM application which runs successfully but at the end it hangs out and doesn't gets closed in normal way...Any help or any idea...
All statements are getting executed very well in sequences...but at the end it is not returning as it should return at the point of call.
I used this small DCOM application in my VB application. At the point where I call this DCOM it runs well and does all the task that I want it to do. It's control also goes at the last line i.e "return S_OK" but then it hangs out.
Any one have any idea plz..my whole code is written here...
-----------------------------------------------------------
STDMETHODIMP CDConv::vAiConvert(VARIANT vTrace, VARIANT vDevID, VARIANT vInFileName, VARIANT vOutFileName, VARIANT vCOpt, VARIANT vSOpt, VARIANT vPrefix, VARIANT vFileTitle, VARIANT vTimeDelta, VARIANT vFlag, VARIANT *vReturnValue, VARIANT *vRetValue)
{
// TODO: Add your implementation code here
int iTrace = 0;
int iTimeDelta = 0;
char *sDevID = new char[1024];
char *sInFileName = new char[1024];
char *sOutFileName = new char[1024];
char* sDstFile = new char[_MAX_PATH + _MAX_FNAME];
char *sCOpt = new char[1024];
char *sSOpt = new char[1024];
char *sPrefix = new char[1024];
char *sFileTitle = new char[1024];
long fp = 0;
BOOL bFlag = true;
FILE *fd;
fd = fopen("C:\\AiDebug.txt","a+");
//setvbuf( fd, NULL, _IONBF, 0 );
fprintf(fd,"========================================================================================================================\n\n");
try
{
bFlag = vFlag.boolVal;
fprintf(fd,"try...bFlag = %d",bFlag);
}
catch(...)
{
bFlag = true;
}
try
{
iTrace = vTrace.intVal;
fprintf(fd,"try...iTrace = %d\n",iTrace);
}
catch(...)
{
iTrace = 0;
fprintf(fd,"catch...iTrace = %d\n",iTrace);
}
try
{
strcpy(sDevID, (char*)(_bstr_t)vDevID.bstrVal); // pa@aileron.ws
fprintf(fd,"try...sDevID = %s\n",sDevID);
}
catch(...)
{
strcpy(sDevID,"");
fprintf(fd,"catch...sDevID is empty\n",sDevID);
}
try
{
strcpy(sInFileName, (char*)(_bstr_t)vInFileName.bstrVal);
fprintf(fd,"try...sInFileName = %s\n",sInFileName);
}
catch(...)
{
strcpy(sInFileName,"");
fprintf(fd,"catch...sInFileName = %s\n",sInFileName);
}
try
{
strcpy(sOutFileName, (char*)(_bstr_t)vOutFileName.bstrVal);
fprintf(fd,"try...sOutFileName = %s\n",sOutFileName);
}
catch(...)
{
strcpy(sOutFileName,"");
fprintf(fd,"catch...sOutFileName = %s\n",sOutFileName);
}
try
{
strcpy(sCOpt, (char*)(_bstr_t)vCOpt.bstrVal);
fprintf(fd,"try...sCOpt = %s\n",sCOpt);
}
catch(...)
{
strcpy(sCOpt,"");
fprintf(fd,"catch...sCOpt = %s\n",sCOpt);
}
try
{
strcpy(sSOpt, (char*)(_bstr_t)vSOpt.bstrVal);
fprintf(fd,"try...sSOpt = %s\n",sSOpt);
}
catch(...)
{
strcpy(sSOpt,"");
fprintf(fd,"catch...sSOpt = %s\n",sSOpt);
}
try
{
strcpy(sPrefix, (char*)(_bstr_t)vPrefix.bstrVal);
fprintf(fd,"try...sPrefix = %s\n",sPrefix);
}
catch(...)
{
strcpy(sPrefix,"");
fprintf(fd,"catch...sPrefix = %s\n",sPrefix);
}
try
{
strcpy(sFileTitle, (char*)(_bstr_t)vFileTitle.bstrVal);
fprintf(fd,"try...sFileTitle = %s\n",sFileTitle);
}
catch(...)
{
strcpy(sFileTitle,"");
fprintf(fd,"try...sFileTitle = %s\n",sFileTitle);
}
try
{
iTimeDelta = vTimeDelta.intVal;
fprintf(fd,"try...iTimeDelta = %d\n",iTimeDelta);
}
catch(...)
{
iTimeDelta = 0;
fprintf(fd,"catch...iTimeDelta = %d\n",iTimeDelta);
}
//AiConvertDoc(iTrace, sDevID, sInFileName, sOutFileName, sCOpt, sSOpt, sPrefix, sFileTitle, iTimeDelta);
try
{
if(AiConvertDoc(iTrace,sDevID,sInFileName,sOutFileName,sCOpt,sSOpt,sPrefix,sFileTitle,iTimeDelta) == false)
{
if (iTrace > 0)
{
fprintf(fd,"Else part AiconvertDoc Failed");
VarAdd(vReturnValue, &(_variant_t)"RNN10SGI12", vReturnValue);
VarAdd(vRetValue, &(_variant_t)"FALSE", vRetValue);
goto Terminate;
}
}
}
catch(...)
{
if (iTrace > 0)
{
VarAdd(vReturnValue, &(_variant_t)"RNN10SGI12", vReturnValue);
VarAdd(vRetValue, &(_variant_t)"FALSE", vRetValue);
goto Terminate;
}
}
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
if(strlen(sOutFileName) != 0)
{
fprintf(fd,"sOutFileName = %s\n",sOutFileName);
_splitpath (sOutFileName, drive, dir, fname, ext);
sprintf(sDstFile,"%s%s%s.OUT",drive,dir,fname);
fprintf(fd,"sDstFile = %s\n",sDstFile);
}
else
{
if (iTrace > 0)
{
fprintf(fd,"sOutFileName....NULL\n");
VarAdd(vReturnValue, &(_variant_t)"RNN10SGI12", vReturnValue);
VarAdd(vRetValue, &(_variant_t)"FALSE", vRetValue);
goto Terminate;
}
}
FILE *fin, *fout;
fin = fopen(sOutFileName, "rb");
if(_filelength(fileno(fin)) > EMAIL_ATTACHMENT_MAX)
{
fclose(fin);
if (sOutFileName)
sOutFileName = NULL;
// Return an erro File size not supported
if (iTrace > 3)
{
fprintf(fd,"Attachement Size Too Big %ld\n", GetLastError());
VarAdd(vReturnValue, &(_variant_t)"RNN10SGI13", vReturnValue);
VarAdd(vRetValue, &(_variant_t)"FALSE", vRetValue);
goto Terminate;
}
}
if (fin)
{
fout = fopen(sDstFile, "wb");
if (fout)
{
int cNum;
while ((cNum = fgetc(fin)) != EOF)
{
switch(cNum)
{
case 0:
fputc(171, fout);
break;
case 13:
fputc(175, fout);
fputc(174, fout);
break;
case 171:
fputc(175, fout);
fputc(171, fout);
break;
case 175:
fputc(175, fout);
fputc(175, fout);
break;
default :
fputc(cNum, fout);
break;
}
}
fclose(fout);
}
fclose(fin);
}
if((fp = _open( sDstFile, _O_RDWR | _O_CREAT, _S_IREAD | _S_IWRITE )) != -1)
{
// If Trace is Enabled: Notify status
if (iTrace > 1)
{
fprintf(fd,"File Transfer Successfull...\n");
}
long fLen = _filelength(fp) ;
if(fLen < EMAIL_ATTACHMENT_MAX)
{
VarAdd(vReturnValue, &(_variant_t)"B", vReturnValue);
VarAdd(vReturnValue, &(_variant_t)sDstFile, vReturnValue);
VarAdd(vReturnValue, &(_variant_t)"", vReturnValue);
VarAdd(vReturnValue, &(_variant_t)sPrefix, vReturnValue);
VarAdd(vRetValue, &(_variant_t)"TRUE", vRetValue);
printf("After making string DEL B DstFile DEL sPrefix\n");
}
else
{ // Return an erro File size not supported
if (iTrace > 3)
{
fprintf(fd,"Attachment size too big \n");
VarAdd(vReturnValue, &(_variant_t)"RNN10SGI14", vReturnValue);
VarAdd(vRetValue, &(_variant_t)"FALSE", vRetValue);
goto Terminate;
}
}
_close(fp);
} /// End of if((fp = _open( sDstFile, _O_RDWR | _O_CREAT, _S_IREAD | _S_IWRITE )) != -1)
else
{
// If Trace is Enabled: Notify status
if (iTrace > 3)
{
fprintf(fd,"Converted file could not be read \n");
VarAdd(vReturnValue, &(_variant_t)"RNN10SGI15", vReturnValue);
VarAdd(vRetValue, &(_variant_t)"FALSE", vRetValue);
goto Terminate;
}
/* We are returning nothing here currently We may be changing it in future */
}
DeleteFile(sOutFileName);
DeleteFile(sInFileName);
fprintf(fd,"All Task Completed...\n");
Terminate:
fprintf(fd,"After Terminate successfull...\n");
if(sCOpt) delete [] sCOpt;
if(sSOpt) delete [] sSOpt;
if(sDstFile) delete [] sDstFile;
if(sOutFileName) delete [] sOutFileName;
if(sFileTitle) delete [] sFileTitle;
if(sInFileName) delete [] sInFileName;
fprintf(fd,"After deleteing all successfull...\n");
// Uninitialize COM Objects
::CoUninitialize();
fprintf(fd,"After CoUnitialize...\n");
fclose(fd);
return S_OK;
}
|
|
|
|
|
Im stumped beyond words.
There are several articles on how to programmatically set the
default printer. I just can't get any article to work. If I
make the printer settings dialog box popup and the user selects
a different printer, that works. But I haven't had any luck
programmatically changing that on my own.
Any ideas or any feedback any one can provide will be greatly
appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
|
I wanted to draw a 256 color bitmap from a resource to a view window but i was wondering how i can do that ??????????????????
|
|
|
|
|
Have a look at this article.
http://www.codeguru.com/Cpp/G-M/bitmap/article.php/c1721/
|
|
|
|
|
i have already seen that article and used it in my code but the line
if( dc.GetDeviceCaps(RASTERCAPS) & RC_PALETTE && palette.m_hObject != NULL )
{
dc.SelectPalette( &palette, FALSE );
dc.RealizePalette();
}
the evaluation in the if statement is always NULL and nothing is drawn on the screen i am drawing in the CView::OnDraw() function and i created one class storing the bitmap and palette all together and some operations as loading image generating the palette and so on but nothing is drawn
|
|
|
|
|
CDC *dc = GetDC();
CDC memDC;
memDC.CreateCompatibleDC( dc );
CBitmap bitmap;
CPalette palette;
GetBitmapAndPalette( IDB_BITMAP, bitmap, palette );
memDC.SelectObject( &bitmap );
// Select and realize the palette
if( dc->GetDeviceCaps(RASTERCAPS) & RC_PALETTE && palette.m_hObject != NULL )
{
dc->SelectPalette( &palette, FALSE );
dc->RealizePalette();
}
dc->BitBlt(0, 0, 180, 180, &memDC, 0, 0,SRCCOPY);
This is working
|
|
|
|
|
How to define a specific dialog window dimensions when the application (dialog based) starts?
I could 't find such property in the property tabs.
Please help
|
|
|
|
|
Try SetWindowPos() or MoveWindow() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Try SetWindowPos
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
Just started build test apps with VC++.Net and I have a few silly questions?
1. I need to write dynamic/data access web pages and I am not sure exactly what project type to use (so many!), I am currently building test apps in the 'Windows Forms Application .Net' project type, am I ok?
2. I would like to put a simple button on a web page (I have Dreamweaver etc) click it and my window pop up? not sure how I take the .exe file generated and actually get this to happen? think its something to do with XML and the XML file writing/reading classes?
3. Thanks a lot? I appreciate all help and value it!
Many thanks for your time and may the force be with you! (you'll need it!)
|
|
|
|
|
1. Use the PHP language. Search Google with "Data access with PHP". PHP scripts can be written directly into a HTML document, thus allowing access to a database directly.
2. The button click usually causes a script event. If you are using JavaScript, then here is a piece of code that starts a program on the machine:
function openNotepad() {<DIV>
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun = "C:\\Program Files\\Microsoft Office\\Office\\WINPROJ.EXE";
var commandParms = "C:/Filename.mpp";<DIV>
oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1")
} Just change the path to point to your executable and omit the parameters. See ShellExecute in JavaScript reference for more information. It might be that this will not work, as it is a security risk to allow scripts to execute applications (Think about executing "format c: /y"). An another alternative is to fire an open/save dialog.
If you only need to open a window/dialog, then you shouldn't use an executable at all. I think Dreamweaver has the tools to write a Flash component that acts like a window, showing buttons, getting results and so forth. Then just insert this component into the web page.
Hope these will help.. If not, then post more information on your problem, and consider if there are any alternatives available, mostly due to the insecurities in script-based command execution.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi!
I'm trying to write my own HTTP server in Win32API, with the Winsocks API.
For the moment, it can read the GET and HEAD methods, so I can handle basic HTML and JavaScripts which don't tell data to the server.
To to this, I would like to use the POST method, but I don't know how to use it.
It would be great if you could send me documentation about POST and other specifications about HTTP methos (with samples if possible)
Thanks !
Time doesn't waits
|
|
|
|
|
You can go through the HTTP RFC's[^]
As far as I know... GET appends the data (Form fields) to the URL (as in xyz.html?s=y... etc)
POST appends the fieldname and value to the end of the request data... so look for (\n\n) and see if you have any fields.
I hope this helps
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
Hai,
I'm creating a dialog-based app in win32 vc++. After starting the app,if there is no user activity for 10 sec the app should exit...Can anyone suggest how to do this.
thanks.
|
|
|
|
|
Use a timer to increment a counter every second, when the counter hits 10 call EndDialog. At the same time have every possible user input action reset the counter to 0.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
cse WM_INITDIALOG:
SetTimer();
break
case WM_TIMER:
EndDialog();
break;
And when a button is pressed the timer should pe set again or whatever you want tpo do
gabby
|
|
|
|
|
Sorry to take up for forum space here!
Many thanks for your time and may the force be with you! (you'll need it!)
|
|
|
|
|
If it is just a regular C/C++ question, this forum will do fine. If it is a question regarding managed extensions and the .Net runtime then use the Managed C++ forum[^]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Forget it, I have just woke up!
Many thanks for your time and may the force be with you! (you'll need it!)
|
|
|
|
|
Is there any way to turn off warnings for visual studio headers while still keeping a high warning level on your project code? I looked briefly in the forums but couldn't find anything that specifically applies.
|
|
|
|
|
Use the #pragma warning directives.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
You can also modify the warning level for particular source files, if there is one that causes you consternation. I often do this when dealing with 3rd party files that I have no control over.
|
|
|
|
|