|
I started one last week, and it's easy. I got it in a night so I have an add-in that creates a text file of bookmarks, with comments, brings them up in a dialog, and I can select them and jump to the file location. Not much, but it *will* be cool when it stores bug history in an ADO database and links to our bug tracker at work.
The point is that it is easy. I considered doing it myself when I originally saw your comment. Just spend an evening in the MSDN and look at some samples. If you get stuck, I'd be happy to collaborate on a CP article that does it ( it sounds like we have the required bits between us ).
|
|
|
|
|
Beaten to it again!
Add-Ins are easy, though there are (as ever) a few funnies to contend with (toolbars, grrr. )
Seriously, both sound like excellent ideas to me, and if there's any way I can assist, please feel free to ask.
Hopefully I'll be publishing my own VC add-in (The Resource ID Organiser Add-In for Visual C++ 5.0/6.0) on CP very soon.
Then...SourceSafe add-ins look challenging....
Andy Metcalfe - Sonardyne International Ltd (andy.metcalfe@lineone.net) http://www.resorg.co.uk
"I used to be a medieval re-enactor, but I'm (nearly) alright now..."
|
|
|
|
|
I need to program a simple 3 octave piano keyboard using MFC.
I may paint bitmap with keys and handle clicks, then use PtInRegion.
But I would rather use buttons.
Is there any easy way to form MFC CButton with region shape (SetWindowRgn).
Well, you may have better idea.
a/c
|
|
|
|
|
This may help. You will need your button controls to overlap, though. That shouldn't be a problem, since they won't paint over each other.
http://www.codeguru.com/buttonctrl/UniButton.shtml
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
hi.
how can i find the current status of a process or application. just like in task manager. either tell me the API function name or code through which i'll be able to find out what is the current status of application whethre its RUNNING or NOT RESPONDING. infact i want to know in my program whether application is running or not if its in NOT RESPONDING status then i have to kill it. so plz help me out
thanx.
|
|
|
|
|
i think i answered this one a whiles ago but here goes again...
the task manager (and the system) doesn't actually know if your app is running normally or hung unless it processes messages its message queue ... now if your app does a huge calc that effectively stops it responding for a while windows will assume its hung and tell you so in the tm ... that may be correct in most cases but it may be wrong
if the huge calc is safely spawned off into another thread and the ui thread is running normally things will be cool and the gang ... otherwise maybe not
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
hi lauren.
thanx alot for replying but stil haven't solved my problem. infact i have to find out how windows track this thing that message in the queue is not respondind. i mean there has to be some API function which tells window that rightnow application is in NOT RESPONDING mode. there has to be some code or way and i m very much interested in it. coz this not possible that windows come to know all by its self that certain application is not responding or its time allocated to its thread is over n the task assigned to it is neither over nor safely spawnwd off to other thread.
i m again asking u to please tell about that API function which which keeps track of such matters or send me code which i could embed in my code.
regards
Haroon
|
|
|
|
|
Actually lauren gave the same response I was going to. If a process is not responding to messages then it is by definition not responding. Windows would tell this by virtue of the fact that it tries to interact with each process, not because it calls on an API function to tell it what it already knows - that it is trying to interact with a child process and it is not replying. This can mean it is busy, or hung. So you need therefore to attempt to interact with the process in question and see if it replies. Is the process of your creation ? The easy way would then be with copydata.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
You could do a SendMessage (you'd need a window handle) in a separate thread, record the "ping" time, and have your checker app's main thread query the worker thread's ping time. If the time is undefined (eg: < 0) after a time "t", you could unsafely assume the target process is compute bound. I think Win9x/NT uses t == 20 seconds.
Hope this helps.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Looks like Norm and Andrew have provided a couple of excellent solutions to your problem. Imho, SendMessageTimeout() appears to be the way to go - it's a supported API call that essentially does what I suggested in my hack.
/ravi
|
|
|
|
|
Luaren
The official way according to Matt Pietrek is to get main window of handle of of the application concerned and then call:
where m_nTimeout is usally set around 5000ms
if (!SendMessageTimeout(hWnd,WM_NULL ,0,0,SMTO_ABORTIFHUNG ,m_nTimeout ,&dwResult ))
pTask->SetTaskStatus(TRUE);
else
pTask->SetTaskStatus(FALSE);
Regards
Norm
|
|
|
|
|
Look article http://www.codepile.com/tric2.shtml
|
|
|
|
|
I M TRYING TO FIND THE CURRENT STAUS OF ANY APPLICATION/PROCESS LIKE MENTIONED IN TASK MANAGER.
|
|
|
|
|
NO NEED TO YELL ( or post twice ). I'm sorry, I don't know the answer, but I just had to say that. Do you want it for Win2K only ? I only ask because Win95/98 doesn't bring up a process list, I'm not sure if NT4 does ( I've not run it for years ).
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Try this code. You must have the hwnd of the process you're checking. The easiest way to get that is to call CreateProcess to spawn the app.
BOOL AppIsFrozen(HWND hWnd)
{
BOOL bFrozen = FALSE;
DWORD dwResult;
LRESULT nResult = ::SendMessageTimeout(hWnd, WM_NULL, 0, 0,
SMTO_ABORTIFHUNG | SMTO_BLOCK,
5000,
&dwResult);
if (nResult == 0)
{
if (dwResult == 0)
{
bFrozen = TRUE;
}
}
return bFrozen;
}
|
|
|
|
|
I M TRYING TO FIND THE CURRENT STAUS OF ANY APPLICATION/PROCESS LIKE MENTIONED IN TASK MANAGER.
|
|
|
|
|
Use EnumProcess () or use ToolHelp 32 functions
for more information see article Q175030
Kindest regards
Alfadhly
<marquee>
It is Illogical to define an inventor by his invention
|
|
|
|
|
I searched the whole MSDN, but I did't find the solution.
I need C++ functions which do the same
as the VB functions:
Trim
RTrim
LTrim
Hex
thanks in advance
|
|
|
|
|
CString::TrimLeft, and CString::TrimRight.
If you're not using MFC, you can always walk through the array, then use strcpy to make a copy of the bit that does not have leading or trailing spaces.
Assuming Hex allows you to specify a number in hex, its 0x, as in 0xFF = 255.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hi
Can I use the SetStdHandle(...) function to redirect standard output stream (std::cout) to a windows socket opened by the function socket(...) ?
Thanx.
Ernst
|
|
|
|
|
Hello, i need somoene to help me.
I have created two dialog boxes, in the first one i have inserted a list ctrl in style report where i put some items with checkboxes associated. I want that when i click in an item that the item selected goes into the second dialog box with always a list ctrl.
i hope that i've explained clearly my problems, tks
|
|
|
|
|
Assuming one dialog is the parent of another, use GetParent() to get a pointer to it, and then put a function in the second dialog that inserts the item as you would like, and gets sent the string to insert.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I'm sorry but i'm just a beginner and i don't understand everything.to get the pointer to the parent dialog must i do like that :
m_panier.GetParent();
But if it i did is right how can i now put a fonction in the second dialog that gets the item, and gets sent the string to insert
Here a piece of my code which allows to display the index item selected (in the first dialog) in another Edit box (in the second dialog)
void CDThin::OnItemchangedListthin(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
CString strText;
CListedeprixApp* h_myApp = (CListedeprixApp *)AfxGetApp();
strText.Format(TEXT("Item index: %d\r\n "), pNMListView->iItem);
UpdateData();
m_Log3+=strText;
h_myApp->ListeDePrix() += strText;
UpdateData(FALSE);
*pResult = 0;
}
BOOL CDPanier::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CListedeprixApp* h_myApp = (CListedeprixApp *)AfxGetApp();
m_panier = h_myApp->ListeDePrix();
}
|
|
|
|
|
in my dialog,i added a toolbar on it,and one button(ID_MYBUTTON) with code:
CMyDilog::OnMyButton()
{
m_bFlag=!m_bFlag;
}
CMyDialog::OnUpdateMyButton(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck(m_bFlag);
}
but why can't the button's state be changed between pressed_state and unpressed_state?
Thanks in advance.
|
|
|
|
|
I don't recall how this works, but it's in PRetranslateMEssage. If you download my article "GDI+ Brushes and Matricies", I know for sure I had to impliment the fix you want there. The problem is that your OnUpdate function is not actually called.
I've just checked the code, and I put this in pretranslatemessage, before the call to PTM:
UpdateDialogControls( this, TRUE );
and this function as well:
LRESULT CGDIPlusBrushesDlg::OnKickIdle(WPARAM, LPARAM)
{
CMenu* pMainMenu = GetMenu();
CCmdUI cmdUI;
for (UINT n = 0; n < pMainMenu->GetMenuItemCount(); ++n)
{
CMenu* pSubMenu = pMainMenu->GetSubMenu(n);
cmdUI.m_nIndexMax = pSubMenu->GetMenuItemCount();
for (UINT i = 0; i < cmdUI.m_nIndexMax;++i)
{
cmdUI.m_nIndex = i;
cmdUI.m_nID = pSubMenu->GetMenuItemID(i);
cmdUI.m_pMenu = pSubMenu;
cmdUI.DoUpdate(this, FALSE);
}
}
return TRUE;
}
This means you need to put
ON_MESSAGE(WM_KICKIDLE, OnKickIdle)
in the messagemap of your CPP file ( it's near the top ), and
afx_msg LRESULT OnKickIdle(WPARAM, LPARAM);
with the rest of the generated message map funtions in the header file. I think that's all, if not, I'll have another look. So you don't need to download my article after all. Don't feel that not downloading it means you can't give me a five when voting starts for the .Net competition though
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|