|
Why the below code doesn't make any child? What I see on the list is only "Software".
HTREEITEM hTree, hCompany;
hTree = m_cTree.InsertItem("Software", TVI_ROOT);
hCompany = m_cTree.InsertItem("Microsoft", hTree);
m_cTree.InsertItem("Office", hCompany);
m_cTree.InsertItem("Visual Studio", hCompany);
m_cTree.InsertItem("Servers", hCompany);
Should I enable any options with the tree?
|
|
|
|
|
Looks like you have done the right thing.
So its probably added but not shown.
Try by putting m_cTree.Expand(TVI_ROOT, TVE_EXPAND) at the end.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
You are right. The code was actually right. But it did not display any "expland-collapse-+" symbol at the corner. When I click on it it's actually expanding. But how do I show that "+" there?
|
|
|
|
|
The tree control has the Has Buttons and Has Lines properties that you must set to true in the resource editor.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi all,
I have SDI type application.I want to Set Back color of Statusbar and Menubar.
please tell me how can i Set Back color of Statusbar and Menubar.
if possible please explain me with example.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
|
Thanks
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
PLz Suggest some Proposals or ideas For selecteing final Projects(of COMPUTER SCIENCES) in Visual c++ Language.
Or SOme Idea about Hardware Level Programming
thanks
|
|
|
|
|
See this message[^]? A USB version of this[^] would be very useful.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Any suggestions on how to send SMS text messages to a cell phone from a Windows native C++ application? It would need to work for different providers.
|
|
|
|
|
When I have a path to a file -- which lies on an offline network volume
I find that calls to determine if a file exists can be slow!
I am checking for the file by doing a _findfirst() and a GetVolumeInformation() on the file.
Any thoughts on an alternative?
One question, anyone know how to get notifications about network volumes (and drive mounts) coming online...
Thanks in advance.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Peter Weyzen wrote: offline network volume
Im not sure about the offline vs online part - what file system are you using ? (either way, scanning using _findfirst() etc may take time enough on its own)
I use (quick/dirty) :-
#include <sys/stat.h>
bool bFExists(const string &szFile)
{
struct _stat buf;
return (_stat(szFile.c_str(), &buf) == 0);
}
on online ie currently mounted Novell drives
If a drive of yours is 'offline' how does it come 'online' - some sort of automount ? maybe listing drive letters (which should include mapped drives etc) or unc paths might be quicker to see if a drive is online .. in which case if its not there's no point scanning for it ?
Peter Weyzen wrote: get notifications about network volumes (and drive mounts) coming online...
that might depend on what sort of file system/drive it is - there are notifications etc for 'drive removal'/insertion, ie flash/portable/usb etc
[modified] : this may help with the online/offline issue (or may be way off base) http://www.codeproject.com/KB/system/HwDetect.aspx[^]
'g'
|
|
|
|
|
Have you looked at _access() ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
That's an interesting function -- it tells me 2 things:
* does the file exist?
* can I have read access to it?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
It's just a wrapper around GetFileAttributes() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
I was wondering, if it's possible to gain access to date from webcamera, connected to my PC through the USB, by using pure C++ (I mean without using WINAPI and stuff like this). I want to write an application that retrives data of images from webcamera and then works on it. If it were possible, I would be greateful if you could give me some links to sites or titles of books which broach that issue.
Thank you in advance.
|
|
|
|
|
mk_4 wrote: by using pure C++ (I mean without using WINAPI and stuff like this
The Webcamera 'might' offer some API for directly controlling/accessing it - thats the c++ approach you might mean - in any case, why dont you have a look on the manufacturer's website or driverguide or such to find a driver for it .. you dont actually say what webcamera you have (which may make a difference in that someone here might have one) , are we supposed to guess ?
'g'
|
|
|
|
|
hmm... I don't have any webcamera yet 'cause I didn't need it so far. I've just been curious about this issue. I know, there are several ways to retrive data from webcamera by using some already existing libraries and APIs. So it doesn't metter what the type of camera it is. I'am new to c++ and just want to know if it's possible to access the driver or USB port which operates on that camera and retrive data from it but without using any api's and external libraries. I don't know if my idea is worth of effort, that's why ask about it. Maybe my previous question wasn't too strict, so sorry for that.
|
|
|
|
|
Yes you can use the WIA for many web cams other have there own API.
a programmer traped in a thugs body
|
|
|
|
|
It's not exactly what I meant but anyway thanks.
|
|
|
|
|
I reread you question and yes It would be possible but you would have to write a driver and have some knowledge of how the webcam worked at a low level. I don't think in any of the modern OS you can have direct IO access. So if thats way you want to go I would download the driver development kit.
a programmer traped in a thugs body
|
|
|
|
|
If it's the only way to do this, then I will rather look for some webcamera with it's own API. Anyway thank you for help.
|
|
|
|
|
Hi,
I would like to know how this can be done in MFC. I have a Single Doc/View MFC application in which I display images and Zoom in/out of them etc and eveyrthing works fine except for the image position. I use scroll bars position to zoom in the image and redraw them. But, now I would like to do this so that whenever I zoom in an image, I would like to keep the image center fixed, in other words, I would like to perform zoom in/out functions with respect to the center of the image being displayed in the client area and reset the scroll bar position accordingly.
At present-
I update the scroll bar sizes as soon as I change the zoom factor.
m_cs.cx = ImgWidth()*zoom_const;<br />
m_cs.cy = ImgHeight()*zoom_const;<br />
SetScrollSizes(MM_TEXT, m_cs);<br />
InvalidateRect(NULL, true);
and then in Draw() function-
if (zoom_const > 1)<br />
{<br />
dib->Draw(&dc, true, 0,0,myRect.Width(), myRect.Height(),<br />
sp.x/zoom_const,sp.y/zoom_const,<br />
myRect.Width()/zoom_const,myRect.Height()/zoom_const);<br />
}<br />
else<br />
dib->Draw(&dc, false, 0,0,myRect.Width(), myRect.Height(),sp.x,sp.y,myRect.Width(), myRect.Height());
Could someone guide me on this??
thanks in advance.
PKNT
|
|
|
|
|
Obviously when you zoom you need to recalculate the center position.
CPoint GetNewPos(CPoint const& oldPos, CSize const& oldSize, CSize const& newSize)
{
CPoint newPos;
newPos.x = (LONG)(((__int64)oldPos.x * newSize.cx) / oldSize.cx);
newPos.y = (LONG)(((__int64)oldPos.y * newSize.cy) / oldSize.cy);
return newPos;
}
You will also need to tell the scroll bar that its position has changed (as its sizes have changed).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thanks for the reply. Whats oldPos here? For example if you have an image displayed where its left top position is (0,0) when you zoom in and if you want to do it with respect to the center of the image displayed in client area, then the new position wont be (0,0), right? from your function it still return (0,0) which is not correct. Is that true or am I interpreting it in wrong way?
Here is what I tried to implement-
int x = sp.x/zoom_prev; //sp = scrollposition
int y = sp.y/zoom_prev;
int x1 = x+myRect.Width()/zoom_prev;
int y1 = y+myRect.Height()/zoom_prev;
newpos.x = x1-myRect.Width()/zoom_const;
newpos.y = y1-myRect.Height()/zoom_const;
but this is not producing correct results
PKNT
|
|
|
|