|
hi,
create a imagelist
.h
CImageList m_cImageList;
.cpp
populate event()
if (1) //bDoThisOnlyOnce
m_cImageList.Create(IDB_TREEVIEW, 16, 10, RGB (255, 0, 255));
//IDB_TREEVIEW resource bitmap with a the all icons
GetTreeCtrl().SetImageList(&m_cImageList, TVSIL_NORMAL);
rootitem = GetTreeCtrl().InsertItem(TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, _T("RootItem"), ILI_CLOSED_FOLDER, ILI_CLOSED_FOLDER, 0, 0, -1, TVI_ROOT, TVI_SORT );
//ILI_CLOSED_FOLDER, ILI_CLOSED_FOLDER <- item nr of imagelist
Add msg
.h
afx_msg void OnItemexpanded(NMHDR* pNMHDR, LRESULT* pResult);
.cpp
void CMyTreeView::OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
HTREEITEM hItem = pNMTreeView->itemNew.hItem;
CString string;string = GetPathFromItem (hItem);
*pResult = FALSE;
int inImage, inSelectedImage;
if (pNMTreeView->action == TVE_EXPAND)
{
if (GetTreeCtrl().GetParentItem (hItem) == NULL )
{
GetTreeCtrl().GetItemImage( hItem, inImage, inSelectedImage );
if (inImage == ILI_CLOSED_FOLDER && inSelectedImage == ILI_CLOSED_FOLDER)
{
GetTreeCtrl().SetItemImage( hItem, ILI_OPEN_FOLDER, ILI_OPEN_FOLDER);
}
}
}
else
{ // pNMTreeView->action == TVE_COLLAPSE
if (GetTreeCtrl().GetParentItem (hItem) == NULL)
{
GetTreeCtrl().GetItemImage( hItem, inImage, inSelectedImage );
if (inImage == ILI_OPEN_FOLDER && inSelectedImage == ILI_OPEN_FOLDER)
{
GetTreeCtrl().SetItemImage( hItem, ILI_CLOSED_FOLDER, LI_CLOSED_FOLDER);
}
}
}
hope it helps
dan o
hope it helps
|
|
|
|
|
Hi all,
I use MSComm for serial communication with very simple external device:
CComVariant Transfer;
VariantClear(&Transfer);
Transfer = CString(CString((char)P_1) + CString((char)P_2) + CString((char)D_1) + CString((char)P_3));
msComm.SetOutput(Transfer);
// Wait for answer
VariantClear(&Transfer);
Transfer = msComm.GetInput();
CString sReturned = Transfer.bstrVal;
P_1, P_2, D_1, P_3 are constants and usually non zero - however, zero value generate problem. When D_1 == 0, CString is shortened (P_3 is missing) and communication fall in troubles.
How can I enter binary array into Transfer instead of text string? How can I retrieve binary array from Transfer filled with response?
Environment: W2k, VC++ 6
Thanks for suggestions.
Petr
|
|
|
|
|
<strike> :(Hallo !!
Ich suche Leute zum lernen von MFC und C++.
Ich komme aus der nähe von Dortmund und suche Leute aus dieser Region um sich 1 mal die Woche zu treffen und sich gemeinsam auszutauschen und zu lernen
Meldet Euch
cu
Dirk
cadnt@web.de</strike>
schonus
|
|
|
|
|
Das ist English-speaking site AFAIK
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
|
Hello,
I've implemented double-buffering in my windows based game but the movement is still "choppy". Does anybody know how to get rid of this effect (i.e. syncronize the object's movement with the screen build-up)? Under DOS and Win16 I used to do this by reading directly from the VGA port but Win32 won't allow this.
thankx,
Koxin
|
|
|
|
|
In normal GDI, you can't do this. The nearest you can come is to draw into a memory DC and bitblt
it to the screen in one go. Which I assume you have done.
You need to move to DirectDraw / Direct3D. Then you can draw into a "back surface", and flip it
to the front synchronously with the screen redraw.
Such a change is beyond an answer in this forum, but there is a DirectX section on codeproject
which has a lot of examples for you.
Iain.
|
|
|
|
|
hi
i have written a macro, which will comment/uncomment all the occurences of a particular function call like all printfs in the opened file
i want to do the same operation for all project files,
can any one help me,
Regards
Sunil
|
|
|
|
|
How to PRINT MsWord Document through VC++ Dialog based Program.
Please Help me ..
|
|
|
|
|
hm.... If Word is installed on the PC, then you can
use ShellExecute() with the the "print" param.
If word is not installed....
|
|
|
|
|
Hello,
I have a graph displayed in a window. I want to save that graph in a .bmp file. I use VC++ 6.0 and MFC. How can i do that?
Best Regards
Neha
|
|
|
|
|
create a compatible dc, create a bitmap, select it, then draw on it by using gdi functions!
for storing it, read msdn!
Don't try it, just do it!
|
|
|
|
|
I can clear drop down combo box with
m_comboBox.SetSel (0,-1);
m_comboBox.Clear ();
but I can't clear drop list combo box !
How can I do this ?
emroz
|
|
|
|
|
Hi,
use
m_comboBox.ResetContent();
Regards
Frank
|
|
|
|
|
m_comboBox.ResetContent();
delete all content
and
m_comboBox.DeleteString(ndx);
delete one string.
I don't wanna delete any string.
I just wanna make null.
emroz
|
|
|
|
|
Emre Zorlu wrote:
I just wanna make null.
Which makes no sense in this context. If you are not wanting to remove any items from the control, what are you wanting to do? If you simply want to add an empty string to the control, use AddString("") .
|
|
|
|
|
|
is there a way I can control the working of a webcam using a windows application . if yes what are the API's I need to look at ?
|
|
|
|
|
|
you may try this link :
http://www.naughter.com/vfwgrab.htm
The app was made for posting images into web, but you may use the code (or some snippets) for your own ideas.
|
|
|
|
|
Thank you for the help but I am unable to locate
<gdiplus.h>
included in stdafx.h
|
|
|
|
|
|
ok, got the problem .... i've downloaded that source and the needed gdiplus files are not included.
So try this ... there is an other article named hints get GDI+ running
here at codeproject :
http://www.codeproject.com/useritems/codemaze.asp
http://www.codeproject.com/useritems/CodeMaze/GDI+Files.zip
The download file is about 1 MB big, but includes a complete gdi+ version (gdiplus*.* => dll, lib, headers). I have not tried to merge both projects and re-compile the exe, but if there are problems you may ask PJ Naughter directly for a hint.
|
|
|
|
|
If you want to control the properties of the camera try DirectShow, specifically:
the IAMCameraControl Interface
the IAMVideoProcAmp Interface
IAMCameraControl gives you access to
typedef enum {<br />
CameraControl_Pan = 1,<br />
CameraControl_Tilt,<br />
CameraControl_Roll,<br />
CameraControl_Zoom,<br />
CameraControl_Exposure,<br />
CameraControl_Iris,<br />
CameraControl_Focus<br />
} CameraControlProperty;
IAMVideoProcAmp gives you access to
typedef enum tagVideoProcAmpProperty<br />
{<br />
VideoProcAmp_Brightness,<br />
VideoProcAmp_Contrast,<br />
VideoProcAmp_Hue,<br />
VideoProcAmp_Saturation,<br />
VideoProcAmp_Sharpness,<br />
VideoProcAmp_Gamma,<br />
VideoProcAmp_ColorEnable,<br />
VideoProcAmp_WhiteBalance,<br />
VideoProcAmp_BacklightCompensation,<br />
VideoProcAmp_Gain<br />
} VideoProcAmpProperty;
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I am writing a COM dll that uses job objects to control certain procsses. I am having trouble with getting my job object to behave in the way I want, and there is a profound lack of documentation on this subject so I am reaching out to the outer world for help. I am new to this forum, but I was immediately impressed by the knowledge that I have found here at CP. If any of you saving developers have worked with job objects or are familier with the querky inner workings of them, I would be grateful for your response.
The main problem that I am having is getting my job object to terminate at the right point, and not to terminate when I don't want it to. If any of you savvy developers have worked with job objects or are familier with the querky inner workings of them, I would be grateful for your response. Please post or email me if you are interested and I can explain in greater detail and give source code to go along with it. TIA
If at first you don't succeed, Post....
|
|
|
|
|