|
Have you tried using the ILD_TRANSPARENT option and when creating the image list using:
m_Images.Create(X, Y, ILC_COLOR32 | ILC_MASK, 1, 500);
Then when you add an image to the list you can specify what colour is the transparent background for that image.
Roger Allen - Sonork 100.10016
Strong Sad: I am sad I am flying
Who is your favorite Strong?
|
|
|
|
|
I was using ILC_COLOR
How do I print my voice mail?
|
|
|
|
|
Hi all,
I'm using a CTreeCtrl with checkboxes enabled and have two questions:
1. How can I query if a particular HTREE item has a checked checkbox or not
2. How can I be notified when checkboxes are checked/unchecked?
Thanks
Mark
|
|
|
|
|
MSDN:
BOOL CTreeCtrl::GetCheck( HTREEITEM hItem ) const;
or
CTreeCtrl::GetItem( TVITEM* pItem );
in TVITEM : UINT state;
Flag TVIS_SELECTED is set if the item is selected
CTreeCtrl::HitTest
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I agree with Papa
On CTreeCtrl I subclass and then do (almost) the same as below.
On CTreeView.
void CLeftView::OnLButtonDown(UINT nFlags, CPoint point)
{
UINT uFlags;
HTREEITEM hItem;
BOOL bChecked;
// let tree control update before getting the check state
CTreeView::OnLButtonDown(nFlags, point);
hItem = GetTreeCtrl().HitTest(point, &uFlags);
if ((hItem != NULL) && (TVHT_ONITEM & uFlags))
{
bChecked=GetTreeCtrl().GetCheck(hItem);
GetDocument()->UserClicked(hItem,bChecked);
}
}
|
|
|
|
|
in MFC Dialog based application, how could I get the HWND of the Dialog? in Doc/View m_hWnd will represent the blank area, right? I tried to use m_hWnd in Dialog application, but it seems that m_hWnd doesn't work in this case. Anybody knows how to solve it?
|
|
|
|
|
Use AfxGetMainWnd
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
m_hWnd is a member of the CWnd class, hence it is a member of all derived classes, including CDialog and its derivatives. In a doc/view application you've got at least two windows, the mainframe and the view, with window handles of their own.
In a dialog based application you've got at least one window, the class derived from CDialog, with its own window handle. Each control you create in the dialog is a window and they all have their own window handles.
What I mean is just to be careful, the window handle you are trying to use might not be the one you think you are using.
What are you trying to do? There may be another approach to the problem.
--
Roger
|
|
|
|
|
-alok- wrote:
in MFC Dialog based application, how could I get the HWND of the Dialog?
Use GetSafeHwnd() .
-alok- wrote:
I tried to use m_hWnd in Dialog application, but it seems that m_hWnd doesn't work in this case.
Define "doesn't work".
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I have this method:
ENC_RETURNENC_Create_Overlay_Window(UINT enc_id, HWND hWndParent, HWND* hWndOverlay, int x, int y, UINT nWidth, UINT nHeight);
Arguments:
enc_id encoder identifier
hWndParent parent window handle
hWndOverlay overlay window handle address
x overlay window position(left)
y ... (top)
nWidth ... (width)
nHeight ... (height)
this method creates a overlay window for video display, when I call this method in Doc/View like this
RECT rc;
GetClientRect(&rc);
enc_return = ENC_Create_Overlay_Window(ENC_ID, m_hWnd, &hWndOverlay, 0, 0, rc.right, rc.bottom);
the overlay window will be created exactly inside the View.
however when I call it in Dialog like this
RECT rc;
GetClientRect(&rc);
enc_return = ENC_Create_Overlay_Window(ENC_ID, m_hWnd, &hWndOverlay, 0, 0, rc.right, rc.bottom);
or
RECT rc;
GetClientRect(&rc);
enc_return = ENC_Create_Overlay_Window(ENC_ID, GetSafeHwnd(), &hWndOverlay, 0, 0, rc.right, rc.bottom);
the overlay window will appear at the left top of my screen no matter where my dialog is. I suppose this method didn't get the right window.
|
|
|
|
|
How does ENC_Create_Overlay_Window() create the new window?
What windows styles ís the window created with?
I suspect you are using the WS_OVERLAPPED style and that requires the window coordinates given in screen coordinates. The coordinates you have provided (0,0,rc.right,rc.bottom) will most certainly create a window in the upper left corner of the screen if it is an overlapped window.
From where do you call ENC_Create_Overlay_Window()?
If you are using the WS_OVERLAPPED style, try GetWindowRect() instead of GetClientRect().
--
Roger
|
|
|
|
|
Just a guess but it sounds as though you are being plagued by screen versus client coordinates.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi All
I'm a bit of a network newbie, so sorry if this is a dumb question:
I'm writing a simple proxy server which needs to handle http and ssl tunnelling (for https requests) I've got the basic http stuff done, but I'm having trouble with the tunnelling and wondering if anyone out there can give me some pointers..
I get the request from the client:
CONNECT secure.some_host.com:443 HTTP/1.0
<Some Headers>
CRLF
I connect to secure.some_host.com on port 443, and if successful, return following to the client:
HTTP/1.0 200 Connection Established
CRLF
I then wait for the client to send the data, which in this case will be an SSL stream, but if I understand correctly could be anything at all, it doesn't matter I just forward everything blindly on to the server, Likewise after I've sent this off to the server I then forward everything I receive back to the client. I assume I just carry on doing this until the server closes the socket.
My problem here is: How do I know how big the stream is from the client / server so I can recv() until I've got it all?
Its a windows based app ( Although running in a console for now ) Using c++ / MFC but using my own Socket wrapper rather than MFC's CSocket
Thanks
Pj
|
|
|
|
|
you can send few bytes before you send your effective packet, telling how long will be the following datas. then, you recv() this, and while all the datas are not recv()ed yet, continue waiting for them...
TOXCCT >>> GEII power
|
|
|
|
|
Thanks for the reply.
I'm getting the data from the client app, which will be the web browser requesting the tunnel.
I'm sure the length of the stream *should* be in there somewhere but I dont know where to look for it.
|
|
|
|
|
i general, such info is put at the beginning of the packet (the 2 or 3 - or more, depending of the size needed - bytes)...
TOXCCT >>> GEII power
|
|
|
|
|
Hi, I am a newbie in Network programming. Lets say i hv a tcp server which hv several tcp clients connected to it. How the server retrieve the clients? I know sending message to the clients is the way to detect the connected clients. But is there any different and better way to retrieve the clients? Thanks alot!!!!!!
bamboo
|
|
|
|
|
you have to put their socket descriptor into a list, vector, queue... whatever you want but something that permits you to remember them.
it's to you to know how you store these datas then...
TOXCCT >>> GEII power
|
|
|
|
|
ok...lets say i already hv a list that contain the descriptor. if there are all together 10 clients in the list, but only 8 connected to the server, how the server detect those 2 disconnected clients? Thanks alot....
bamboo
|
|
|
|
|
when you make a recv() , the value 0 is returned when the other part of the connexion has closed (or is not connected anymore).
TOXCCT >>> GEII power
|
|
|
|
|
Thousand thanks...
|
|
|
|
|
usally the server spins off a thread for each connected client to serve the request coming from them.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
As a client, is there any way to detect others clients which connected to the server? **thanks**
|
|
|
|
|
No, unless the server gives some feedback to the client about other clients.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
I have a file and i want to save it in the specified by the user folder, All of this, using Visual C++(MFC dialogbox). I Know how to select a file but I don't know how to browse for a folder.
If anyone can help me, please do so.
Thank you.
|
|
|
|