|
Thanks for you answer.
I also found that OLE stuff, but I am not sure what I should do with it. The M$ "documentation" of the OLE interface of CRichEditCtrl is practically nothing.
I also think, that somewhere in the CRichEditVIEW and CRichEditDOC classes something similar must be done in order to load RTF text with OLE objects. But unfortunately I can't use CRichEditView.
I hope someone can give me a hint about it.
|
|
|
|
|
I think this comment in Codeguru can be the solution of the problem:
http://www.codeguru.com/mfc/comments/27104.shtml
We must implement the IRichEditOleCallback interface. The most important method seems to be GetNewStorage!
You can find the full code if you follow the link above!
|
|
|
|
|
Hi all,
I need to bringup a scale control in inches upon my Edit Control, (as in the top of the Word Document )
Any Components are avilable??
Thanks in advance
Warm Regards,
KKR
|
|
|
|
|
after editing code:
void CDlgDelete::OnOK()
{ CString deleteID;
deleteID.Format("ID = %s", m_str_deleteID);
recordset.Find(AFX_DAO_FIRST, deleteID);
recordset.Delete();
recordset.Update();
recordset.Close();
database.Close();
CDialog::OnOK();
}
i run program and encountered messagebox error: syntax error(missing operator) in expression. how to correct it?
|
|
|
|
|
Have you used the debugger (or popped up a message box) to check and see what exactly the value of deleteID is after formatting it? There might be a quote missing somewhere.
|
|
|
|
|
okie i did what u suggested as follows:
deleteID.Format("ID = %s", m_str_deleteID);
AfxMessageBox(deleteID);
then i run and my message box read "ID=" instead of "ID=xxx"....so wat is wrong with my code?
|
|
|
|
|
Hi,
My current task is to find a way to add superscripted text to the title bar of a CDialog based window, as in "MyWindowsuperscript". My first thought was that there must be some control characters to embed in a CString that when sent to CWnd::SetWindowText(superscriptedText)would cause the text to be rendered. No luck on this front. Undaunted, I thought about making the superscripted text a graphic and drawing it in the Title Bar. I haven't been able to find any guidance on this approach for a CDialog derived class. Any help greatly appreciated!
I'm working in Visual C++ Version 6.
Thanks,
Doug
Doug Knudson
|
|
|
|
|
|
Hello
I was just wondering if anyone knows of a tool that aids converting a Visual Studio C++ app from MBCS to Unicode. I have this huge task ahead of me and any helpful utilities would be very useful. What I bascially want is something that scans through all my files and converts all instances of char to TCHAR, string functions such as strcpy to their TCHAR eqivalent and converts literal string such as "Hello" to _T("Hello") plus hopefully deals with some of the more subtle conversion issues.
Does anyone know of such a tool?
Thanks
Mark
|
|
|
|
|
This would definitely be a tool worth writing!
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi
I use Visual Studio 6 and have made a dialog based MFC application that uses the registered Activex component called "MS communications control version 6" (MSCOMM32.OCX) . My program does serial communication via an RS232 interface. I tested it under XP and WinNT 4: It works when I add MSCOMM32.OCX to the system32 folder. It did not work under Win98 2nd Edition. The dialog box didn't even show up. When I installed Visual studio, it showed up and worked but when I closed the application, windows couldn't be shut down (fatal error). I want it to work without installing visual studio. Does anybody have an idea how I can make it work?
Thanks
|
|
|
|
|
Hi. I have a boolean member variable assigned to a check box, but when I pass theis variable to a function I get the follwoing warning:
Warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
Declaring a local boolean and passing that works fine, just not the member variable from the check box. So, is a member variable of type 'BOOL', as assigned by Class Wizard, a true boolean?
CODE:
func(bool a); //definition
func(m_boolPar1); //call to func - doesn't work
bool b;
func(b); //works fine
Thanks in advance. Frustrated & bemused!!
|
|
|
|
|
You probably are passing your
func (bool a) ;
a BOOL - a MS typedef for int .
Change this
BOOL b = TRUE;
func (b); to
BOOL b = TRUE;
func (b!=FALSE);
This way, you use the !=-operator to produce a bool from your BOOL . You test for != FALSE instead of == TRUE , because TRUE used to be defined as 1, but you want any non-null to be treated as TRUE .
When MS designed MFC, there was no real C++ standard, and certainly no Microsoft-compiler capable of understanding it.
A few ugly things from this times are still around: BOOL instead of bool , CArray instead of std::vector , lacking const ness from many functions.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Thanks for your reply, but I actually want to pass my member variable 'm_boolPar1' to func at many points throughout my program (it is a very big real time application to drive some test equipment).
In your example, wouldn't passing 'b' (or 'm_boolPar1') to func as...
func(b!=FALSE) // or func(m_boolPar1!=FALSE)
...mean that func always recieves a parameter with the same value, ie TRUE???
What I want to do is to pass the member variable 'm_boolPar1'(i.e. a BOOL - can't redefine this as 'bool' since this is not an option in the Class Wizard) to func.
I have also tried casting m_boolPar1 to bool...
bool b;
b=(bool)m_boolPar1
...but this also causes compiler problems.
Any suggestions would be appreciated.
|
|
|
|
|
PaulUK01 wrote:
Wouldn't passing func(m_boolPar1!=FALSE) mean that func always recieves a parameter with the same value, ie TRUE???
The operator!= returns a C++ bool . If both of its parameter are not equal, it is supposed to return true .
In the call of func(m_boolPar1!=FALSE), the expression (m_boolPar1!=FALSE) evaluates to true if m_boolPar1 is not equal to FALSE (which happens to be #defined to be 0).
This bool will then be used as a parameter for the call to func() .
So func() will be called with the desired bool value instead of a typedef ed int .
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Ah, I see. I was forgetting my fundamentals of C !!! This works a treat now, even though the code does becomes slightly less readable.
Thanks again.
|
|
|
|
|
Nope, its an integer. A hangover from before bool was implemented as a built in type in MSVC.
You can #pragma the warning out if its getting a bit noisy.
Ryan
|
|
|
|
|
This is related to the old topic of what is the relationship between bool and BOOL . bool is a true C++ type, which can only take the values true and false , and usually occupies one byte of memory (this is so at least in your compiler). BOOL , on the other hand, is just a typedef alias of int . In most situations, you can use these two types interchangeably. Here, however, the compiler is telling you that, in order to feed a real bool to func when passed m_boolPar1 (which is a BOOL ), it'll have to some intermediate conversion (basically, converting from an int to a byte), which may affect performance if this is called very often. I'm sure this is not your case, so you can shut your compiler up with:
func((bool)m_boolPar1); Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi - thanks for your reply.
When I cast from BOOL to bool as suggested, the compiler gives the follwoing warning:
warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
I think I'll just have to redisgn, replacing the the function to take integers instead of booleans. I cannot redefine my member variable as a 'bool' - Class Wizard doesn't have this option.
This is bad design practice as my design does use true booleans, but I don't see how I can assign a true boolean to a member variable.
Thanks again
Paul
|
|
|
|
|
hi,
i have some validation on onok of the page. the validation is not satisfied means i don't want to close the dialog. what's the solution.
thanks in advance
|
|
|
|
|
in the overwritten function you should not call CPropertyPage::OnOK() if you are not satisfied with the Values.
the better way is to overwrite the Function OnApply() , because this is called when OK or when Apply is clicked.
Greets
Roland
|
|
|
|
|
I am trying to adjust the printed image size fit into
the paper size which is about A4.
I have tried to change those parameters for GetDeviceCaps functions. seemingly, I can't get the right size.
Does anyone have solution to this?
if( pInfo )
{
CClientDC dc( this );
pDC->SetMapMode(MM_ANISOTROPIC);
CSize sz( dc.GetDeviceCaps(LOGPIXELSX), dc.GetDeviceCaps(LOGPIXELSY) );
pDC->SetWindowExt( sz );
sz = CSize( pDC->GetDeviceCaps(LOGPIXELSX),pDC->GetDeviceCaps(LOGPIXELSY) );
pDC->SetViewportExt( sz );
}
shi
|
|
|
|
|
I have an application...when someone calls me(via a modem) I need to initialize the device on his side, so is it possible in some way to know that the call has been made to me....so that I can automate the process and without any manual interaction on my side I can acivate my friend's device.....actually I want that if the application is running and I am not there he should not face any problems
Maverick
|
|
|
|
|
|
Sorry for the confusion......
suppose you have a device and you are at a remote location, where you have a modem and a phone line with you.....and suppose that you want to connect to your PC at your home and so you send a request(your PC is on) so is it possible somehow,that by using the APIs provided in VC++ we can program our system(PC) in such a way that whenever it gets a request it automatically programs the device(which is presently at the remote location).
I guess I make sense now
regards
Harsh
|
|
|
|