|
Hi, I have ListView that shows files on local drives and want to let user select view mode. So application starts defaultly with ListView set to LVS_REPORT and when user selects another style of view, the proper style is set using following code:
ModifyStyle(LVS_TYPEMASK,(LVS_ICON & LVS_TYPEMASK));
Or with LVS_SMALLICON instead of LVS_ICON when user wants to show large icons, of course.
In report style everything is ok. But when I switch to LVS_ICON mode, it looks like on this picture (I took a screenshot of my ListView):
ListView in LVS_ICON mode
And, when I switch to LVS_SMALLICON mode, it looks like this:
ListView in LVS_SMALLICON mode
As you can see, first row is missing (but when I for example double click on that empty space, my program handles it correctly as the items would be there.
I must also mention that the ListView I use has Custom Draw feature (so I handle OnCustomDraw()) and it is Virtual ListView (so I handle OnGetDispInfo()).
I'm really out of my knowledge...
Thank you for any suggestion!
|
|
|
|
|
Hi i am wondering how to work the scroll bars in a dialog box that were enabled through the dialog editor by selecting horizontal scroll and vscroll
i cant figure out how becuase i cant edit thier properties with the dialog editor is there some special way to acess these?
|
|
|
|
|
hi,ive just started to use visual c++,and there was a sample in the MSDN library called drawcl, it iIllustrates Integrating Active Container Support with Application-Specific Features.i wanted to know how i could put text on the canvas at a position that the user want.thx
|
|
|
|
|
There are several solutions. One solution is DrawText(). Another solution is TextOut().
Kuphryn
|
|
|
|
|
Hello,
I was wondering if anyone had a good idea on how to convert the following...
CString strN;
strN.Format("%d", nNum); // where nNum is something like 1123456
I would like to see the output of strN equal "1,123,456"
Is there a easy way to do this?
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Someone mentioned the API GetNumberFormat a few days ago. It's the fancy way of doing it. I'm sure you can whip up a quick for loop that will do it just as well.
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Why don t u just put a comma after the third, the sixth... char?
Just make a loop which every 3 char inserts
a comma with CString::Insert for instance.
Something like this:
for(i,from begining to the end of the cstring)
{
if(i==3or6or9)
urstring.insert(",") //not the good syntax but u get the idea across
}
Is it what u meant?
hope it s of any help 2 u.
syl
sysy
|
|
|
|
|
Hi,
In the tree control at the time of inserting an item I put an application specific CString data with it as following:
m_TreeCtrl.SetItemData (hItem, (DWORD) ("Hello"));
But, if I try to use GetItemData the following way, the conversion gives error. Please let me know how I can convert a DWORD into a CString:
DWORD selelection = m_TreeCtrl.GetItemData (hItem);
CString str = (CString) selelection ;
|
|
|
|
|
Binayak wrote:
m_TreeCtrl.SetItemData (hItem, (DWORD) ("Hello"));
First off you will have to understand the a string, is not a number, so it cannot be converted to a DWORD!
Now, SetItemData associates the tree node with a DWORD (unsigned long, methinks); it does not an object class, or a string array.
Now as it happens, you can use the DWORD value as a pointer to an object, which in your case would probably be a string resource (or dynamically created array, if the string is unknown at the time).
-----
TCHAR* czStringArray[]={"Hello","Old","Boy"};
..
m_TreeCtrl.SetItemData(hItem, (DWORD)0);
..
..
DWORD nIndex = m_TreeCtrl.GetItemData(hItem);
CString strAssociatedString = czStringArray[nIndex];
cout<<(LPCTSTR)strAssociatedString<<endl;
you could also do the same with pointers to string values as well.
I Dream of Absolute Zero
|
|
|
|
|
Hi!
Using the winsock functions I am trying to make a chat program...
I have a server program and a client program but my server can only handle one client at a time! (I have blocking mode connection)
How can I handle multiple clients?
Thank you very much for your future answers!
Well... I am a beginner ...
|
|
|
|
|
There are several solutions. In theory and in practice, supporting multiple sockets using blocking I/O is quite unusual. In general, one solution is to keep track of all clients using a map.
I recommend an OVERLAPPED I/O model or IOCP.
Kuphryn
|
|
|
|
|
Hi, all:
I have a weird problem and need your help. I have a main app and DLL. In the main app I have my object pointer (CMyObj* pObj) that has method like:
HRESULT TranslateIDToName( long lID, LPSTR cBuff, UNIT dwBuffSize );
this TranslateIDToName then calls some methods in DLL.
In main, I have something like this:
const DWORD dwBuffSize = 128;
TCHAR cBuff[dwBuffSize];
pObj->TranslateIDToName( lID, cBuff, dwBuffSize );
When I compile both main app and DLL in RELEASE, (both uses Multithreaded DLL as Runtime DLL ). It works fine! However, if I compile both in Debug ( both uses Debug Multithreaded DLL ), I step through the code, The TranslateIDToName() fills up the cBuff correctly and then return from the function.
The problem comes when the function returns to the caller:
pObj->TranslateIDToName( lID, cBuff, dwBuffSize );
The pObj is trashed with either garbage in the pObj or pObj = NULL. In either case, the pObj address changes before calling the method and right after return from the method ( the Stack really messed up!!). Of course, the app crashes!
I tried all the stuff I can think of, and no more ideas about what could be wrong.
Any suggestion and help will be highly appreciated. Thanks in advance.
Dion
|
|
|
|
|
What goes on inside of TranslateIDToName()?
Kuphryn
|
|
|
|
|
I got the problem fixed. the problem is the array index out of range inside the function. thanks anyway.
|
|
|
|
|
Recently I've spotted the download manager "Hidownload" (www.hidownload.com),
and I'm wondering how they're analyzing the web-traffic.
They're catching url's to streamed RealMedia files, WMV files etc.
Now I know how to get download URL's from IE etc.,
but they seem to be doing it on a very low level.
(You have to specify which network-card you want to monitor.)
Does anyone have a clue how to do this ?
|
|
|
|
|
Some of the packet sniffer programs do the same thing....
First thing they do, is put your NIC into a "promiscuous" mode. This mode allows your computer to see all packets that pass by it, not just the ones that are destined for that machine.
This also assumes that the "watching" computer is on the same segment of LAN (same part of the network switch) that the "watched" machines are on.
I don't know how to accomplish this, but I do know that this is NOT SUPPORTED ON ALL ethernet adapters.
-p
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
Uhh... ok
I don't think it's needed to see all packets that pass by though,
after all all you want is to know what files are accessed by what protocol.
No need to spy on other datatraffic, right..?
|
|
|
|
|
Uhhh...
how are you gonna figure out what higher-level-protocols are in use? except to watch all packets that go by, and analyze those....
Your ethernet card knows nothing about actual protocols. It only knows how to accept or deny ethernet packets.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
I should add that I misread a bit.
They are sitting on the network card, and analyzing all data that comes to it. They don't need promiscuous mode, unless you want to see traffic generated on other machines too.
But the premise is the same, they are just watching the traffic coming over the card, and it's pretty easy to catch all of that that stuff at that point.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
Would you know of any source / info that could show me how to do this ?
(Get the lowlevel-packet-data ?)
|
|
|
|
|
Hi,
Try Winpcap for windows (Packet Capture Library) or pcap with unix machines.
WinPCap is a free download.
Satya
|
|
|
|
|
I am converting a dos app to a windows app. The application changes passwords for given a given user. The dos application accepts servername, username, and password as cmd line arg's. They are defined as char username[50], password[128], etc.
My dialog takes the username and password as CString's.
How can I convert the CString to make it compatible with the char [50], etc above?
Thanks!
"Keyboard Error - Press F1 to Continue"
|
|
|
|
|
To make a CString from char[]:
char username[50];
CString str;
str = username;
To make a char[] from CString:
CString str;
char username[50];
memset(username, 0, 50);
strncpy(username, str.LockBuffer(), 50-1);
str.UnlockBuffer();
Hope that helps
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
The calls to LockBuffer() and UnlockBuffer() are not necessary as the second parameter to strncpy() is expecting a LPCSTR , which CString provides. The same is true for GetBuffer() and ReleaseBuffer() .
|
|
|
|
|
Thanks! That worked great.
Frank
"Keyboard Error - Press F1 to Continue"
|
|
|
|