|
Hope it helps you
I'd posted the lines but I've
only some in german
|
|
|
|
|
I know we can do stuff like
Select * from tbl where (Color = 'red') AND (Shape = 'round)
But what if we had an integer instead of a string for a value i.e.
Select * from tbl where (Color = 'red') AND (Shape = 'round)AND (Depth = 100)
Is the above legal? We dont need ' 100'? Just plain 100?
Thanks,
ns
|
|
|
|
|
It's legal,
but
(Shape = 'round')
instead of
(Shape = 'round)
|
|
|
|
|
Yes, and the results will differ. '100' will do a string comparison, so that 100 < 99, and 100 will do a numeric one, so 100 > 99.
|
|
|
|
|
Great! Thats very good to know. Appreciate it,
ns
I wonder why my code crashes. I build the query on the fly, and one fld returns a number which I currrently put in as 'number' and not number, so in the query i have ....and (depth = '100'). This query should clear becauseit shouldnt find any such records, but instead it crashes....
Havent debugged this seriously..
|
|
|
|
|
hi ..
im trying to control my menus from my code segment. i.e i want to disable enable them according to my needs.
the code which im writing works perfectly in the dialog based application but it aint working in my SDI application
CMenu* mmenu=GetMenu();
CMenu* submen=mmenu->GetSubMenu(0);
submen->EnableMenuItem(ID_FILE_OOP,MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
kindly tell me a way so that i can use this code for my sdi application .
thankks
looking forward from all the gurus of code
|
|
|
|
|
Have you tried submen->EnableMenuItem(ID_FILE_OOP,MF_BYCOMMAND|MF_GRAYED); ?
rechi
|
|
|
|
|
The problem is that your frame window (in an SDI app created by the wizard, that'll be CMainFrame) is automatically enabling/disabling menus based on whether they have a command handler registered (if there is a command handler available, the menu item will be enabled). The reason the code worked properly in the dialog based application is that there is no frame window in a dialog app.
The best solution is almost always to use an update handler (ON_UPDATE_COMMAND_UI in the message map - look it up in MSDN if you don't know about it) to update the enabled state of your menu item. This is also mentioned in Michael Dunn's C++ FAQ (section 7.1) here at CodeProject.
If you really can't/can't be bothered to use an update handler, you can tell the frame window not to automatically enable/disable menu items - set its m_bAutoMenuEnable property to false. But the update handler method is much better!
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
I'm looking for a simple way to increase or decrease the brightness of a specified color, for making a highlight and shadow color to match the given one.
Any idea will be muchly appreciated.
Happy programming!!
|
|
|
|
|
Look up HLS on the net - you need to convert to HLS, increase the appropriate value, and convert back to RGB.
|
|
|
|
|
My post at CodeGuru Forums[^] :
A simple way to adjust the brightness of a color is to adjust a constant value of red, green, and blue in a color. Here is a function for this.
COLORREF Brighten(COLORREF cr, int val){
BYTE r,g,b;
r=(BYTE)min(255,max(0,GetRValue(cr)+val));
g=(BYTE)min(255,max(0,GetGValue(cr)+val));
b=(BYTE)min(255,max(0,GetBValue(cr)+val));
return RGB(r,g,b);
}
A positive value for val brightens the color, and a negative value for val darkens the color. Be sure the val parameter is within the range -255 to 255.
Peter O.
|
|
|
|
|
The number stored in long m_NumAfterAddRecords is the RecordCount and its 14.
When I display it in my status bar I do:
stringNum.Format("Final Number of Records: %d", pDoc->m_db.m_NumAfterAddRecords);
I get some ridiculous negative number. Is it because I'm doing %d and its a long value? If so, how do you format a long value?
Thanks,
ns
|
|
|
|
|
try
stringNum.Format("Final Number of Records: %ld", pDoc->m_db.m_NumAfterAddRecords);
or
stringNum.Format("Final Number of Records: %d", (int)pDoc->m_db.m_NumAfterAddRecords);
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
Thanks. I found my silly mistake. I'd declared the number of records to be a member variable, but later redeclared it locally to my function, so naturally it wasnt passing any sensible value once it went out of scope. Appreciate the formatting ideas.
ns
|
|
|
|
|
Always suspect of the hexadecimal value 0xcccccccc. Visual C++ in debug mode fills all uninitialized variables with 0xcc to ease spotting these kind of problem...
Concussus surgo.
When struck I rise.
|
|
|
|
|
Friends,
I have created Regulalar DLL with using MFC in statically linked,i have added Dialog box ,and also Microsoft grid control and i buld in release mode ,and i have called from test release application ,the dialog box is not getting displayed eventhough controll is going to DLL ,Ihave observe that when I remove grid control the dilog box is displayed why it is so happening any one know the reason please mail me also give the solution how i could use grid control in the above case
Thanking u
krishnamohan
|
|
|
|
|
It problem about resource handle,you can use dynamically links to MFC and try
AFX_MANAGE_STATE(AfxGetStaticModuleState( ))
see MSDN :
When building a regular DLL that dynamically links to MFC, you need to use the macroAFX_MANAGE_STATE to switch the MFC module state correctly. This is done by adding the following line of code to the beginning of functions exported from the DLL:
AFX_MANAGE_STATE(AfxGetStaticModuleState( ))
The AFX_MANAGE_STATE macro should not be used in regular DLLs that statically link to MFC or in extension DLLs
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
you can use SetResourcehandle()reset the application current resourcehandle.
(use GetResourceHandle() save the old resource handle first)
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
IF i just want the same function to run for each button when clicked in an array of buttons, how do I do this?
Thanks,
ns
|
|
|
|
|
use ON_CONTROL_RANGE macro,you sould add it manualy
ON_CONTROL_RANGE( wNotifyCode, id1, id2, memberFxn )
wNotifyCode can be BN_CLICKED
id1 is the first button control ID and id2 is the last button control ID,All IDs must be consecutive.
message handler declare:
afx_msg void memberFxn(UINT uID);
uID is the button control ID
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
ON_CONTROL_RANGE is dangerous because it's easy enough for control ids to get out of range once you start modifying your dialog. This can cause hard to detect errors.
I prefer to let ClassWizard generate separate handlers (OnButton1, OnButton2, ...). I then manually replace them with a single handler. Easy enough to do and independent of the control ids.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Or buttons or labels etc.
At runtime I find out how many controls i need (thse are CEdits). How by code can I create these? I've only done them so far with the toolbox at designtime. So how does one create a CEdit array dynamically?
Thanks,
ns
|
|
|
|
|
From MSDN:
CEdit* pEdit = new CEdit;
pEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
CRect(10, 10, 100, 100), this, 1);
For others you have to do the same.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hello,
I was wondering if anyone knows how to clear the screen in a Visual C++ Console Application.
I need to be able to do this for a part of a project in my C++ course. My lecturer doesn't even know how to clear the screen. He just suggested using lots of "\n", but there has to be a better way??
Thanks.
_______________________________________
Web: www.jcroucher.com
Sonork: 100.472
ICQ: 25902350
MSN: jcroucher@yahoo.com
Yahoo: jcroucher@yahoo.com
----------KnOwLeDgE iS pOwEr-----------
|
|
|
|
|
Well, this does work:
void ClearScreen()
{
int i;
for(i = 0;i < 24;i++)
{
cout << "\n";
}
}
I think there is another way, however I haven't seen it for a long time, maybe someone else can post as I am curious now that you bring the subject up.
Nick Parker
|
|
|
|