|
#include <sstream>
int a,b;
std::ostringstream strm;
std::string s;
strm << "Insert into region(regionID, RegionDescription)Values(" << a
<< "," << b << ")" << std::ends;
s = strm.str();
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Hi guys,I have a question
I used Access2000 to build a database,there is a Field named “Price”,it's type is money.
In VC++ ,I used ADO to access this database.
I wanna display the value of this field in my listctrl,the code as follow:
_variant_t Holder;<br />
CString str;<br />
<br />
Holder = theApp.m_pADOSet->GetCollect("Price");<br />
<br />
if ( VT_NULL==Holder.vt ) str="N/A";<br />
<br />
else str.Format("%.2f", Holder.dblVal);<br />
<br />
m_ListCtrl.SetItemText(i, 7, str);<br />
listctrl display 0.00 in this field.but in my table,it's value is 3.00,could anyone tell me what I can do? thanks
===============
YES, I am here.
===============
|
|
|
|
|
|
sometime soon look for an antialiasing article... as i've just played around with it and gotten it to work pretty well for straight lines and the concept should work for any shapes
r -€
|
|
|
|
|
Does anyone know if there is a way to reset the colour of a menu bar to the same as the background of a dialog? To set dialog background colour, one uses SetDialogBkColor(). With a menu in the dialog, one gets an ugly grey stripe across the top. OK! I know I'm sick and demented and should be using CFrameWnd, but I LIKE dialogs!! And, for a newcomer, they're a damn sight easier to use!! You would be making 2004 start pleasantly for me!!!
Happy New Year
The fool who knows that he is a fool is truly wise.
The fool who thinks that he is wise is truly a fool.
Dhamapadda - Sayings of the Buddha (slightly modified!)
Brian
|
|
|
|
|
Hello all.
I am trying to change the text/style of my button(s). Instead of the default, I want to make them Tahoma, 14pt. The code that I am using to do this is listed below. What is happening is this: If I put this code in the OnInitDialog() or OnPaint(), it somewhat works. The button will look different than the other ones, but now how I am specifying it to look. No matter what nHeight size that I use, it initializes to this same size every time, and bold. But, the funny thing is that the same exact code when used inside an OnBnClickedButton1() changes the font for that button text to exactly what I want. I am wondering why this same code is not working properly in the OnInitDialog() / OnPaint() ??
Also: I am wondering if there is a way to set the default font for the dialog buttons or set the font / size for the button text with the resource editor (instead of having to have code to "change" the font of the button) ?
Thanks
CFont ListBoxFont;
ListBoxFont.CreateFont(
14, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
"Tahoma"); // lpszFacename
m_button1.SetFont(&ListBoxFont,TRUE);
|
|
|
|
|
try making new CFont object using CFont* ListBoxFont = new CFont;
that might work... just an idea
r -€
|
|
|
|
|
Your CFont object needs to be moved to the header file of your dialog class.
What's happening is that the CFont object is being created on the stack within your function and when the function exits the CFont object goes out of scope and it's destructor is being called.
shultas wrote:
Also: I am wondering if there is a way to set the default font for the dialog buttons or set the font / size for the button text with the resource editor (instead of having to have code to "change" the font of the button) ?
This would be a nice feature. Microsoft, are you listening?
Kelly Herald
Software Developer
MPC
|
|
|
|
|
LOGFONT logFont;
logFont.lfHeight = 12;
logFont.lfWidth = 0;
logFont.lfWeight = FW_BOLD;
logFont.lfItalic = FALSE;
logFont.lfUnderline = FALSE;
logFont.lfStrikeOut = FALSE;
logFont.lfEscapement = 0;
logFont.lfOrientation = 0;
lstrcpy(logFont.lfFaceName, _T("Arial"));
m_font.CreateFontIndirect(&logFont); // Create the font.
GetDlgItem(IDC_BUTTON)->SetFont(&m_font);
Declare CFont in .h file
|
|
|
|
|
When I put the declaration of Cfont on the .h file, it whined saying that multiple definitions were found (probably because that .h file is included in several places). (I did not put it in the class declaration, but after the class declaration).
But, what I did is right up top in my .c file where the <include> statements were, I put Cfont ListBoxFont; in there and it worked perfectly
Thanks for the tips!
|
|
|
|
|
shultas wrote:
When I put the declaration of Cfont on the .h file, it whined saying that multiple definitions were found (probably because that .h file is included in several places). (I did not put it in the class declaration, but after the class declaration).
Try to put the CFont declaration in the class scope, as a class member.
shultas wrote:
But, what I did is right up top in my .c file where the statements were, I put Cfont ListBoxFont; in there and it worked perfectly
That has essentially the same effect I believe. Since here it's been declared as a global variable, the CFont still exists after exiting OnInitDialog()
|
|
|
|
|
Is there a way to intercept mouse clicks when the current window is minimized or inactive?
Thanks
~Mike
|
|
|
|
|
When ou click on a window, it will become active and you'll recieve your mouse messages.
when you window is minimized, you want to capture mouse clicks inside another window?
Probably best to look into hooks
HTH
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
Yes, actually I want to intercept every mouse click once the "Start" button of my program is clicked... can you help me?
|
|
|
|
|
Hello everyone,
I have been working on an MFC SDI program whose Document actually has lists of lists (and possibly a list of a list of a list). I would like to get into a good habit and be consistent with the way I maintain collections (mostly lists, occasionally arrays and maps). Almost all my objects are derived from CObject (for serializing, etc.).
I guess it comes down to picking between CList<type, type>, CList<type, type&>, CList<type*, type*> and whatever other combinations. To keep sane, I think I always want to use CList<type*, type*>. That way, I just use the new operator at the point where an object needs to be instantiated and call delete on it (while traversing the list or sublist) at the 'outer' list's destructor.
I would like comments about this. Is it safe? Is it a decent practice to keep? How can I prevent double deleting the same objects (if that could even happen)? Does this choice affect how I code the required copy constructor and assignment operator (which always seem to involve references)?
Thanks in advance for any advice and comments!
Happy New Year,
Eric
|
|
|
|
|
Is this the proper forum to ask this question, or should I move it elsewhere?
Thanks,
Eric
|
|
|
|
|
Using NMAKE (the VC++6 version) and a makefile, I can easily write implcit rules to compile *.c *.cpp and *.asm files.
However, if I write an implicit rule to compile an *.a39 file, I always get an error;
NMAKE : fatal error U1073: don't know how to make 'D:\v400\bld\obj\testprg.o'
It seems that if it is not a "normal" filetype then NMAKE will not find it.
Is there any way around this (apart from renaming my files)?
Thanks,
Bryan.
|
|
|
|
|
Hi
When closing access database file objects in c++ I keep getting this error:- Debug Assertion Failed.
It happens as I close the CDaoDatabase object but I have noticed that when it is debugged and stepped over there are no errors.
Why doesn't this work?
CDaoDatabase db;<br />
db.Open( _T("c:\\database.mdb") );<br />
db.Close();
Also are there any good examples of using the MS Jet Engine including V4 if pos.
Many thanks
Jason
|
|
|
|
|
Hello,
I think this article helps to you.
http://funducode.com/freevc/database/database2.htm
With Regards,
R.Selvam
|
|
|
|
|
Hi,
How can we compare sign of numbers in C++ ?
Bye,
Claude
|
|
|
|
|
int i = -5;
BOOL bNegativeNumber = i >> 31;
ASSERT(bNegativeNumber == TRUE);
...
short sh = 4;
BOOL bNegative16 = sh >> 15;
ASSERT(sh == FALSE);
Hope you meant that
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
I hope you are joking... the size of integers are only specified in realtive form (i.e. sizeof(char) <= sizeof(int) and so on).
Bitshifting based on static numbers are bound to fail.
Use comparisons instead (as in the post below).
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
int a = 145;
int b = -51;
bool fIsDifferent = (a >= 0) ^ (b >= 0);
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi !!
My app is being developed in MFC, VC++7. How can I make my controls resizable ?? I mean, when an user clicks on the corner to make the window bigger or smaller... please if the piece of code could be provided it would be great!!
Thank you very much !!
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
if ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|