|
i insert a picture object in the richedit control, it will rise ON_CHANGE notify,
but the function ReplaceSel will cause a reentrancy in win98, in win2k, it will not,
so strange!
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
//{{AFX_MSG_MAP(CMyDialog)
ON_EN_CHANGE(IDC_RICHEDIT, OnChangeRichedit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CMyDialog::OnChangeRichedit()
{
int nEnd = m_editRich.GetTextLength();
m_editRich.ReplaceSel("TestValue"); //when run in "ReplaceSel", it will call OnChangeRichedit() immediately,
//it reentrant! so it does not work well!
int nLabel = m_editRich.GetTextLength();
}
i want to known the reason that the function "ReplaceSel" will cause reentrancy in windows 98, any reply is expected!
|
|
|
|
|
So far this is what I got. I am attempting take a simple answer from a user and output the right string.
#include "iostream.h"<br />
#include "windows.h"<br />
<br />
void main(void)<br />
<br />
{<br />
int age;<br />
int date;<br />
int y;<br />
int n;<br />
<br />
cout << "User what is your age?\n";<br />
cin >> age;<br />
cout << "So user you are " << age;<br />
cout << " years of age?\n";<br />
cout << "User I have a fraise you should see!\n";<br />
cout << "Would you like to see the fraise?\n";<br />
cin >> if y else<br />
cout << "Hello World!\n";<br />
cin if n else cout << "Well I hope you have a good day";<br />
}
You NEVER KNOW till you TRY
|
|
|
|
|
How can make my dialog windows get to the top of the right on my desktop?
|
|
|
|
|
Get the dimensions of the screen by calling GetWindowRect() , then call MoveWindow() on your dialog.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Additionally, get the desktop width via GetSystemMetrics(SM_CXSCREEN) . Then, move your window to (0|screenwidth-appwidth).
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks! I will try use that.
|
|
|
|
|
I have a Smart Card SDK , it contains one .dll file, .h header file and nothing else.
He given one SDK document containing all the Smart Card WINAPI functions.
I am new to VC++.
So i want to know how to write program in VC++ to read and write data from/to smart card.
How to use the .dll and .h file in this program to access the device ?
|
|
|
|
|
jsaroj wrote:
I have a Smart Card SDK , it contains one .dll file, .h header file and nothing else.
He given one SDK document containing all the Smart Card WINAPI functions.
yeah i think file name are Winscard.h,winscard.dll
i have little question pls don't mind do u know how to use external dll in the project ,if not search mdn for loadlibrary and getprocaddress api's
jsaroj wrote:
So i want to know how to write program in VC++ to read and write data from/to smart card.
yeah i too have worked with the smartcard but using com port not with api's yeah,if you havbe some sample with your sdk,send it to me i will help you to understand that ok.
actually the smartcard are harwdare dependent,some menufacture smartcard device work on different command set and other on different there are a few manufacture who actually following the ms smartcard api,is you reader manaufacturer is compliant with ms.
ok
-----------------------------
"I Think It will Work"
Formerly Known As "Alok The Programmer" at CP
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
I'm developing a program by GDI but I has a knotty problem when i use the function pDC->SetMapMode(MM_LOMETRIC);
When it runs on my computer is good but shapes(as ellipe, square, circle,...) are crooked when my application runs on other computer, I don't know why... Please help me...thanks.
|
|
|
|
|
Hello,
I am loading a dll from an app (.exe) and it has to remain in memory after the app terminates execution.
Well, the problem i've been having consists in that whenever the app stops running, the dll is automatically freed (possibly because it is associated with the creating thread/instance.)
How can I prevent this from happening? I mean, how can I make the Dll remain in memory until it receives a notification saying it can terminate?
Thanks,
Dave
BTW: it is a dll with MFC support...
|
|
|
|
|
dNimrod#X wrote:
I am loading a dll from an app (.exe) and it has to remain in memory after the app terminates execution.
And do what exactly ?
The dll is just a bunch of functions, the exe is the main thread of execution.
What are to trying to accomplish ?
...cmk
Save the whales - collect the whole set
|
|
|
|
|
dNimrod#X wrote:
how can I make the Dll remain in memory until it receives a notification saying it can terminate?
What you're asking doesn't make sense. By definition, a DLL is a library - it is an extension to an application. It makes no sense to have a library in memory without an application using it.
Basically, you can't do this. Windows automatically frees all libraries when you close your application. There is nothing you can do about it, by design. If you want your DLL to stay in memory, your application has to stay in memory as well.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
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!)
|
|
|
|
|