|
|
KarstenK wrote: As ever better do google to search MS-Stuff.
There's no point googling if you don't actually read the resulting pages
MSDN:
If you build an MFC _USRDLL using Visual C++, version 1.0
Believe me, we've been searching for answers and can't find anything relevant.
|
|
|
|
|
|
I've never seen such code before and don't know if it even compiles.
But it uses the conditional operator ( ?: ) in the return statement and continues to call the main method until i has been decremented below 0, and since the main method prints the value of i and the decrements it, the effect is to print 321.
Very bizarre code.
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
Homework?
There's two things you need to understand here, what static does to that variable declaration, and what the test ? then : else; operation means...
|
|
|
|
|
benjymous wrote: Homework?
No it's a puzzle posted in our intranet.
----------------------------
286? WOWW!
|
|
|
|
|
_8086 wrote: Does this print 321??
Yes. Remember i is static .
|
|
|
|
|
first of all, when posting code, please use the <pre></pre> tags to keep a well formated message.
then, to understand your result, keep in mind that static variables (declared within a function) stay local to the function (so, not visible from outside) but their lifetime changed to being the program lifetime. that is, a local static variable is initialized at the beginning of the application, and is destroyed when the program exits.
at the first call of the function, the variable as the initialization value. then, each time the function is called, it keeps the last value it had when the function last exited.
int main() {
static int i=3;
printf("%d", i--);
return i>0 ? main():0;
}
1. entering main for the first time:
i == 3
so, 3 is printed (because the i-- decremented the variable only after returning the current value)
i now equals 2
the i>0? main : 0 expression is evaluated. as i is strictly higher than 0, main() calls itself recursively
2. entering main for the second time:
i == 2
printing 2
i == 1 (after decrementation)
i > 0 , so re-entering main()
3. entering main for the third time:
i == 1
printing 1
i == 0 (after decrementation)
i not > 0 , so returning 0
for all the previous calls to main, the expression returns 0 either, until exiting...
|
|
|
|
|
You are hot today!
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
VuNic wrote: You are hot today!
|
|
|
|
|
|
hi all
i want to know about the connectivity of c++ with database sql and
how can i fetch and eneter data into sql database from my front end c++
thanks all
please send me this answer in detail
please...
hi
|
|
|
|
|
I'm sure, you will get some help from database[^] section.
|
|
|
|
|
There's a variety of ways. You can explore your options here: Data Access Programming[^]
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Hi
I need to get LAN speed (either read from NIC or by any other options)and want to diplay in my dialogbox
shyamraj009@indiainfo.com
|
|
|
|
|
Do anyone know how to customize the IDE(Integrated Development Environment)
of Visual C++.
How to add our own menu,toolbar etc, in the IDE.
Also how can we write the events for that menus.
|
|
|
|
|
|
I am coding for VC++6.0 application, now I want to upgrade my VC++ application to VC++.NET, so that it can run on Windows Vista, is there any tool present using which i can upgrade my application?
|
|
|
|
|
deepasaral wrote: I want to upgrade my VC++ application to VC++.NET
What do you mean by upgrade ? You can use VS2005 VS2003 IDE to open your project, and correct any warnings/errors, if occurs. Thats the way to go about it.
deepasaral wrote: so that it can run on Windows Vista,
Well, unless, there is some registry related code, there should not be any problem running it.
-- modified at 4:58 Thursday 29th March, 2007
|
|
|
|
|
prasad, VC++.NET is not VS2005 but VS2003
they removed the .NET part in the name since people were confusing about it's ability to produce native code
|
|
|
|
|
.
I genralized it.
|
|
|
|
|
Hi All,
I need to write some GUI application that uses CTreeView control.
I writing it with using ATL and use method like TreeView_SetItemState, TreeView_InsertItem and extra.
I'm using control attribute of check box --> each item have check box with some string.
I found out that in case of double click on some item i have problem on identify the current item.
What i mean is that in case the double click is on the string that describe the selected item than all work find and i getting the right HTREEITEM --- but in case the double click is on the check box of the selected item then i getting wrong HTREEITEM (!!!).
The method that getting the event return me LPNMHDR pnmh type -- with this type i do casting to
NMTREEVIEW* that will hold me
TVITEM itemOld;
TVITEM itemNew;
None of them are not hold me the info of the right HTREEITEM .
I must have the right HTREEITEM to know which item was selected in case of click event or/and double click event.
I will be happy to get any help to find out the problem.
Thanks.
|
|
|
|
|
Can you show(code), how you are doing this?
|
|
|
|
|
In the first column,I have put the image. And in the second column I have used both text and image
when user insert item in the list, but it's display only the name of file.The image is not display, Please Look at the source code.
LvItem.iItem=0; <br />
LvItem.iSubItem=0;<br />
if(metaFileReaderEnc->m_bIsDRM)<br />
{<br />
ImageList_AddIcon(hSmall, hIcon);<br />
LvItem.iImage=2;<br />
LvItem.mask =LVIF_IMAGE; <br />
}else<br />
{<br />
LvItem.pszText=_T(""); <br />
LvItem.mask =LVIF_TEXT;<br />
}<br />
<br />
SendMessage(hList,LVM_INSERTITEM,0,(LPARAM)&LvItem);
ImageList_AddIcon(hSmall, hIcon);<br />
if(directory==true)<br />
{<br />
size_t pos = ListviewFolder.find_last_of("\\"); <br />
ListviewFolder=ListviewFolder.substr(pos+1,ListviewFolder.length());<br />
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,ListviewFolder.c_str(),(int)(ListviewFolder.length() + 1),w_ListviewFolder,MAX_PATH);<br />
LvItem.iSubItem=1; <br />
LvItem.iImage=1;<br />
LvItem.pszText=w_ListviewFolder;<br />
}else<br />
{<br />
LvItem.iImage=0;<br />
LvItem.iSubItem=1;<br />
LvItem.pszText=w_onlyfilename;<br />
}<br />
LvItem.mask = LVIF_TEXT|LVIF_IMAGE;<br />
SendMessage(hList,LVM_SETITEM,0,(LPARAM)&LvItem);<br />
I want to add three more things .
1)I want to display my first column's image on right side(right alingement)
2)for second column when it control goes in else part actually shown image in second column but it displays that image in fist column only display the text in second(Actually should display the fileicon and name) .
3) Now When i close this application I have written xml file . for First column it only image then how can i check the item?
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Did u set the image list to the list view using the LVM_SETIMAGELIST function?
amitmistry_petlad wrote: ImageList_AddIcon(hSmall, hIcon);
did u check the above function return success?
amitmistry_petlad wrote: 1)I want to display my first column's image on right side(right alingement)
If you want to do so, you have to do custom draw( by handling NM_CUSTOMDRAW notification)
2- i didnt understand
3. if a cell have only image, and if you call Getitem, the pszText member of the LVITEM will be having 0 length.
nave
|
|
|
|