|
O... I use VC6. So I have no .NET DVD. I find all examples are for VC7. When I use DHTML Edit Control, it always show office 2000 install message? Why ?
|
|
|
|
|
The Office message is because 2 years ago the dhtml edit component was installed along with all MS products, so i guess you have some registry keys out there attaching it to Office (you should know that the Office installer is a total mess by the way).
More info about the component here[^].
As the documentation says, MS regards it now as legacy as they are willing to sell VC7 and .NET stuff. It is obvious there are dollars here, than with just a tiny stand-alone SDK. Business as usual...
How low can you go ? (MS rant)
|
|
|
|
|
How do i display filenames and their icons in a Listbox?
Right now my app has all CListbox but let me know if I should change them to CListCrtl if it would be easier to display.
I tried searching for this information but I could not find. I understand people have created Classes out there to do this but I would like to just to it using CListbox or CListCtrl, unless it would be easier using an easily "plugable" Class.
I only need the code for the creation of the Listbox or control since I have the code to get the filename and their paths already finished.
Thanks,
Joe
www.joeswammi.com
|
|
|
|
|
A Listctrl would be a better choice since it supports images while CListBox doesn't. You can get the image of a file by using SHGetFileInfo - this can return the icon of the given file. Remember to use the flag SHGFI_USEFILEATTRIBUTES if the file in question isn't an executable file to avoid hitting the disk for each file displayed.
PJ Naughter has an excellent demo at http://www.naughter.com/filetreectrl.html[^] - you might want to use it as a base for your code.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Thanks I will check it out. Shortly after posting my question I finially found something http://codeguru.earthweb.com/imagelist/DirIconExample.html
If you have time check that out and let me know what you think, just off hand it looks like PJ's is more powerfull but I really havent looked at it yet
|
|
|
|
|
Hi.
Okay. I am considering Overlapped I/O and Completion Port I/O models as more robust non-blocking I/O for a Winsock program. Currently I use WSAAsyncSelect. I have some essential questions about the two I/O model.
- Overlapped I/O
Okay. I understand Overlapped I/O with respect to both the event and completion routine. I believe that a primary reason that the completion routine solution of an Overlapped I/O model is more powerful that the event solution is simplicity. For example, the event solution is limited to 64 sockets per worker threads.
Under both solutions and especially the completion routine, how do you associate the socket that caused the overlapped I/O to call the completion routine? In other words, let say socketXYZ triggered overlapped I/O to call its completion routine function. How do you determine inside the routine function that is performing send, recv, etc. on socketXYZ?
- Completion Port I/O
This is really a powerful I/O model and is hands down the best I/O model under NT and newer versions of Windows. I have three essential questions.
1) Lets say there are exactly ten active sockets associated with a completion port. As each socket become inactive via user disconnect, error, etc., how do you know when there are no sockets (zero socket) associated with the completion port? In other words, if you wanted to close a completion port when no socket is associated with it, How do you know when there is no socket associate with it?
2) Given that the call to GetQueuedCompletionStatus() return FALSE (failed), How would you know what sockets to close during cleanup since the completion port had crashed?
-----
Under either Overlapped I/O or Completion Port I/O how do you know when to connect, send, receive, etc. data? For example, in WSAAsyncSelect and WSAAsynEvent, you can can AND check FD_SEND, FD_READ, etc. However, in Overlapped I/O or Completion Port I/O, how do you know if there is data available or when the host/client is ready for you to send data?
Thanks,
Kuphryn
|
|
|
|
|
1) You have to keep track. Obviously, you will need all the socket handles stored somewhere. When you run out of socket handles in your list, you know that the IOCompletionPort no longer has any handles it is waiting on?
2) Again, you have to keep a list of socket handles.
My idea would be to create a Connection Manager, that maintains a list of connections (a class that would encapsulate the state of each socket connection, with the socket handle as a member). The pointer to the connection object can be the key on the IOCompletion Port. So, when the IOCompletion Port returns, you have the connection object along with it. Note: You may want to use some other key mechanism (other than using a pointer) because the key variable in the IOCP API is a DWORD and can cause problems when Windows becomes 64 bit.
If the IOcompletionPort crashes, you have to call a cleanup on the connection manager, which will inturn destroy all connection objects, and you can call closesocket in the destructor.
I could not find any API call that gives a list of sockets associated on the IOCP.
Hope this helps.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Thanks.
Your solution is very similar to the solution I current use for WSAAsyncSelect. I stored a socket object in a linked list.
Okay. Sounds like I will need to design a socket object for the Completion Port I/O.
Kuphryn
|
|
|
|
|
|
Hello,
I have a toolbar and I have the buttons set to "check" style so when they are pressed they stay down and the pressed again they pop back up.. the problem is that I change the image depending if the button is up or down.. I do the following to change the image.. the problem is the GDI Objects keep climbing and climbing and climbing every time i push the button.. I would assume this is a bad thing.
Am I doing any thing wrong??
// Set up image lists.
CImageList imageList;
CBitmap bitmap;
// Create and set the toolbar image list.
bitmap.LoadBitmap(IDB_UNSECURE);
imageList.Create(16, 16, ILC_COLORDDB|ILC_MASK, 3, 1);
imageList.Add(&bitmap, RGB(255,0,255));
m_wndFormatBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
imageList.Detach();
imageList.DeleteImageList();
bitmap.Detach();
bitmap.DeleteObject();
Any ideas?
|
|
|
|
|
Note from our friends at the MSDN (in the TB_SETIMAGELIST docs):
"Note: Your application is responsible for freeing the image list after the toolbar is destroyed"
I think you also need to delete the bitmap. So, I would suggest this:
CImageList imageList;
CBitmap bitmap;
bitmap.LoadBitmap(IDB_UNSECURE);
imageList.Create(16, 16, ILC_COLORDDB|ILC_MASK, 3, 1);
imageList.Add(&bitmap, RGB(255,0,255));
HIMAGELIST hOldImageList = m_wndFormatBar.SendMessage( TB_GETIMAGELIST, 0, 0 );
m_wndFormatBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
imageList.Detach();
imageList.DeleteImageList();
ImageList_Destroy( hOldImageList );
bitmap.DeleteObject();
Chris Richardson
|
|
|
|
|
I see exactly what your trying to do, pull the old image list and destroy it.. for some reason I can't do a HIMAGELIST blah = m_wndFormatBar(...) it says cant convert from a hImage to a long.. (or something like that) I just tried a few things real quick last night but didnt have time to do any further testing..
Thanks for the idea, I'm sure I'll get it figured out.
|
|
|
|
|
Sorry, I never actually built the code. You'll need to do a cast.
HIMAGELIST blah = (HIMAGELIST)m_wndFormatBar.SendMessage( TB_GETIMAGELIST, blah, blah );
Chris Richardson
|
|
|
|
|
I think from memory that imageList.Add makes a copy, in which case your bitmap.Detach is a memory leak.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Hi Gang,
Here's what I've got. I'm working in a doc/view architecture where I've got a tree control sitting on my left side of the screen. I don't have any problems with the line creation. (I'm just doing a simple paint style program, I've got an array of lines, it redraws each line as needed). What I'd like to do is to be able to have some sort of tree representation on the left that would list items like "Line","Text", etc.
What I can't figure out is how I let a tree-control know it needs to add elements to it's list.
I've got the tree control in a docking control bar on the left side.
As a user constructs a line, I know it's end points
Save off line info to array.
<missing step="" here=""> Insert item into the tree control so the user can reselect this specific line later on.
Later on, I'll want to respond to the tree control. As a user selects a line "Designator" in the tree control, I'll remove the line from my array and repaint the view.
Not if it weren't for that one missing step of how I tell the tree-control to add an entry......
Thanks for any help.
Sorry if this seems a little *rambly*.
I'm using VC.Net (only because I wanted to play with it anyways) on a WinXP/Pro box.
Thanks,
Nick
|
|
|
|
|
I suppose the "normal" way to do this would be to keep a pointer to a new Line object (or better, a DrawingObject object, which would be the base class of Line and Text) in your document class, then when the user creates a new line, call UpdateAllViews with lHint as some unique value out of some enum like NEW_ITEM_FOR_TREE_VIEW, then in your TreeView class, you can have an OnUpdate handler which would check lHint for NEW_ITEM_FOR_TREE_VIEW, and if it detected that, it would get the new object from the document. It's not as complex as I may have made it sound, but my brain is fried. If you have any questions, feel free to ask away!
Chris Richardson
|
|
|
|
|
I want to use CStringEx object.But I do not know how to load whole file to CStringEx object. If you know how to do that please tell me. Thank you.
|
|
|
|
|
If you are willing to fill a CString instance with the content of a file, you may use the CStdioFile class, and a simple while(!eof()){ += .ReadString() } .
How low can you go ? (MS rant)
|
|
|
|
|
For an integer I have:
bool IsNumber( LPCTSTR pszText )
{
ASSERT_VALID_STRING( pszText );
for( int i = 0; i < lstrlen( pszText ); i++ )
if( !_istdigit( pszText[ i ] ) )
return false;
return true;
}
However I need a routine to check if its a float. IsDigit returns false at the decimal point....I need to write a IsFloat( LPCTSTR pszText ) . How do I do this?
Appreciate your help,
ns
|
|
|
|
|
You need to check your string it there is a dot within two numbers.
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
Can you not just go under the assumption that if a period exists in the string then it's safe to say it's a floating point...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Only if you can guarantee that the program isn't used outside English-speaking part of the world. Out here some of us want to use comma as the decimal separator.
|
|
|
|
|
Pardon my English ignorance..
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Was considering that but I had quantities like 123.456:78 as well. So I thought that it would have to have "." but no ":" to be a float. Christians given me a good snippet and I'm going to doctor it up to handle my weird "numbers"...
Appreciate your help,
ns
|
|
|
|
|
As is often said, if you expressed what you want in plain english, it would be obvious to you.
bool IsFloat( LPCTSTR pszText )
{
ASSERT_VALID_STRING( pszText );
const int nLen = lstrlen( pszText );
int nDots = 0;
for( int i = 0; i < nLen ); i++ )
{
if (pszText[i] == '.')
++ nDots;
else if( !_istdigit( pszText[ i ] ))
return false;
}
return (nDots < 2);
}
That will return true for int and float, make it return (nDots == 1) to be true for float only.
Note, I did this in CP, it is untested, but the idea is sound.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|