|
Thanks for your reply. I will go thru those articles and hope I will get some more knowledge on those topics. I am comfortable developing dialog based UI applications, but not MDI and this is the first one I am tyring to develop.
-Pavan.
|
|
|
|
|
I came up with lots of doubts after creating my first MDI application, but for the basic ones..
1) First and foremost, how can I make a MDI applicaiton open with just the main frame (without child frame)?
2) How can I resize the child frame to the size of the image that is been opened by the user?? Say, if the image dimensions are less than the current main frame dimensions it will display in full scale, but if not, it should display the image covering the whole main frame with scrollbars to move down.
3) How can I open the image in child window so that it always resets itself to middle (aligned center)? i.e. even if the user clicks on the maximise button of child frame, the image should reset itself to the center of the main window.
4) How can I update the status bar panes while the user moves his mouse over the image?? I have a status bar in child window with a pane supposed to display the pixel location and intensity value.
thanks,
-Pavan.
|
|
|
|
|
1) An easy way to see is create an MFC multiple document project using the project wizard and
look at what is in the application class' InitInstance() override.
I just did one and it creates the frame like this:
CMDIFrameWnd* pFrame = new CMainFrame;
if (!pFrame)
return FALSE;
m_pMainWnd = pFrame;
if (!pFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
HINSTANCE hInst = AfxGetResourceHandle();
m_hMDIMenu = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_TestMDITYPE));
m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_TestMDITYPE));
pFrame->ShowWindow(m_nCmdShow);
pFrame->UpdateWindow();
2)3) Once you have the image size you can use MoveWindow to resize and reposition the child window
within the parent frame.
4) CStatusBar::SetPaneText() can be used to set the text of the status bar in response to
WM_MOUSEMOVE messages. For each message calculate the cursor position relative to the image,
convert the results to a string, and display the string in the status bar.
|
|
|
|
|
I'm using a list control with the LVS_EX_CHECKBOXES style. Is there any way I can disable this control, or make it read-only, such that the checkboxes cannot be un/checked, yet I can still use the scroll bar?
Thanks.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I did this on a project a few years ago, let me see if I can remember the details.
1. The check boxes are implemented using a state image list, so you'll need to make your own image list that has the check boxes in a disabled state.
2. When you want to disable the check boxes, set your image list as the list control's new state image list
3. Handle the notification that you get when the user clicks on a state image, and eat the message so the list control doesn't see it and toggle the check box.
4. When you want to re-enable the check boxes, swap the image lists back.
|
|
|
|
|
I mainly work in Visual C++ 6.0 and Embedded Visual C++ 4.0 (very close to VS 6.0). From time to time, the IDE will elect to change the definition of a dialog (seemingly at random but I doubt that).
before:
IDD_VERSIONS DIALOG DISCARDABLE 0, 146, 585, 292
after
IDD_VERSIONS DIALOGEX 0, 146, 585, 292
I've seen the IDE change it in both directions. Any ideas as to what exactly DISCARDABLE and DIALOGEX mean? Any ideas as to what is causing this? I have never seen any impact...
Curious.
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
My son's PDA is an M249 SAW.
My other son commutes in an M1A2 Abrams
|
|
|
|
|
charlieg wrote: Any ideas as to what exactly...DIALOGEX mean?
It's the replacement for DIALOG . See here for more.
DISCARDABLE does nothing in 32-bit Windows. It's there for backward compatibility.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks Dave... it had to be something like that
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
My son's PDA is an M249 SAW.
My other son commutes in an M1A2 Abrams
|
|
|
|
|
Using VS2005 with C+/MFC
How does one rename a menu resource? This is freakin' stupid...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
resource.h ?
what exactly do you want to rename ? the ID or the caption string ?
|
|
|
|
|
Are you trying to rename the identifier, like from IDR_MENU to IDR_CONTEXT_MENU ? If so, can you not just type over the old identifer in the GUI, like we did on 6.0? Or maybe you already tried that and that is why you are asking?
May have to resort to changing the RC and .H files directly if that fails...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
hehe
After adding a new menu resource it's ID is IDR_MENU1. If I select the menu in the Resource Tree I can change the ID (Name) in the Properties window.
Not sure that is what you are looking for.
led mike
|
|
|
|
|
Any WinCE mfc developers around?
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
My son's PDA is an M249 SAW.
My other son commutes in an M1A2 Abrams
|
|
|
|
|
I have a legacy system that I want to add a new dialog to. Whenever I create the new dialog through the resource tab, it creates my .H file in the 'externals' directory. Even if I move it from the exeternals directory to it's normal place with the .CPP, I still get errors that it can't find the IDD_DIALOG even though I have included the resource.h header file. Anyone have any clues as to what is happening? This is drivig me crazy! BTW, this is VC++ 6.0
Thanks
John P.
|
|
|
|
|
Try to find the IDD_DIALOG in resource.h
may be it not automatic add into resource.h
|
|
|
|
|
I'm hosting web browser control in my MFC dialog application (modified di lascia's CHtmlCtrl).
I need to Navigate to some url and wait for browser to complete and after this do some actions.
I'm using this code:
m_html.Navigate(url);
MSHTML::IHTMLDocument2Ptr doc;
doc = m_html.GetHtmlDocument();
while(1)
{
if (!_tcsicmp(doc->readyState,"complete"))
break;
Sleep(200);
}
but it never break the loop. I think it's because IE is in the same thread and
I have to precess it's messages or something. How to solve this?
I've tried to implement some GetMessage/dispatch message calls in my loop but it didn't work.
I cannot wait for OnDocumentComplete message because I need to run some function with multiple navigations, waiting and DOM processing.
Anybody have experienced this? Is it normal IE behaviour or am I missing something?
Thank you.
rrrado
|
|
|
|
|
rrrado wrote: I cannot wait for OnDocumentComplete message because I need to run some function with multiple navigations, waiting and DOM processing.
Using OnDocumentComplete is the correct way to do what you need. I don't understand your stated reason that you cannot use it.
led mike
|
|
|
|
|
I need to do something like this
start:
Navigate()
Wait()
parse page, decide what to do
goto start
the OnDocComplete handler cannot jump back to my function (using also some local variables) and continue.
rrrado
|
|
|
|
|
rrrado wrote: goto start
Your problem is you are using arcane design and code structure. Learn some modern development techniques like Object Oriented Design. In there you will find the solution to your problem.
led mike
|
|
|
|
|
This is very rough pseudo code. I don't really use goto but there are nested loops and relatively compicated alghoritm implemented in my function so I'd like to keep it as it is without adding some unneccessary synchronisation frameworks (only because of implementation details of IE) which would break readibility of the code. As response to OnDocumentComplete I could only post some messages to my dialog which would be running some pieces od alghoritm and I would also need many member variables to keep state of the function. This would make my code very complicated.
Ok I'll figure something out I just hoped I'll get some tips.
rrrado
|
|
|
|
|
ODC can post a message back to your view window, or set an event, or set a flag, etc. to tell the view that navigation is complete and something else needs to happen.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
The WebBrowser is an ActiveX control and so you should be running message pump as opposed to calling Sleep . As another poster mentioned, the DocumentComplete event will be fired when the page loading is complete.
Steve
|
|
|
|
|
I have a static lib that we no longer can find the source code for. We want to continue to use the library, but have problems with it in the context of Visual Studio 2005. It uses I/O routines that are no longer supported. I would like to build a mini DLL around this library exposing the functions from the library that we use, but I'm not sure how to do this. I have a static library and an include file that contains export statements for the library. I thought about using dumpbin to get the symbols out of the library, but there are a lot of symbols and I'm not sure what out of the symbols I'm suppose to pull for a .def file.
Any one have ideas?
Mike
|
|
|
|
|
wrote: I have a static library and an include file that contains export statements for the library. I thought about using dumpbin to get the symbols out of the library, but there are a lot of symbols and I'm not sure what out of the symbols I'm suppose to pull for a .def file.
you only need the names (and declarations) of the functions and variables you're going to actually use.... right ?
|
|
|
|
|
Correct. The static library is already in use and could be used as is in Visual Studio 6.0. However, with changes made in Visual Studio 2003 and above to remove the _io routines, I can no longer link the static libary directly into VS2005. To solve this I assume that I can create a wrapper DLL/import lib on top of the static lib using Visual Studio 6.0, but I'm not sure I understand what I need to do to accomplish this. I only wish to expose the functions that I use. There are about 40 of them.
Mike
|
|
|
|