|
Does anyone know how to put an input box or dragdown menu on the toolbar???? I want to let someone to choose from the menu or type the command directly in the input textbox.
|
|
|
|
|
The usual method of doing this is to place a separator in the toolbar, make it pretty wide (200 px or so) and create your edit box as a child window of the toolbar, positioning it in the RECT of the separator.
Check out the docking window/toolbar section on this site, there should be an article dealing with this topic.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Hi all...
I've got an application that is running multiple regions. The application works fine, does what it's supposed to, updates take place, no memory leaks... all good stuff..
Problem is... if I run TaskInfo2000, it shows my GDI handles increasing as I make visual changes to the app.
I watch it with the debugger, and find that when I do pRgn->DeleteObject() followed by delete pRgn, and nothing happens to the number of handles. I know that TaskInfo isn't in error, because I can eventually run the app into the ground.
I've tried instantiating an HRGN, doing a detach to my HRGN, and an SDK DeleteObject on that, and it still doesn't do anything.
I might add that the regions are NOT selected into any device contexts or attached to any windows at the time they're being deleted.
Anybody seen this before, or any thoughts what the heck is going on?
Thanks for any thoughts...
Dave Campbell
Skinning Specialist
Touch Technology Int.
|
|
|
|
|
Hi !
"An application should not call DeleteObject on a CGdiObject object that is currently selected into a device context". Youd should unselect object from dc before deleting it.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@mailru.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
Thanks for your response, Igor, except I'll give you a quote from my posting:
"I might add that the regions are NOT selected into any device contexts or attached to any windows at the time they're being deleted."
Dave Campbell
Skinning Specialist
Touch Technology Int.
|
|
|
|
|
It seems to me as though it has nothing at all to do with the regions. Are you sure that the handle count is increasing when you are creating the regions. Also, remember when you use DC's you must do this;
void MyFunc( )
{
CPaintDC pdc(this);
CBrush b(RGB(0,0,0))
CBrush *pOldBrush = pdc.SelectObject(&b);
pdc.SelectObject(pOldBrush);
}
If you don't reselect the old pens, brushes etc. into the device context then they will not be deleted when their destructor is called.
Hope that helps,
Andrew.
|
|
|
|
|
I store an exe image in my program as a resource,then I load this block in the memory but now I want to execute this exe block wihout need to write it in exe file
|
|
|
|
|
Not too sure about this one, but (and I'm sure someone will verify the correctness of this for me) instead of doing what you said can you not just use ShellExecute with the 'res:' protocol?
> Andrew.
|
|
|
|
|
Ive found myself on more than one ocassion writing code in MFC which imlements a database query using a CRecordset, and churns through the records one at a time doing something to each record.
This type of operation is typically time consuming, and therefore I would like to present the user with a percentage complete indicator (Progress Bar).
My problem of course is that I dont know the size of the record set
a priori (GetRecordCount returns only the highest numbered record so far accessed). Of course I dont want to churn thru the record set before hand to determine its size.
Any ideas on an elegant way to attack this? Other ways to produce satisfactory progress feedback to the user?
Thanks very much in advance!
Dave Carkeet,
Santiago, Chile
|
|
|
|
|
Ok, so MoveLast before GetRecordCount is not an option. Seems that percentage is absolutely necessary you need to perform query with 'SELECT COUNT(*)' and identical WHERE clause before traversing the recordset. Of course, number of records could change between two queries in multi-user scenario, so value returned from first query should be treated with care. COUNT(*) can also be pretty expensive, depending on WHERE.
I don't know your exact requirements, but maybe it's enough to just display a message like 'Please wait, processed 19002 records so far...'.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I have the following tree:
.ABC
.|_A
.|_B
.|_C
.XYZ
.|_X
...|_XX
.|_Y
.|_Z
I want to display something when i use a mouse to click on particular item. How to do that?
For example, if I highlight XX, then pop up a message box say "XX"....etc...
Thanks
|
|
|
|
|
Handle the NM_CLICK notification. You can implement the handler in the parent dialog box or (using message reflection) in CTreeCtrl-derived class.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks for your reply.
I know I can use NM_CLICK, but I don't know which function in CTreeCtrl i should use. Seems liked they just return a HTREEITEM variable. The following is how i make a tree:
HTREEITEM ABC, XYZ, node;
ABC = m_Tree.InsertItem("ABC", TVI_ROOT);
node = m_Tree.InsertItem("A", ABC);
node = m_Tree.InsertItem("B", ABC);
...etc...
if I want to choose B...but it returns a HTREEITEM....how can i know which "node"....
|
|
|
|
|
Use GetMessagePos and CTreeCtrl::HitTest. Assuming that you're handling NM_CLICK in CTreectrl-derived object, you'd write your code like this:
CPoint pt = ::GetMessagePos();
ScreenToClient(&pt);
UINT flags;
HTREEITEM hItem;
hItem = HitTest(pt, &flags);
And do whatever you want with hItem and flags.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Please use TVN_SELCHANGED,
ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
OnSelchanged is a Function.
welcome you to Sky...
|
|
|
|
|
e.g I have a variable CString path;
How can I find out the subdirectories of this folder?
|
|
|
|
|
look at FindFirstFile() FindNextFile()
its in the returned flags value
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Thanks!
can I use FILE_ATTRIBUTE_DIRECTORY in the WIN32_FIND_DATA structure, to find subdirectories?
One more question: these functions return a handle. How can I find out what the name of the directories is?
|
|
|
|
|
as far as i remember the cFileName member holds the file / directory name
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
WIN32_FIND_DATA is a struct:
typedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[ MAX_PATH ];
TCHAR cAlternateFileName[ 14 ];
} WIN32_FIND_DATA, *PWIN32_FIND_DATA;
this is in MSDN
welcome you to Sky...
|
|
|
|
|
I've noticed that Microsoft is building their commercial products (Money, Encarta, Tax..) using a completely flat look that resembles a web page and it seems to me that they are using a set of controls/views not included in VC++ 6. Does anybody knows were this framework comes from?
Jose Lago
|
|
|
|
|
Not all of them use that style, but how they are implemented differs. I don't have Encarta to hand at the moment, but you could try using Spy++ on it. Money 2000 (and 98 I think) is just a basic web-browser shell and the pages are actually HTML.
> Andrew.
|
|
|
|
|
What is the best way to hang up the modem in JP Naughter's lib or in the Win32 API?
Currently, I'm trying the +++ATH0 trick which is evidently not reliable.
Can it be as simple as closing the port? Is that reliable?
Thanks in Advance!
|
|
|
|
|
RasEnumConnections()
Then call
RasHangUp ()
Cheers
Alfadhly
It is Illogical to define an inventor by his invention
|
|
|
|
|
I wrote a MFC ActiveX control with the Wizard. I want to do something when
the user press a key and the control has the focus, so I wrote:
void CMyControlCtrl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
AfxMessageBox("Key pressed") ;
COleControl::OnChar(nChar, nRepCnt, nFlags);
}
Now if I insert the control in a Visual Basic Form it works right, but if I
insert it in the dialog of a MFC Dialog based application it doesn't work.
Can someone help me?
Thanks Paolo
|
|
|
|