|
kilt wrote: MS Acc
Care to elaborate what that is?
kilt wrote: 1 line of code
I'm sure the OP (that's not me) would love you to share that with him.
[edit] Looking at the messages you've posted, you do a hell of a lot of criticising of other peoples contributions - maybe you might like to contribute something to the site for a change?[/edit]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
modified on Saturday, June 20, 2009 8:11 PM
|
|
|
|
|
Hello
I am working on VS 2003 and getting compiler warnings saying that those 2 above mentioned functions are depreciated. I know VS 2008 they have sprintf_s and other more safer functions. But there's no way for me to upgrade to 2008.
So can anyone tell me how to get those compiler warnings go away, without setting the warning level to low priority.
That is, i would like to use a wrapper around the sprintf function which will do the type checking to make sure the buffer is of valid size.
Is there any function like that i can use VS2003?
Any help is welcome.
|
|
|
|
|
dipuks wrote: I am working on VS 2003 and getting compiler warnings saying that those 2 above mentioned functions are depreciated.
If the compiler is telling you they are deprecated, then is it also telling you what to use instead? I find it hard to believe that the compiler would know enough to complain, yet not provide any means by which to correct the problem.
In any case, you might have to use _CRT_SECURE_NO_WARNINGS .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
you probably know the signature and functionality of the safe functions; why wouldn't you start using them: implement them yourself, it only takes a couple of lines of code to come up with something that satisfies the interface and is a lot safer than the old unsafe stuff.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Luc Pattyn wrote: it only takes a couple of lines of code to come up with something that satisfies the interface and is a lot safer than the old unsafe stuff.
Uhm........
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi Luc Pattyn ,
If Possible please try to help me regading the thread increase the DialogBox size during Runtime which was posted by me....
|
|
|
|
|
to disable particular warning without decreasing warning level
#pragma warning (disable:4996) // i hope, the warning number is true.
|
|
|
|
|
dipuks wrote: Is there any function like that i can use VS2003?
StringCchCopy()[^] is a safer alternative to sprintf . You will need to #include "strsafe.h" and link to strsafe.lib .
You might want to take a look at String functions[^]
dipuks wrote: I know VS 2008 they have sprintf_s and other more safer functions. But there's no way for me to upgrade to 2008.
You just need to download the latest SDK. Can't you?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh,
Is this function a replacement for sprintf, strcpy , strcat? I mean, is there similar replacement fuctions?
Also am not sure whether i will be able to download latest SDK, unless its free from Microsoft.
Do you think this will satisfy the compiler?
I know that if i use sprintf_s in place of sprintf, the compiler will be happy. But unfortunately my working environment is VS2003 and there is no way of updating to 2008.
Do you know of any wrapper for sprintf, which will do the similar kind of work that sprintf_s will do? So that i can make sure that i will sprintf only once.
|
|
|
|
|
Did you read my reply or not? I clearly mentioned that StringCchPrintf is a replacement for sprintf and it is a secure function. Please read it properly again. I also gave you a link to a set of string functions that are safe, which you should have a look at.
If you try to use any of those functions, you will know what it does.
SDK is free for download and the latest one is available here: http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi
I built myapp. I can not get it started. I got HEAP invalid allocation problem.
How can I solve this problem?
Best regards,
|
|
|
|
|
Where does this allocation occur? Can you show us the offending line?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The app tried to connect to firebird database. It stoped at "new".
|
|
|
|
|
transoft wrote: The app tried to connect to firebird database. It stoped at "new".
How can we help you if you give us info so sparingly?
You should report the line, as it is (and probably more relevant code), in order to get any help.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thank you very much for replying my question. I found out the problem.
It is wired. I add one file from firebird DLL project to my app project. Then everything works.
Best regards,
|
|
|
|
|
It's always better posting questions with code snippet for this kind of issues.
Proabably you're passing an Unintialized variable ( 0xCDCDCDCD the default value for an uninitialized variable assigned by C runtime library. ) Check whether you're passing proper size to allocate.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Hi,
im using the below code to resize the Dialog during Runtime...ie im overriding DoModal()
function...
CTestDlgDlg is my application name....
INT_PTR CTestDlgDlg::DoModal()
{
CDialogTemplate dlt;
int nResult;
// load dialog template
//CTestDlg::IDD is the ID of my resoource...
if (!dlt.Load(MAKEINTRESOURCE(CTestDlg::IDD))) return -1;
// set your own font, for example "Arial", 10 pts.
dlt.SetFont(L"Arial", 12);
// get pointer to the modified dialog template
LPSTR pdata = (LPSTR)GlobalLock(dlt.m_hTemplate);
// let MFC know that you are using your own template
m_lpszTemplateName = NULL;
InitModalIndirect(pdata);
// display dialog box
nResult = CDialog::DoModal();
// unlock memory object
GlobalUnlock(dlt.m_hTemplate);
return nResult;
}
The issue every controlin the DialogBox is getting increased except checkbox,Radio button..please let me know can i increase the size of the checkbox,RadioButton in this case....
|
|
|
|
|
anybody please give reply...
|
|
|
|
|
I've suspected before, but this makes it certain - why do you feel the need for two CodeProject identities?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi stuart,
Sorry for this.. the issue when i stopped using the first id for longtime...i forgot the password so i have created the second one...but when i got to know the password of first id i started using both ....
|
|
|
|
|
I think, it's an abnormal behaviour. That is, every control should increase proportionally. May be, you know that sizes of dialog controls are in base units depending "a" font. At runtime, they are converted to screen coordinates (that is, in pixel) depending a chosen font. The system uses the average character width of the font to calculate the position and dimensions of the dialog box controls. The same should be applied to all controls. None has any size in any other units (except dialog units) before displaying. So increase or decrease should be proportional.
If not, those controls probably aren't standard windows' (pre-defined) controls. If they are customized, problem may be with their drawing, sizing (WM_SIZE) or setfont (WM_SETFONT) handler (if any).
|
|
|
|
|
No those controls were drag and dropped from the Toolbox...of the solution ...
|
|
|
|
|
Let me suggest this[^] codeproject article. Its all about resizing dialog box and controls.
|
|
|
|
|
Hi,
I need to write some code in C++ that will connect to an SQL table, run a query and then modify a text field in the SQL table if a condition is met. In the code below, if the Blend Status field = "APP" in the SQL table, I want to change it to "DNL". With the code below, I get the following error on the line "custatus.m_BlendStatus = "DNL";" when I compile:
error C2106: '=' : left operand must be l-value on the line "custatus.m_BlendStatus = "DNL";"
I'm not sure what the problem is or how to fix it. Any help would be appreciated.
Thanks in advance.
<pre>#include "stdafx.h"
#include "all_tool.h"
#include <atldbcli.h>
#include <string.h>
#include <time.h>
class CCUSTATUSAccessor
{
public:
TCHAR m_Id[50];
TCHAR m_RevisionId[50];
TCHAR m_BlenderId[50];
TCHAR m_BlendStatus[4];
DATE m_DateModified;
//output binding map
BEGIN_COLUMN_MAP(CCUSTATUSAccessor)
COLUMN_ENTRY(1, m_Id)
COLUMN_ENTRY(2, m_RevisionId)
COLUMN_ENTRY(3, m_BlenderId)
COLUMN_ENTRY(4, m_BlendStatus)
COLUMN_ENTRY(5, m_DateModified)
END_COLUMN_MAP()
};
CString BIName;
CString BIRevision;
CString BIStatus;
int ConnectOK = 0;
int a = 0;
time_t now;
HRESULT hr ;
hr = CoInitialize(NULL);
CDataSource ds;
CSession session;
CDBPropSet propSet(DBPROPSET_DBINIT);
propSet.AddProperty(DBPROP_AUTH_INTEGRATED, OLESTR("SSPI")); //Windows NT Authentication('SSPI')
propSet.AddProperty(DBPROP_INIT_CATALOG, "AmmDb"); //Database Name
propSet.AddProperty(DBPROP_INIT_DATASOURCE, "WOpenBPC"); //Computer Node Name
hr = ds.Open(_T("SQLOLEDB.1"), &propSet);
if(SUCCEEDED(hr))
{
ConnectOK = 1;
}
if (ConnectOK == 1)
{
hr = session.Open(ds);
if (SUCCEEDED(hr))
{
//Get the Blend Order Name and Revision
io.GetFromDatapool(BIName, DataLoc, "BlendOrderName");
io.GetFromDatapool(BIRevision, DataLoc, "BlendOrderRevision");
CCommand<CAccessor<CCUSTATUSAccessor> > custatus;
hr = custatus.Open( session, "Select * FROM CU_STATUS WHERE (Id = " + BIName + ") AND (Revision = " + BIRevision + ")" , &propSet);
if (SUCCEEDED(hr))
{
//Update the Blend Status when the blend is loaded to OpenBPC.
hr=custatus.MoveFirst();
if (SUCCEEDED(hr))
{
time (&now);
if (custatus.m_BlendStatus == "APP")
{
<b>custatus.m_BlendStatus = "DNL";</b>
hr = custatus.SetData();
custatus.Update();
custatus.m_DateModified = now;
hr = custatus.SetData();
custatus.Update();
}
else
{
custatus.m_DateModified = now;
hr = custatus.SetData();
custatus.Update();
}
}
}
}
}
else
a=1.0;</pre>
|
|
|
|
|
thebouge wrote: I'm not sure what the problem is or how to fix it. Any help would be appreciated.
There are a large number of Database Articles[^] here on CodeProject. Maybe you check them out.
|
|
|
|