|
Code-o-mat wrote: const char str[] = {"C:\\Documents and Settings\\Test\\TestData"};
No need for curly braces here.
|
|
|
|
|
But they don't hurt either.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
str is a char*, and a pointer has always a size of 4 bytes. sizeof returns the size of the pointer in this case, not the content. As Rajesh mentioned, you should use strlen instead.
|
|
|
|
|
You can try:
const char str[] = "C:\\Documents and Settings\\Test\\TestData";
int i = sizeof(str);
The difference is the name of array and the pointer.
|
|
|
|
|
goonyangxiaofang wrote: the difference is the name
funny.
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]
|
|
|
|
|
Why funny?
This is the first time I come here.So maybe my answer is wrong or stupid, but please do not laugh at me.
|
|
|
|
|
Because the sentence "The difference is the name of array and the pointer" is actually funny.
Your answer is neither wrong nor stupid: it's just imprecise in a funny way: I'm laughing at it, not at you.
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
I want to implement the feature "Show In Groups" (Arrange Icons By -> Show In Groups)in the MSF( Please visit to link http://www.codeproject.com/KB/shell/msf3.aspx? for more details). Please help me how can I implement this feature?
Regards,
-Gurjant
|
|
|
|
|
gurjant singh wrote: I want to implement the feature "Show In Groups" (Arrange Icons By -> Show In Groups)in the MSF
Since you already have the link to the creator of MSF (posted in bold rather than as a link[^], you know where to look.
|
|
|
|
|
Hi to All,
Could anyone please tell me, in which case program can be crush before main. And most importantly, how do we handle that?
thanks in advance
-----------------------------
I am a beginner
|
|
|
|
|
If you have global objects in your program their constructor runs before main gets executed and if these perform something ugly then your program will crash before hitting main. And you handle it by not doing anything that causes your program to crash. What do you mean by "How we handle that"?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
thanks
-----------------------------
I am a beginner
|
|
|
|
|
hrishiS wrote: how do we handle that?
We don't launch your program...
On the serious side: What program (or, at least kind of)? Could you please elaborate (and possibly post some code)? Could you debug it (the call stack window is usually pretty informative)?
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]
|
|
|
|
|
Sounds like an interview / homework question to me
|
|
|
|
|
Yes, maybe.
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]
|
|
|
|
|
Hello all
i made an application in which i had to display icons next to menu item and i did it successfully and it works fine in windows 2000, vista, 7 but in case of windows 2003 and Xp, there lies a problem as if in case any tool tip is displayed over my context menu, the menu item over which the tool tip lies that menu item`s icon (Only Icon And Not The Text)gets erased......
Can Anybody Suggest me where exactly the problem lies
Any help is highly appreciated
Note :: It happens Only In Case Of Win 2003 and Win. Xp
|
|
|
|
|
Did you display the popup menu the way it is suggested here[^]? I mean this:
SetForegroundWindow(hDlg);
TrackPopupMenu( hSubMenu,
TPM_RIGHTBUTTON,
pt.x,
pt.y,
0,
hDlg,
NULL);
PostMessage(hDlg, WM_NULL, 0, 0);
I know this seems unrelated to the drawing part but who knows...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi all,
I have migrated my application(vs-2003 developed) into vs-2008 to be worked on vista machine.I got the .exe and working successfully when i enter a valid username and valid password but fails when i enter a wrong password/username......I am using SYBASE for my aplication,so it comunicates with some SYBASE dlls to get the access.
the code looks like below
(I am providing login details from other dialog)
int DBInterface::LoginSequence (BOOL bFirstLogin)
{
CString user_name;
char dbver[16];
CString srvrname, dbname;
char uname[33];
char upwd[33];
UINT msg;
if (bFirstLogin)
{
dbinit ();
dbsetlogintime (8);
dbmsghandle ((MHANDLEFUNC) msghandle);
dberrhandle ((EHANDLEFUNC) errhandle);
}
int rv = 0;
while (Ops.m_bAutologin && bFirstLogin)
{
if (CSD_DdeReqUserName (uname) == 0)
break;
if (CSD_DdeReqUserPassword (upwd) == 0)
break;
srvrname = App.GetProfileString (INI_SEC, _T("DBServer"), "");
if (srvrname.IsEmpty ())
break;
dbname = App.GetProfileString (INI_SEC, _T("DBDatabase"), "");
if (dbname.IsEmpty ())
break;
strcpy (_loginfo.dbid, uname);
strcpy (_loginfo.dbpwd, upwd);
strcpy (_loginfo.dbsrv, srvrname);
strcpy (_loginfo.dbdb, dbname);
_dbproc = dbConnect (&_loginfo, "Phoenix");
if (_dbproc == NULL)
break;
rv = 1;
TRACE0("Phoenix: successfully logged in using LOGPARMS from anotherapp...\n");
break;
}
CLoginDlg dlg;
while (rv == 0)
{
if (dlg.DoModal() != IDOK)
{
PostQuitMessage(0);
return 0;
}
else {
lstrcpyn(_loginfo.dbpwd, dlg.m_csPassword, 31);
lstrcpyn(_loginfo.dbid, dlg.m_csUser, 31);
lstrcpyn(_loginfo.dbsrv, dlg.m_csServer, 31);
lstrcpyn(_loginfo.dbdb, dlg.m_csDatabase, 31);
}
_dbproc = dbConnect (&_loginfo, _T("Phoenix") );
if (_dbproc != NULL)
break;
msg = (::GetKeyState (VK_CAPITAL) & 0x0001) ?DS_ERR_LOGINFAILEDCAPS : IDS_ERR_LOGINFAILED;
if (AfxMessageBox (msg, MB_OKCANCEL | MB_ICONHAND) == IDCANCEL)
{
PostQuitMessage(0);
return 0;
}
}
In the abobe code from dbconnect()(bold code) it is calling some SYBASE dll and it is not getting the return value when i enter wrong password/username.......
Is there any problem with the dll or anyting else?????
Since i have migrated the code i am thinking that the dll is not compatiable,but this is just an assumption....!
So can anybody help me to solve this issue......
Thaks in advance.
|
|
|
|
|
BTW: why don't you write a minimal application just to test the dbConnect call?
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 thanks for the reply...
From dbConnect() control is not getting a return value from a specific dll of SYBASE(hopefully libsybdb.dll) when i enter a wrong password/username..
Sybase works fine for vista ????
|
|
|
|
|
Vetukuri Raju wrote: ybase works fine for vista ????
I don't know. Why don't you make some tests?
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 everybody.
I need data in edit box : 5 line, 1 line max = 50 characters. then I must set font Courier for Edit box. i using code:
... ::OnInitDialog()
{
CFont m_Font;
VERIFY(m_Font.CreateFont(
12, // 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
"Courier")); // lpszFacename
CWnd *pWnd = GetDlgItem(IDC_MESSAGE_TEXT);
pWnd->SetFont(&m_Font);
m_Font.DeleteObject();
...
}
=>Data in Edit text is Bold. When I using mouse to choice this Edit text , it show text wrong. seem, it need control of mouse.
for example: show text wrong when type : "y" or "g", it have lost under.
i wish you help me. thanks very much.
**) when using all character UPPER ==> 1 line don't show 50 character.
hope your help. thanks very much
regards
nothing
|
|
|
|
|
First, m_Font needs to persist - you have declared it on stack, therefore it will be destroyed when OnInitDialog() exits. Make it a class variable.
Second, if all you're trying to do is limit the text to 50 characters, you can use pWnd->SetLimitText(50) on the edit box. No need to change the font.
|
|
|
|
|
Hans Dietrich wrote: First, m_Font needs to persist
Not necessarily, I have been using this for years (usually in OnInitDialog):
CFont f1;
LOGFONT lf1;
::ZeroMemory(&lf1, sizeof(lf1));
lf1.lfHeight = 14;
lf1.lfCharSet = ANSI_CHARSET;
lf1.lfWeight = FW_BOLD;
::lstrcpy(lf1.lfFaceName, "Verdana");
f1.CreateFontIndirect(&lf1);
GetDlgItem(IDC_STATUS)->SetFont(&f1);
f1.Detach();
modified on Monday, October 5, 2009 1:06 PM
|
|
|
|
|
thanks everybody very much. thanks Hans Dietrich and Michael Schubert
Michael Schubert answer very good .
nothing
|
|
|
|