|
Is there a video class that gives access to the pixels of each frame (MFC or not)?
|
|
|
|
|
|
Have u tried for CDC class?
one time i have requirement that do image processing on captured images from webcam(Live streaming). so i use this class.
|
|
|
|
|
Hello Friends
In my dialoged based MFC programm I need to handle and set certain registry values before windows gets shut down and also immediately after Windows loggs in(i.e immediately after user presses Ctrl+Alt+Del and enterys passwords).
I read that it sends some message WM_QUERYENDSESSION or something like that but don't know how to trap that message or how to achieve this?
Any such example or any idea please.
Thankx and regards in advance.
Mahesh
|
|
|
|
|
Amarelia wrote: but don't know how to trap that message or how to achieve this?
For the logoff:
There is a MFC OnQueryEndSession() wrapper in the class CWnd. Since your Dialog is derived from CWnd, you can do following (assuming VC6++) :
Rightclick on your Cdialog class in the class browser : Add Windows Message Handler, In the dialog that pops up change Dialog to Window in the combobox on the bottom right, and then select WM_QUERYENDSESSION in the list. Here you have your wrapper.
This implies that your app is alive when windows shutdown.
~RaGE();
|
|
|
|
|
Amarelia wrote: I need to handle and set certain registry values...immediately after Windows loggs in(i.e immediately after user presses Ctrl+Alt+Del and enterys passwords).
You can do this with your own GINA DLL, or implement the ISensLogon interface.
Amarelia wrote: I read that it sends some message WM_QUERYENDSESSION or something like that but don't know how to trap that message or how to achieve this?
I believe you'll want to look for WM_ENDSESSION instead. Windows will send the WM_QUERYENDSESSION message asking applications if it is ok to exit. If any of them respond with a zero value, no further WM_QUERYENDSESSION messages are sent. If all of the applications respond with a non-zero value, Windows will then send a WM_ENDSESSION message.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
I wouldn't write a GINA unless nessecary since it will not be portable to Windows Vista.
---------------
Windows Login
Winlogin (GINA) is being rewritten for Windows Vista to reduce number of necessary processes and components loaded. The new GINA will not be replaceable. A new Credential Provider Model will be used for extensibility. New mechanisms will also be provided to support existing functionality. A new Eventing and Stacking, and Chaining model will be provided.
http://www.activewin.com/winvista/thestateofvista.shtml[^]
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
Toby Opferman wrote: I wouldn't write a GINA unless nessecary since it will not be portable to Windows Vista.
I wouldn't either. I was just offering suggestions.
Care to offer help on this one?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
I created one dialog and also a global function in my coding, i have to control that dialogue from this global function....
(Im doing EnableWindow function in tht Global function...)
How can i access tht dialogue from global function?
Thanx in advance
|
|
|
|
|
That depends a lot of your code. Firstly, if your dialog is a modal dialog, then you can't because the program flow will stop to redirect all inputs to the dialog.
Then, if your dialog instance is declared inside a function, then you won't be able to access it (because the scope of the variable is just the function), you'll have to make the dialog global too.
Then, I will finish by saying that global functions are in general not a good programming practice in OO programming. They must be avoided if possible (sometimes it just not possible but there is other to get around it then)
|
|
|
|
|
I think you can pass a pointer on your dialog to your function (However I am not sure about that).
void MyGlobal(CMyDialog *pmydiag)
{
pmydiag->DoStuff();
}
And in your dialog classes :
MyGlobal(this);
But I am not sure about that, and this is no good code practice (see Cedric's post).
~RaGE();
|
|
|
|
|
Every time hte dialog is active, set a globla pointer to this. When the dialog closes, set the global pointer to NULL.
You can access this global pointer from anywhere in your code, and call any of the public members.
I do this alot in MFC when I use CreateThread.
eg:
CreateThread(NULL, 0, <br />
&ConnectThread,
this,
0,
0);
<br />
DWORD WINAPI ConnectThread(LPVOID lpParameter)<br />
{<br />
CNicCPAppDlg * dlg = (CNicCPAppDlg *) lpParameter;<br />
<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState());<br />
<br />
while(dlg->stayalive)<br />
{<br />
}<br />
return 0;<br />
}
Nunc est bibendum
|
|
|
|
|
Hi.
I'm trying to understand how printing works in GDI+ (poor me), and i'm facing a problem...
I started building a simple mfc app (c++, visual studio 6), wich prints a rectangle over the printing border...say:
<br />
void CBasicView::OnPrint(CDC* pDC, CPrintInfo* pInfo) <br />
{<br />
CView::OnPrint(pDC, pInfo);<br />
Graphics gr(pDC->m_hDC);<br />
RectF rf(0, 0,<br />
(float)pInfo->m_rectDraw.Width(),<br />
(float)pInfo->m_rectDraw.Height());<br />
gr.DrawRectangle(&Pen(Color::Red), rf);<br />
}<br />
fairly simple, but it doesn't work...it shows ok in print preview, but it doesn't print the entire rectangle (actually, it prints a rectangle about 36 times bigger, the result is that the right border or the bottom one doesn't get printed).
Ok...thinking it was me (as usual), i redraw it this way:
<br />
void CBasicView::OnPrint(CDC* pDC, CPrintInfo* pInfo) <br />
{<br />
CView::OnPrint(pDC, pInfo);<br />
pDC->Rectangle(0, 0,<br />
pInfo->m_rectDraw.Width(),<br />
pInfo->m_rectDraw.Height());<br />
}<br />
and...it prints and show OK...in fact, when i draw the two of them overlapped, the print preview shows them that way, but it only prints the second one...
Any hints?
Thanks!
|
|
|
|
|
Hi
Would like to know, how to check the check boxes recursively in a CTreeCtrl, which is placed in a dialog.
If any sample code or link exists, would be helpful.
Thanks
Vairamuthu.G.
|
|
|
|
|
Try something like this:
------------------------
void CTreeDlg::TickSubtree(HTREEITEM hRootItem)
{
// Tick the root item.
m_Tree.SetCheck(hRootItem);
// Now do the entire subtree depth first.
HTREEITEM hItem = m_Tree.GetChildItem(hRootItem);
while ( hItem!=NULL )
{
// Tick the item.
m_Tree.SetCheck(hItem);
// Move to the first child.
HTREEITEM hNextItem = m_Tree.GetChildItem(hItem);
// No child? If not try the next sibling.
if ( hNextItem==NULL )
{
hNextItem = m_Tree.GetNextSiblingItem(hItem);
// No more siblings? Try the nearest next sibling of an ancestor.
if ( hNextItem==NULL )
{
do
{
hItem = m_Tree.GetParentItem(hItem);
// We're done if we reach the root.
if ( hItem==hRootItem || hItem == NULL )
{
return;
}
hNextItem = m_Tree.GetNextSiblingItem(hItem);
}
while (hNextItem==NULL);
}
}
hItem = hNextItem;
}
}
void CTreeDlg::OnButton1()
{
// Populate tree.
HTREEITEM h1 = m_Tree.InsertItem(_T("1"));
HTREEITEM h2 = m_Tree.InsertItem(_T("1-1"), h1);
HTREEITEM h3 = m_Tree.InsertItem(_T("1-2"), h1);
HTREEITEM h4 = m_Tree.InsertItem(_T("1-2-1"), h3);
HTREEITEM h5 = m_Tree.InsertItem(_T("1-2-1-1"), h4);
HTREEITEM h6 = m_Tree.InsertItem(_T("1-2-1-2"), h4);
HTREEITEM h7 = m_Tree.InsertItem(_T("1-2-2"), h3);
HTREEITEM h8 = m_Tree.InsertItem(_T("1-2-2-1"), h7);
HTREEITEM h9 = m_Tree.InsertItem(_T("1-2-2-2"), h7);
HTREEITEM h10 = m_Tree.InsertItem(_T("1-2-3"), h3);
HTREEITEM h11 = m_Tree.InsertItem(_T("1-2-3-1"), h10);
HTREEITEM h12 = m_Tree.InsertItem(_T("1-2-3-2"), h10);
HTREEITEM h13 = m_Tree.InsertItem(_T("1-2-4"), h3);
HTREEITEM h14 = m_Tree.InsertItem(_T("1-2-4-1"), h13);
HTREEITEM h15 = m_Tree.InsertItem(_T("1-2-4-2"), h13);
HTREEITEM h16 = m_Tree.InsertItem(_T("1-3"), h1);
HTREEITEM h17 = m_Tree.InsertItem(_T("1-4"), h1);
// Tick h3 and all its children.
TickSubtree(h3);
}
Steve
|
|
|
|
|
Hi Steve
The code given for recursive check is okay. But the functionality I wanted to implement is, whenever the user selects the root node and presses spacebar, the selected node and its siblings should get selected. Whenever space bar is clicked, what event will get fired?
Could you please tell me the event. So that I can write the code happily in that event.
PS: CTreeCtrl I placed it in a dialog.
Kindly try out a example and let me know.
Thanks
Vairamuthu.G.
|
|
|
|
|
A WM_KEYDOWN or WM_CHAR would do the trick - But these messages will be posted to the tree control so if you're using a raw CTreeCtrl (which I assume you are) you will have to use the PreTranslateMessage function to handle these messages. You can use the ClassWizard to add the handler. It should look something like this:
BOOL CTreeDlg::PreTranslateMessage(MSG* pMsg)
{
if ( pMsg->message==WM_CHAR && pMsg->hwnd==m_Tree.GetSafeHwnd() )
{
// We've got a WM_CHAR message for our tree.
if ( pMsg->wParam == ' ' ) // Is it a space?
{
// It's the space key.
HTREEITEM hSelected = m_Tree.GetSelectedItem();
if ( hSelected != NULL )
{
TickSubtree(hSelected);
}
}
}
return CDialog::PreTranslateMessage(pMsg);
}
Steve
|
|
|
|
|
Lots of help can be found on
Code Project![^]
but the best way to do that is to retrieve a HTREEITEM (say hitem) with GetRootItem( ) , then GetNextItem(hitem,TVGN_NEXT) with hitem the HTREEITEM returned by the function (here is the recursion) and for each hitem SetCheck(hitem,TRUE):
HTREEITEM hitem = m_Tree.GetRootItem();
while(hitem != NULL)
{
SetCheck(hitem,TRUE);
hitem = GetNextItem(hitem,TVGN_NEXT);
}
~RaGE();
|
|
|
|
|
This will not work. TVGN_NEXT gets the next sibling item. It will not select the children or children's children and such.
Steve
|
|
|
|
|
From MSDN :
TVGN_NEXT Retrieves the next sibling item.
Steve 1 - Rage 0.
~RaGE();
|
|
|
|
|
Hi gurus,
How do we get the ip address of computer using MFC?
Any clues? Ideas?
Thanks,
Wax
|
|
|
|
|
See the following from which u can get the IP address of the local machine
gethostname(szHostName, strlen( szHostName ) ); //returns machine name
strFullName="\\\\"+szHostName;
host = gethostbyname(strFullName); //returns hostent*
if(host!=NULL)
{
ptr = (struct in_addr *) host->h_addr_list[0];
int a = ptr->S_un.S_un_b.s_b1; // Eg. 211.40.35.76 split up like this.
int b = ptr->S_un.S_un_b.s_b2; // 40
int c = ptr->S_un.S_un_b.s_b3; // 35
int d = ptr->S_un.S_un_b.s_b4; // 76
strTemp.Format("%d.%d.%d.%d",a,b,c,d);
AfxMessageBox("IP:="+strTemp);
}
Thanks and Regards
Laxman
FAILURE is the first step towards SUCCESS
-- modified at 23:45 Friday 20th January, 2006
|
|
|
|
|
|
Yes, MFC. I'm not using .NET. just pure visual c++.
waxie
|
|
|
|
|