|
Having moved back to Visual Studio 2005, it is now bombarding me with warnings about ISO C++ deprecation of certain functions (such as strdup and stricmp). Most of these warnings disappear when I tell it to mind it's own business with _CRT_SECURE_NO_DEPRECATE. However, is it advisable to actually do what Microsoft say and switch everything over to the new versions of the functions?
|
|
|
|
|
Yes the annoying security warnings
There are many reasons to not use the new functions, even if MS recommends:
- your code gets much more complicated
- no cross-compiling with other compilers/operating systems possible
- every open-source lib you use will bring again these warnings
It is also widely not understood that the wrong functions were blamed by
MS. Most of them are not unsafe and never were. But they depend on correct
usage, so you as the programmer are in charge to not give them garbage.
So, my advice is to use the old functions, and check (if you must use plain C)
every buffer for long enough size, esp. if you get data from user input.
Hans
|
|
|
|
|
Thankyou, Hans. I was thinking something along the same lines, although I never thought of the cross-compatibility issue. Best to check.
HWM
|
|
|
|
|
hi,
I actually have a very simple application,I need to retrieve 2 record from my database.Everytime I click a button then records should be displayed sequentially into my edit boxes.
So,for that I used the code while(!objrs.ISEOF()) and objrs.movenext() where objrs is the recordset object,I can get only one record.
so,pls solve my problem.
bye
swapna_signsin
|
|
|
|
|
|
swapna_signsin wrote: So,for that I used the code while(!objrs.ISEOF())...
Why are you using a while loop when you are only interested in two rows? That would not be very intuitive to someone having to read through the code.
swapna_signsin wrote: ...I can get only one record.
Have you called objrs.MoveNext() a second time to advance to the next row?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
i use ShellExecuteEx to open many other 3rd programme, then i use EnumWindows to get the main window by hProcess returned by shellexecuteex. i found that some programmes, such as notepad.exe, calc.exe, cmd.exe, work correctly. but it couldn't get the correct window of some programmes like word.exe.
|
|
|
|
|
ask yourself, what is the diffrenece between running notepad.exe and winword.exe?
one answer could be that notepad opens immediately and winword first opens a splash screen,
then initialize and only then display the main frame window....
the only way to overcome this is the hook into the creation of the process, and then find out who is the main window and use it.....
hope this helps
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
I want to create MFC Application to run console application
Example,when I click a button,it will run a specified console application to open another file.
Like the run command,EX : ConsoleApp Text.txt
Please help me!
|
|
|
|
|
I think you can use CreateProcess function with parameters that show you can use Console type
Agh
|
|
|
|
|
use ShellExecute or ShellexecuteEx
|
|
|
|
|
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hello
I want to Create a modaless dialog that user can't move it
how can i do it?
thanks.
Agh
|
|
|
|
|
when you drag the dialog a message is called i.e : SendMessage(WM_NCLBUTTONDOWN, HTCAPTION)
just override this message not to do its defaults...
hope this helps
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Add a CRect member to your dialog class and handle the WM_MOVE and WM_MOVING messages. In the WM_MOVE message handler call GetWindowRect() to get the position of the dialog, save it in the CRect member. In the WM_MOVING handler, set the values of the supplied CRect pointer to those in the saved CRect.
void CMyDialog::OnMove(int x, int y)
{
CDialog::OnMove(x, y);
GetWindowRect(m_Rect);
}
void CMyDialog::OnMoving(UINT fwSide, LPRECT pRect)
{
*pRect = m_Rect;
}
The method given above will only work if the user tries to move the dialog with the mouse, it will break when the user uses the Move command in the context menu.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
mehrdadov wrote: I want to Create a modaless dialog that user can't move it
Simply remove it caption bar!
|
|
|
|
|
Hi all
I have such code :
...
__int32 x = 0;
char *str = "1234";
x = (str[0],str[1],str[2],str[3]);
...
I know that the value of x will be 52. Can someone explain why ?
thank you in advance
|
|
|
|
|
Hi big_denny_200,
Homework?
__int32 x = 0;char *str = "1234";x = (str[0],str[1],str[2],str[3]);-->52
__int32 x = 0;char *str = "123A";x = (str[0],str[1],str[2],str[3]);-->65
__int32 x = 0;char *str = "123a";x = (str[0],str[1],str[2],str[3]);-->97
__int32 x = 0;char *str = "000a";x = (str[0],str[1],str[2],str[3]);-->97
or(000A)->65
Ok
|
|
|
|
|
thank you for reply white sky, but it is not homework
as I understood, x will receive the value of last character in text ?
Right ?
|
|
|
|
|
Hi big_denny_200
but(why x is 52)
__int32 x = 0;
__int32 x2 = 0;
char *str = "/01234aA";
x = str[0],str[1],str[2],str[3];//->47
x2 = (str[0],str[1],str[2],str[3]);//-->50
__int32 m_check=0;
m_check=str[0];//47
m_check=str[1];//48
m_check=str[2];//49
m_check=str[3];//50
m_check=str[4];//51
m_check=str[5];//52
m_check=str[6];//97
m_check=str[7];//65
//m_check is 65,Now whats test?
char *test;
test=(char*)&m_check;
//test is A
A=65
Do you know ascii code?
if you press Alt+65 then print A or if you pree Alt+97 then print a
Right?
-- modified at 12:30 Sunday 9th April, 2006
|
|
|
|
|
If we convert to string to ASCII (numbers in brackets are decimal):
"1234" -> 0x31(49) 0x32(50) 0x33(51) 0x34(52) 0x00(0)
Now operator, returns its second parameter. i.e. (1st, 2nd) evaluates to 2nd .
So the expression (str[0],str[1],str[2],str[3]) evaluates to (str[1],str[2],str[3]) which evaluates to (str[2],str[3]) which in turn yields (str[3]) - Which is 52.
Steve
|
|
|
|
|
I bought a book called "3D Game Engine Architecture's ".
There are two web addresses(as beblow) in this book.
These web addreses are not active(link failure) now.
Someone could know the web address change to what?
// Magic Software, Inc.
// http://www.magic-software.com
// http://www.wild-magic.com
// Copyright © 2004. All Rights Reserved
|
|
|
|
|
|
Hi all
lets say I have a file path c:\\foo.txt
How can I determine what Icon is set to it ?
thanks.
PS. I have an edit box with fileBrowse buttons and when user loads some file I want to display the file path in the edit box and its icon below.
|
|
|
|