|
You will need to use 'custom draw', a feature of the common controls including the list control. You can find information in the MSDN using "custom draw" as the search string. I would post a direct link for you, but the MSDN site seems to be acting up at the moment .
Custom draw lets you perform some or all of the drawing required for the control. It's easier than the 'owner draw' feature the traditional controls implemented, where you have to draw the whole thing. With 'custom draw' you can have the control do the standard drawing, and then add your piece where appropriate.
Software Zen: delete this;
|
|
|
|
|
use SetImageList()
路漫漫其修远兮,吾将上下而求索。
|
|
|
|
|
Thank you!
I understand how can I change the font of text for example, by custom draw.
But while I process the message of drawing an image, how can I draw the image (icon) at the center of the column?
|
|
|
|
|
If you know the dimensions of the icon, you can center it based on the RECT passed to the custom draw handler. Use the ::DrawIcon function to draw the icon.
Software Zen: delete this;
|
|
|
|
|
hi
i need to transfer a file from one system to another over LAN.
For that i use the code given at
http://www.thecodeproject.com/internet/SocketFileTransfer.asp.
At the receiving side while receiving it gives error WSAEWOULDBLOCK and number of bytes received -1. A blank file is created at the receiving side.
any clue please.
|
|
|
|
|
Although WSAAsyncSelect can be called with interest in multiple events, the application window will receive a single message for each network event.
As in the case of the select function, WSAAsyncSelect will frequently be used to determine when a data transfer operation ( send or recv) can be issued with the expectation of immediate success. Nevertheless, a robust application must be prepared for the possibility that it can receive a message and issue a Windows Sockets 2 call that returns WSAEWOULDBLOCK immediately. For example, the following sequence of events is possible:
1.Data arrives on socket s; Windows Sockets 2 posts WSAAsyncSelect message
2.Application processes some other message
3.While processing, application issues an ioctlsocket(s, FIONREAD...) and notices that there is data ready to be read
4.Application issues a recv(s,...) to read the data
5.Application loops to process next message, eventually reaching the WSAAsyncSelect message indicating that data is ready to read
6.Application issues recv(s,...), which fails with the error WSAEWOULDBLOCK.
Other sequences are also possible.
I Hope this Helps..........;)
kss
|
|
|
|
|
It has been such a very long time since I've coded the Win23API and now my memory escapes me. I want to iterate open windows (enumwindow) get their hWnd and then present them in a form with a checkbox next to each window. When the user puts a check in the box it will "Remove From Taskbar" when the remove the check it will "Show In Taskbar". I know how to do this inside the application but I cannot seem to find any documentation for how to do it to an application you don't own. It's been since 1999 that I did this stuff and I just don't remember now...
Clues???
I only read CP for the articles.
Code-frog System Architects, Inc.
|
|
|
|
|
There are a couple of window styles you can twiddle - WS_EX_APPWINDOW and WS_EX_TOOLWINDOW . There's also a COM interface for manipulating the taskbar: ITaskbarList .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
hello,
is there a non-registy way to change the default location of the special folders, like Favorites or Temporary Internet Files? Something that will complement the SHGetFolderPath function?
_KANE_
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
|
|
|
|
|
|
I know the difference between std::string and std::wstring etc, but I was wondering if there was a standard header file like tchar.h for defining a code neutral way of coding that would automatically select the proper string type to use depending on the UNICODE preprocessor define. I can easily roll my own, but is there a standard one?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I haven't found any! I have created an incomplete header that contained code like this:
typedef basic_string<TCHAR> tstring;
|
|
|
|
|
George L. Jackson wrote: I have created an incomplete header
Could you send it my way?
If so just send it to the email address you find in the emailed reply notification you get with this message.
Thanks
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I will need to look for it. I have not used it for some time since I only program on 32-bit platforms and only use Unicode. I think it might be at work.
|
|
|
|
|
Also, I just remembered a couple of problems I ran into using the header file.
The filename argument for file streams are always narrow, and support for multi-byte character strings is limited. However, I wrote the header file for vc++ version 6. I haven't used it with the new versions since I have been using MC++ or C++/CLI almost exclusively.
|
|
|
|
|
|
I decided to roll my own. It may not be perfect but I thought I would post here for posterity's sake.
#pragma once
namespace std
{
#if defined UNICODE || defined _UNICODE
typedef wstring tstring;
typedef wstringbuf tstringbuf;
typedef wstringstream tstringstream;
typedef wostringstream tostringstream;
typedef wistringstream tistringstream;
typedef wstreambuf tstreambuf;
typedef wistream tistream;
typedef wiostream tiostream;
typedef wostream tostream;
typedef wfilebuf tfilebuf;
typedef wfstream tfstream;
typedef wifstream tifstream;
typedef wofstream tofstream;
typedef wios tios;
# define tcerr wcerr
# define tcin wcin
# define tclog wclog
# define tcout wcout
#else // defined UNICODE || defined _UNICODE
typedef string tstring;
typedef stringbuf tstringbuf;
typedef stringstream tstringstream;
typedef ostringstream tostringstream;
typedef istringstream tistringstream;
typedef streambuf tstreambuf;
typedef istream tistream;
typedef iostream tiostream;
typedef ostream tostream;
typedef filebuf tfilebuf;
typedef fstream tfstream;
typedef ifstream tifstream;
typedef ofstream tofstream;
typedef ios tios;
# define tcerr cerr
# define tcin cin
# define tclog clog
# define tcout cout
#endif // defined UNICODE || defined _UNICODE
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
-- modified at 2:20 Sunday 12th February, 2006- 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
-- modified at 1:28 Sunday 12th February, 2006
|
|
|
|
|
How about:
extern tistream& tcin;
#endif
#ifdef _UNICODE
tistream& tcin = wcin;
#else
tistream& tcin = cin;
#endif That should be preferable to defines, as it will preserve the variable and typename, which may be helpful when debugging.
If you're not compiler sensitive (portability etc), you can always try
#ifdef _UNICODE
__declspec(selectany) tistream& tcin = wcin;
#else
__declspec(selectany) tistream& tcin = cin;
#endif __declspec(selectany) eliminates the need for a .cpp file, as it instructs the compiler to allocate space for the reference in one and only one compilation unit. Nice if you want to eliminate the need for lib files.
|
|
|
|
|
I have never tried the "__declspec(selectany)" solution. Thanks for the insight.
|
|
|
|
|
Just put something like this in you precompiled header ("StdAfx.h"):
#include <string>
#ifdef _UNICODE
typedef std::wstring tstring;
#else
typedef std::string tstring;
#endif // _UNICODE
Then use tstring like TCHAR and such.
Steve
|
|
|
|
|
I have used the basic_string<TCHAR> typefef myself in the past, but nowadays I _always_ compile for Unicode, and use std::wstring everywhere. I then link with the UnicoWS library so my apps work on Win9x. It hasn't given me any problems.
|
|
|
|
|
I am Using CArray as Two Dimensional Array Containing float type vlaues.Say for Example the inital size of the Array is [4][4] now i want to increase the size to [5][4]..And i want insert Row in between 2nd and 3rd rwos. Can CArray insert new row between 2nd and 3rd rows and will it adjust rest the data in the array to new size..?
Thanks Before
James
-- modified at 23:33 Saturday 11th February, 2006
|
|
|
|
|
Post a little code please.
How is the 2D array declared?
Is it realy setup as 2D array? Then yes.
Are you faking a 2D array? Then no, because you need to do the calculations?
Modifed:
Just read the previous post.
Hints:
Wheeler gave you a 2D array.
McFarlane gave you a fake 2D array.
Which are you using?
INTP
Every thing is relative...
-- modified at 11:24 Sunday 12th February, 2006
|
|
|
|
|
Hello everyone!
Alright, I have this struct:
struct Person<br />
{<br />
char FullName[50];<br />
int Age;<br />
};
I open a binary file with ios::out | ios::binary | ios::app , so it appends to the file, so there can be many of these structs in a file... The write function is fine, because it outputs alright if I use a single-reading function... Here's how I read it with the multiple-reading function:
int entries = getNumOfEntries(&dat_file);<br />
<br />
Person persons[entries];<br />
<br />
for (int x = 0; x < entries; x++)<br />
{<br />
dat_file.read((char*) &(persons[x]), sizeof(Person));<br />
}
It outputs some weird stuff... Anyone realize what I'm doing wrong? Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
An example of weird stuff would help.
You could try changing the conversion in the read statement to (unsigned char*).
Single stepping through the read loop should help.
The line "Person persons[entries];" is illegal and should not compile. I think you mean "Person* persons new Person[entries];".
Note: This does not affect you code, as written (povided you write records the same way), but unless you set packing for the structure, then the compiler will allign it to the next 4-byte boundry. So your structure size is realy 56 bytes not 54.
I assume that you have reopened the file with ios::in.
INTP
Every thing is relative...
|
|
|
|