|
Hi,
jkirkerx wrote: Well it works like a rolex now. I can cancel the installation, and it exits clean. I put my cosmetics in, but changed it to a more simple format. I put a flipflop in, but can't remember how to flipflop with a simple command. bFlipFlop++ or something.
Love the analogy. What do you mean by flipfop? Are you referring to bit flipping?
bool b = true;
while(1)
{
b = !b;
}
jkirkerx wrote: I need to go back and load you up with some 5's for the help.
Nah, don't do that... I don't come here for 5's. I wish the reputation system would go away, it cheapens the website... I want my old codeproject back.
jkirkerx wrote: I'm not sure if I'm done, but wish to thank you for helping me to get a better understanding of win32 api.
Now that's why I come here, a 'thank you' is worth much more than a 5.
jkirkerx wrote: The sample should give you a good idea of what I'm up to, perhaps there's something in the message that can tell me if the user canceled the operation, versus the operation exiting clean.
Put back that call to GetExitCodeProcess... that could potentially tell you if the user cancelled the operation. The Microsoft SQL Server Express 2008 may or may not return a different value based on cancellation...
Best Wishes,
-David Delaune
|
|
|
|
|
Cool!
flip the progress message every cycle of 100,
BOOL bFlipFlop = FALSE
if 100, bFlipFlop = TRUE
I'll try your example and examine the exit code.
|
|
|
|
|
jkirkerx wrote: flip the progress message every cycle of 100,
Outside of your while loop declare an unsigned integer and increment the integer inside your loop. Use the Modulus Operator (%)[^] and if the remainder is zero then the integer value is divisible by 100... do your magic.
unsigned int value = 0;
while(1)
{
++value;
if(0 == (value % 100))
{
}
}
Best Wishes,
-David Delaune
|
|
|
|
|
Sorry I took so long.
That sounded so over whelming at the time I read the message. I didn't want to make any more threads because I didn't really understand WaitForSingleObject at the time.
At the time, I was getting trapped in the new thread, and couldn't figure out how to get out of it for a second to start another thread for WaitForSingleObject. I was in a thread jail cell with no key.
I think I get it now, or at least more so I can implement more advanced code concepts now. It does make my program run smoother, and now the cosmetics update faster and smoother as intended.
|
|
|
|
|
I have an SDI application, with a splitter window that have in left view an CTreeView and right side an CListView.In each one I have some items. I override PreTranslateMessage in each one to be able on tab key to move focus from tree to view and viceversa :
BOOL CMyTree::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB)
{
CMyListView* pView = (CMyListView*)pChild->GetMyListView();
pView->SetFocus();
pView->GetListCtrl().SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
}
return TRUE;
}
return CTreeView::PreTranslateMessage(pMsg);
}
I see that the focus has moved.
Somewhere in menu I have a delete menu that could delete items from tree or from listview.
Let's say that I'm in treeview. I press tab and I see that the focus has moved on listview. When I try to delete an item I see that I delete an item from treeview not from list view .... so, from some reason, the focus remained in treeview ...
The the deletion goes well only when I move the focus from tree on list view by click with mouse in list view ...
My question is, is enough to call SetFocus(); to move an focus from tree view to listview ?
|
|
|
|
|
How does your command handler for the delete operation determine whether the treeview or the listview has focus? You haven't provided that code. As a user, my expectation would be that the delete operation should be deleting the item in the control that has focus. Though I guess a case could be made for deleting anything that is selected regardless of focus.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Of course that program delete the item of window that have the focus ... the problem is : I am in the listview, I select 2 items, and when I go to main menu, click on delete item from menu, program wants to delete an tree view item, not list view items ... I try to make a little demo, to see what is happend.
|
|
|
|
|
If we could see your 'delete' code, that could help. That command handler code could delete items from either control.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
void CMyTree::OnEditDelete()
{
CString sItem,sMessage;
CTreeCtrl& Tree = GetTreeCtrl();
HTREEITEM hSelectedItem = Tree.GetSelectedItem();
if(! hSelectedItem)return;
sItem = Tree.GetItemText(hSelectedItem);
sMessage.Format(_T("Are you sure you want to delete '%s' item ?"),sItem);
if(IDYES != MessageBox(sMessage,NULL,MB_YESNO | MB_ICONWARNING))return;
}
theApp.UpdateAllViews(NULL,CMyApp::UH_ITEM_CHANGED);
}
the code for delete an item from list view is similar, but at the point when I have confirm message-box, the message said to me that want to delete item from listview, not from tree view ....
I don't know if I'm was understable, but thank you anyway for your interest !!!!
modified 26-Nov-11 1:17am.
|
|
|
|
|
[CListCtrl::DeleteItem] Deletes an item from a list view control.
CListCtrl* pmyListCtrl;
int nCount = pmyListCtrl->GetItemCount();
for (int i=0;i < nCount;i++)
{
pmyListCtrl->DeleteItem(0);
}
|
|
|
|
|
Looking at (ATL) code of mine for handling tabs, and which uses <code>GetDlgItem</code> rather than <code>SetFocus</code>, the only difference I can see is that I have a call:<pre>// Now select all like normal tab behaviour
SendMessage(hNew, EM_SETSEL, 0, -1);</pre>at the end. Presumably as my tabs have edit controls on and the cursor needs setting up. So unless there's a parallel with your views e.g. ensure, say, a node or list item has focus or is other wise set up, I'd agree with Chris and wonder about the code doing the deleting.
|
|
|
|
|
Hi all,
I'm new with Win C++ API, I'm trying to create an application that lives as a trayicon, and my purpose is to capture the mouse over event when hovering over the icon..this should launch a new window. I've had some try by using the WM_MOUSEHOVER message on the window handler relative to the NOTIFYICONDATA object, but it seems to have no effect. Am I using the message in a wrong way? Is there some specific API or implemaentation to manage this?
Thank you all in advance!!
|
|
|
|
|
[ Here ] are a couple of good implementations.
|
|
|
|
|
Hi,
This link will help you.
http://www.codeproject.com/KB/shell/ctrayiconposition.aspx
-- modified 25-Nov-11 4:09am.
|
|
|
|
|
Please make your links clickable, like this[^].
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi developers,
I requires to handle OnClose handle of a form view. I am building a heavy tree on it( based on thread ), and while doing that if i closed that form, application was getting crash, because that tree control has been destroyed.
So that I have to capture it's close event so that I can prevent this event to proceed, i.e. to close that form.
Thanks In Advance.
Amrit Agrawal
Software Developer
|
|
|
|
|
When you close that form, the syst will call its destructor so if you wanna handle the prob go to the
YourFormClass()::~YourFormClass( )
{
}
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
|
I totaly agree with u in case the user is running an SDI application but what if it is a MDI application ?
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Yes, [MSDN] says: "To destroy an MDI Child window; use the virtual member function CWnd::DestroyWindow . Do not call the global ::DestroyWindow API to destroy an MDI Child window."
It goes on to say: "In the case of C++ Windows objects that do perform auto-cleanup, you must call DestroyWindow. If you use operator delete directly, the MFC diagnostic memory allocator will alert you that you are freeing memory twice (the first call to delete as well as the indirect call to "delete this" in the auto-cleanup implementation of PostNcDestroy)."
|
|
|
|
|
You scored Hight .
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Hi all,
I am trying to run one console based application,
Where i reading a argument from command line.
If i press ENTER ,i am writing the sane to the command line.
How can i print the same without pressing ENTER.
Can i execute the second printf without pressing ENTER
This is the code i am using
int main(int argc, char* argv[])
{
int aNumber;
char aChar;
printf("\nEnter a number:");
scanf("%d", &aNumber);
printf("\nThe number entered is %d\n", aNumber);
return 0;
}
Thanks
Sharan
|
|
|
|
|
On Windows, you can utilise the _getch function, which is exposed by conio.h . On *nix, you can use tcsetattr to turn off canonical mode, which is exposed by termios.h , which'll offer immediate feedback when reading.
|
|
|
|
|
Hi , Use this modified code.
Modified code,
#include <conio.h>
int main(int argc, char* argv[])
{
int aNumber;
char aChar;
printf("\nEnter a number:");
scanf("%d", &aNumber);
printf("\nThe number entered is %d\n", aNumber);
getch();
return 0;
}
|
|
|
|
|
Hi,
try to run this program from the windows command prompt..
|
|
|
|