|
You will find the first one more common in Unix apps and Win32 ports of Unix apps.
If you are looking for a way to process command-line arguments (even in an MFC app), see my article XGetOpt.
Best wishes,
Hans
|
|
|
|
|
I'm trying to make a list of thumbnails in a listview window. So far I can only make it work with resource bitmaps, when i try a hard coded jpg, i get get a blank image, with "hiya" under it
Its probally something really dumb, but i just cant find it. If anyone could point it out i'd be very grateful
(I'm almost positive its not the Bmp variable, the function does return a BITMAP)
//Here's the code
//Opens a thumbnail struc and sets its x and y
thumb = openThumb(&x ,&y);
_bstr_t txt("Hiya");
//Gets Handle to the listControl
hThumbList = GetDlgItem(g_hWnd ,IDC_LIST_THUMB);
//x = 160, y = 120
hImageList = ImageList_Create(x,y,ILC_MASK | ILC_COLOR32,0,0);
Bmp = getThumbBmp(g_hWnd,hPicDC); //Returns a HBITMAP
//Adds bitmap to the list as position 0
ImageList_Add(hImageList, Bmp, NULL);
SendDlgItemMessage(g_hWnd,IDC_LIST_THUMB,LVM_SETIMAGELIST,0,(LPARAM)hImageList);
lvi.mask = TVIF_TEXT | TVIF_IMAGE;
lvi.pszText = txt;
lvi.iImage = 0; //First Image added
// Insert info to the Listview
SendMessage(hThumbList ,LVM_INSERTITEM,0,(LPARAM)&lvi);
|
|
|
|
|
simple, imageList doesn't support jpeg compressed images. only raw bitmaps.
try using GDI+ to load the jpeg and then get an HBITMAP from it.
|
|
|
|
|
how to have global variables in a file ay _afxvars.h included in the stdafx.h and used by many modules. I found errors in that unless i declare them static,i get linker errors but making static will not change the value of the variables even when changed.functions is not a problem.help.
|
|
|
|
|
try this:
extern int Global1;
extern int Global2;
int Global1 = 0;
int Global2 = 0;
Software Zen: delete this;
|
|
|
|
|
I have written a COM component in VC++ that connects to a ODBC (.mdb file) through OLE DB. When i try to use it in .asp page i get error (0x80004005 - unspecified error). The same component (same asp file) works fine with PWS under Win98. When i run the same with IIS5 in Win2000 and WinXP i get error. I couldn't find out what might be the problem. Can you help me out?
Thanx in advance
Mahesh
|
|
|
|
|
That's because the connection string is different. The ADO/OLEDB section from the ASP documentation shows exactly what it expects.
PWS is a stripped down version of IIS and works with less stringent constraints. That's why it works with PWS.
|
|
|
|
|
Thanx Rod,
Actually i created the OLE DB connection using the 'Data Consumer ATL'. I look at it and try to fix it. Thanx once again.
Mahesh
|
|
|
|
|
Hi guys
i'm trying to get a listview full of thumbnails to load. kinda exactly like this tutorial:
http://www.codeproject.com/listctrl/thumbnailview.asp
only problem is, theres no source code provided, and i can't figure out what type his "m_imageList" class is
is it some kind of MFC listcontrol class? i can't use any stdfx stuff in my program, so if it is i'm screwd... if not where can i DL the code for the class
any help (soon) would be greatly appriciated!
-Mortis
|
|
|
|
|
D'oh
its looking like MFC, in that case, i'll change the question to:
does anyone know a simliar example in WIN32 API?
|
|
|
|
|
|
will do, thanks for the link
|
|
|
|
|
Hi.
Can anyone explain to me once and for all why do i see people write something like:
if (0==myVar)
{
...
}
instead of:
if (myVar==0)
{
...
}
what difference does it make ?
|
|
|
|
|
Simple. Your compiler will tell you if you type
if (0 = myVar)
whereas
if (myVar = 0 )
will compile and will always set myVar to 0 and evaluate to true.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Christian Graus wrote:
if (myVar = 0 )
will compile and will always set myVar to 0 and evaluate to true.
A typo, I guess Christian...
The value of the expression "A = B" is the value of A after the assignment, i.e. the value of B. Thus, "myVar = 0" evaluates to 0 and false.
--
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
both of you got it wrong...
i asked what is the difference between:
if (a==0)
{
}
and
if (0==a)
{
}
and not between:
if (a=0)
{
}
and
if (0=a)
{
}
(notice the extra = sign which makes a big difference)
|
|
|
|
|
Lior Shoval wrote:
both of you got it wrong...
i asked what is the difference between:
if (a==0)
{
}
and
if (0==a)
{
}
Christian did answer that one (although he rationalized a couple of '"''s off ). I merely made it clearer what a = 0 evaluates to.
--
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
checkout my reply to Johann and try to re-answer.
Thanks.
|
|
|
|
|
They did answer. If you get in the habit of always typing the constant first, the compiler will emit an error message when you mistakenly type one equals ('=') instead of two ('==').
Other than that, the only difference between (a == b) and (b == a) is the order of evaluation.
Software Zen: delete this;
|
|
|
|
|
Thanks.
I was under the impression that it had somthing to do with compiler or preprocessor optimizations...
|
|
|
|
|
That means, that using the first method is better to catch typos like "=" that act like assignments?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yes. The people who use that method like it for that reason.
I don't use the method myself, since it reduces the readability of the conditional expression. For example, the expressions (x == 7) and (7 == x) evaluate the same and produce the same result. If you're reading the code, however, the first expression is read as "if x is equal to 7 " and the second expression is read as "if 7 is equal to x ". The reading of the second expression seems awkward to me. I prefer to think of testing a variable against a constant.
Software Zen: delete this;
|
|
|
|
|
I also prefer the second method (var == 0). dunno why, I just got used to it and find it easier to read.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I have the same problem. It just feels more natural, and easer to read/write (x==7) instead of (7==x). But good habits (a.k.a constant==variable) are good habits. I keep trying to break this one, but habits are haibts.
Trust in the code Luke. Yea right!
|
|
|
|
|
Unless, of course, you use warning level 4, which will give the compiler warning "warning C4706: assignment within conditional expression" if you try to do if (myVar = 0) . This happened only in VC++ 5 or 6, I believe; before that, you had to do the if (0 = myVar) hack to get the compiler to complain.
Best wishes,
Hans
|
|
|
|