|
Yep, I just whipped up a test app (it was sitting in the MFC toolbox all the time! ). I can live without the Win-key though.
--
Verletzen zerfetzen zersetzen zerstören
Doch es darf nicht mir gehören
Ich muss zerstören
|
|
|
|
|
Hi
I´ve got the following doubt. I ñve got a datagrid that can be sorted. I have attached a dataset.
For example.
DataSet ds = new DataSet("JAMONES");
ds.COLUMN(nombre);
ds.COLUMN(id);
I have associated a ArrayList with all the JAMONES. I would like to delete the selected JAMON from JAMONES using the id. How can i do to indexed easily the ArrayList?
ArrayList jamones = {jamon1, jamon2};
DataGrid jaomnesDG = {jamon2, jamon1}.
I tried to delete jamon1. How can i delte from jamones.
Best regards,
John
|
|
|
|
|
Did I miss something? There is a "DataSet" in MFC?
led mike
|
|
|
|
|
I have a single document application with a custom GUI. When the user starts the program I calculate the width of the screen and then I place my GUI in the middle of the screen based on the retrieved int-value that decides the x-coordinate.
I've discovered now that users are confused by the fact that the area where they work is located at screen center but the Windows menu with File Edit... etc. is located in the top left.
Due to other reasons I can't just make the application window as big as the GUI, the GUI must be centered in a full screen window.
So, how do I offset the choices in the Menu (File, Edit, etc.) so that it's centered above the GUI?
|
|
|
|
|
sortegrip wrote: ...the GUI must be centered in a full screen window.
So why not just call CenterWindow() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
What would I center it against and where in my CView or CDoc would I do it?
I only have one window and in the center of that window I draw the GUI on the DC in OnDraw().
|
|
|
|
|
sortegrip wrote: What would I center it against...
That all depends on the argument you pass to it. By default, it centers child windows relative to their parent window, and pop-up windows relative to their owner.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have a TabControl ( not the MFC one ) on my View.
In this Tab i have a huge number of Views.
If the User clicks in the Menu on "Customers" it opens the customers in this current Tab, if he
clicks on articles, so it opens the articles AND DOESN'T erase the Customers-View, because he can re-open the used-View with the old-state ...
So i need to close/delete all these views if the Tab closes...
In the "destructor" of the Tab i close all opened Views from this Tab
But if i close the whole application, it doesn't close the Tab ( which closes the Views )
It closes the Views, then the Tabs, then the TabControl
If he steps into the Destructor of the Tab, the Pointers of the Views are still there,
but their hWnd aren't valid anymore...
Now the question : How can i test, if a pointer on a View has a valid hWnd or if the object behind
the pointer is still deleted ?
It's certainly possible or not?
Thanks
|
|
|
|
|
if (::IsWindow(*pView))
// HWND is valid
else
// HWND is NOT valid
|
|
|
|
|
Thanks for your answer.
But this dont work
Because the pointer is already 0xcdcdcdcd. If the pointer is 0x000000 i could test him on
if(View!=NULL) or can i test also on 0xcdcdcdcd ?
Is it a special-adress-value for deleted objects? Because if an instance is deleted, the pointer
sets to 0xcdcdcdcd ...
Thanks
|
|
|
|
|
If your "views" or "tabs" are derived from CFrameWnd then they delete themselves when you call
DestroyWindow(). Therefore you should set the pointers to NULL so you can check them before
trying to use them.
It's up to you to track the lifetime of these objects. That means if any child windows of a
given window class are not CFrameWnd derived and are allocated with new then the child object
should be deleted - usually this is done in a WM_DESTROY handler of the parent.
To destroy a CFrameWnd derived window
pFrameWnd->DesstroyWindow();
pFrameWnd = NULL;
To destroy a CWnd derived window
pWnd->DesstroyWindow();
delete pWnd;
pWnd = NULL;
|
|
|
|
|
And no, don't test on 0xcdcdcdcd - that's a debug value but there's no guarantee the CRT will
change a pointer to that value when it's deleted. It's up to the programmer to keep track of
all that
|
|
|
|
|
I am using a Tabbed Dialog (6 dialogs in total).
Now in some of these Tabbed Dialogs I need to wait for an external event, so I do the following:-
while(waiting)
{
Sleep(100);
ProcessMessages();
CheckForEvent();
}
void ProcessMessages()
{
CWinApp* pApp = AfxGetApp();
MSG msg;
while(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
pApp->PumpMessage();
}
But my question is 'Do I need to have a separate ProcessMessage in each of the Tabbed Dialogs' and are they a better way of doing this sort of processing.
Note I use a 3rd party API for the external event.
Many thanks,
Andy.
|
|
|
|
|
Andy202 wrote: I need to wait for an external event...
So why aren't you using CreateEvent() and WaitForSingleObject() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi David, its just trying to gt something working (prototye) fast.
Are they problems with several ProcessMessages as the number of Tabbed Dialogs could go up to 20!
Cheers,
Andy.
|
|
|
|
|
Andy202 wrote: Are they problems with several ProcessMessages...
Other than PeekMessage() being old and antiquated? Yes. If you happen to have (in the future) an active modeless dialog, there is no call to IsDialogMessage() . Is PumpMessage() dispatching its own messages?
While it's ultimately up to you as to how you want to handle event notification, I personally would not opt for this route.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If I understand your code correctly, when the external event occurs, a message is posted/sent to the dialog. Is this correct? If so, you don't need keep calling PeekMessage(). GetMessage() will wait until there is a message in the que and only return if there is.
Also you say 'tabbed dialog' Do you mean a window with a tab control, or a series of windows? If you have one main window, which controls your dialogs, then you only need one message pump. If you are dialing with several windows, then create a "message only window" which handles the message pump and dispatches the message to the correct child dialog. Either way, you only need one message pump.
|
|
|
|
|
Thanks for your post.
I am using the CTabCtrl class from the Code Project, which has a dialog for each Tab.
For the case of Timers, I handle these time events in the controller Tab, should I just need to place the ProcessMessage() in this place also.
I did have 2 ProcessMessage() in different Tabs, but the progra, runs slow.
Andy (at home)
|
|
|
|
|
Hi all,
Have some basic questions related to MFC….
1. Which are the DLLs that are used in a simple application that I created thr VC++6.0.? I know MFC42.DLL which are the other important ones?
2. In which DLL the definition of WinMain(),DefWindowProc() is provided? I know that I can’t edit it but just to have basic information…
3. What is the effect of various setting under ProjectSettingsGeneral tabMicrosoft foundation classes
i. Use MFC in a shared DLL,
ii. ii. Use MFC in Static library,
iii. iii. Not using MFC
Thanks
Sameer
|
|
|
|
|
1. Read the documentation
2. I don't know and don't care
3. Using MFC shared DLL's allows your application to use the MFC classes and minimizes the size of your EXE. Static linking of the MFC libraries results in linking the MFC libraries into your EXE build. Therefore the EXE is larger but not dependent on MFC being installed on the machine. Not using MFC means your application cannot use the MFC classes.
led mike
|
|
|
|
|
To add to mikes reply,
Sameer_Thakur wrote: 1. Which are the DLLs that are used in a simple application that I created thr VC++6.0.? I know MFC42.DLL which are the other important ones?
Use dependency walker to check dll's used
|
|
|
|
|
What do you need exactly?
|
|
|
|
|
Hi Iam using Grid control in my application.
how to delete the multiple rows in the Grid.
currently if i select multiple rows to delete but the last selected row is getting deleted.here iam sending the code what i have used to delete the rows.but it is working
pls any body can help in this
CCellRange cRange;
int nCount = 0;
UINT unSel = 0;
INT_PTR nSelctedDMItemsCount = 0;
cRange = m_Grid.GetSelectedCellRange();
nCount = cRange.GetMaxRow();
bool bFlag = false;
for(int nDMIdx = 1;nDMIdx < nCount;nDMIdx++)
{
bFlag =false;
bFlag = m_Grid.IsCellSelected(nDMIdx,0);
if(bFlag )
{
m_Grid.DeleteRow( nDMIdx );
}
}
|
|
|
|
|
reddy harish wrote: Hi Iam using Grid control
What Grid Control?
led mike
|
|
|
|
|
Iam using CGrid control.in this iam facing the problem
|
|
|
|