|
Consider GetParent() and AfxGetMainWnd().
Kuphryn
|
|
|
|
|
Don't know it exactly.
can give a example?
Study Together!
|
|
|
|
|
I've got a window with a docking toolbar and blank screen. When I click one of the toolbar buttons, a series of pixels enclosed in a circle appears (this is a simulation model). The first time I run the model, the circle overlays the toolbar, but is positioned correctly afterwards upon a WM_PAINT message (say, when resizing the window). RunModel() and OnDraw()use the same script to draw the circle/pixels. The script creates a rectangle with GetClientRect(), which then is used in the Ellipse() function call to draw the circle.
How can the mispositioning of the circle upon startup be corrected? Thx,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
This may be caused by the type of DC your getting from the window.
Are you using a CWindowDC or a CCLientDC or different types in different places?
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
I use GetClientRect(&rectMyClient) to initialize a CRect object for the client region. I then use rectMyClient to center the circle I'm drawing. I do that the first time I draw a circle and everytime a WM_PAINT is sent. Somehow the toolbar region is only considered when a WM_PAINT message is issued. That's why the circle I'm drawing is nicely centered in the white screen area (my bkground is white) when I, say, resize the window, but partly overlays the toolbar when I first display the circle.
One thing: when I run the simulation, I obtain a CDC pointer using CWnd::GetDC(). The CDC pointer is then passed to OnCircleDraw(). Could it be that the CDC pointer used by CView::OnDraw() is different from the one I'm passing to OnCircleDraw()? In other words, could it be that the client area from OnDraw() is of a different dimension from that of OnCircleDraw()?
ralf.riedel@usm.edu
|
|
|
|
|
I need to develop a taskbar application similar to the ones that ships with Microsoft Office, and the standard taskbar. I need it to support all the standard features like: auto hide, docking to all sides of the desktop, resizing, and so on. Does anybody know of some code in CP or elsewhere that I can use as an example or a framework?
Regards,
Victor
phpWebNotes is a page annotation system modelled after php.net.
http://webnotes.sourceforge.net/demo.php[^]
|
|
|
|
|
|
Michael is right. Or you can just build it using a CDialog and be responsive to screen size changes. That's how my product FooBar[^] works.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi!
For reasons too long to explain here (mail me for details) we can not use any standard modal dialog box function, but we occasionaly need to show windows modally and return a result when finished, like ::DialogBox() do.
Therefore I need some advice on what technique would be good/best to implement our own modal window function that returns a value when closed and prohibits activating/focusing the calling (parent) window when running.
Thanks for any input on this matter.
/Johann Gerell
|
|
|
|
|
Look in the MFC library code to see how they handle the DoModal function. They do not use the standard DialogBox function either. They use the CreateDialog function, but you could concievably use any type of window that you would like to.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Paul's advice is great but I wanted to add that the easiest way to mimic modality is to disable to parent window (via EnableWindow(FALSE) ).
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
For a new kind of application we are going to start, we are looking for the most perfect way to develop it. One of the crucial parts is the windowing aspect. It has to be cool, sexy, it should support multiple languages, and some of the dialogs will be dynamically created (depending on data from the database).
We have some alternatives:
- Write everything ourselves on top of Win32.
- Use a framework like MFC/.NET/... and make heavy use of common controls, ...
From what we've tried with the second approach we see the following:
- The common controls and dialogs really look sexy.
- It's difficult to scale dialogs based on the used language (e.g. German has longer strings than English), especially for the dynamically created dialogs.
- You can't switch the used language of common controls.
Especially the last topic is an important one. If the application is used in a factory, on the plant floor, the user should be able to switch dynamically the used language, because not all operators speak the same language (welcome to Western Europe).
It's easy to adjust the language of the application, but not of the common controls or dialogs. I tried using the InitMUILanguage function but it had no effects in e.g. the date-time-picker.
What really worries me is that when I use InitMUILanguage(LANG_GERMAN), the advanced settings dialog of the printer configuration dialog seems to listen to it, but only for its title bar (Eigenshaften instead of Properties) and its Cancel button (Abbrechen instead of Cancel). All the rest of the dialog is in English (using Windows 2000).
It seems like no-one is able to make a decent [dynamically-switchable] multi-language application. Does anyone have experience with this ? Or are all developers either creating single-language (English) applications or separate versions for each language ?
Seems like I'm in a pessimistic mood today.
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
The language is defined per user on Windows, each user need to set it's locale and other regional settings ( and language ).
I think most Windows application will change most of their UI with the user settings ( for common controls and such ).
Patje wrote:
It's difficult to scale dialogs based on the used language (e.g. German has longer strings than English), especially for the dynamically created dialogs.
Where I worked before, we had to generate different resources for the different languages ( english, french , Chinese, Korean and Japanese ); we had no choice, it's easier to do this, than to try dynamically to resize the dialogs and other UI.
Setting an application is on the plant floor has the advantage that the user is normally clueless, the application and system should set by a competant person, setting all the regional and locale for each user.
Patje wrote:
Or are all developers either creating single-language (English) applications or separate versions for each language ?
It's the same application ( exe ) but loading different resource DLL according to the system/user language. I think it's possible to dynamically change the language while the application is running, but I haven't tried it.
( look at AfxSetResourceHandle ).
Good luck!
Max.
|
|
|
|
|
Thanks for your response Maximilien.
Maximilien wrote:
the application and system should set by a competant person
The point is that one of the modules is a module that runs on a computer on the plant floor. The application must run continuously since it communicates with hardware. Therefore the user should be able to dynamically change the language of the running application. Logging out and logging in again isn't an option here.
It reminds me of a shop I went recently. The cash-desks seemed to run on Windows NT. I can't imagine that, if the person at the cash-desk is changed, that they have to logout and login again.
Maybe the use of AfxSetResourceHandle might solve some of the resource-related problems, but I'm afraid it doesn't solve some of the common-controls-related problems.
Thanks anyway.
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
Hello...
I'm using the Paul DiLascia's HTMLCtrl in my dialog based app.
As I use this control in order to show variable information to the user I would like not to save the HTML generated into a file in order to send the path to the browser control...
Is this possible?
I would like to avoid the saving to the disc step.
thank you in advance.
|
|
|
|
|
i fought with this problem for days. i finally came to the conclusion that it is not possible - many people on Google have come to the same conclusion.
so, i create a temp file for the HTML and read it from there.
-c
There's one easy way to prove the effectiveness of 'letting the market decide' when it comes to environmental protection. It's spelt 'S-U-V'.
--Holgate, from Plastic
|
|
|
|
|
There is a not so nice way of doing so and I am sure there are limitations.
Passing any text after the 'about:' protocol(?) in IE is diplayed in the browser. You can even put in links, font styles etc and IE will parse the text.
as a quick example you can type the following text in the start/run dialog.
about:<A href="http://www.codeproject.com">Code Project</a>
I'm pretty sure you'll be limited (eventually) by the size of the URL.
HTH
Jignesh
|
|
|
|
|
Brilliant! Simply brilliant! You just saved me from writing (and deleting) an ugly temp .htm file.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks. But you should be aware of the max URL length that can be passed. I haven't tried this myself but if you look in wininet.h you see the following #defines
#define INTERNET_MAX_PATH_LENGTH 2048
#define INTERNET_MAX_SCHEME_LENGTH 32 // longest protocol name length
#define INTERNET_MAX_URL_LENGTH (INTERNET_MAX_SCHEME_LENGTH \
+ sizeof("://") \
+ INTERNET_MAX_PATH_LENGTH)
I guess as long as your html text doesn't go over the #define you'll be ok.
Jignesh
|
|
|
|
|
Good point. I guess it also pays to urlencode the text before checking its length.
Thanks for making TakeStock[^] less ugly.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello,
This can be a great solution, but I don't know how to launch the code to my HTMLCtrl...
I'm using Paul DiLascia's HTMLCtrl (is directly derived from HTMLView), but I need to show the HTML "file" in that control not in a normal IE window.
How do I launch that? Do I need to use a system("about:MyHTMLCode") call?
If I do it in this way I won't be able to redirect MyHTMLCode to my HTMLCtrl because this would fire another instance of IE.
Is there any better way to launch it?
I've tried to pass this to the navigate instruction, but it hasn't worked for me:
<br />
CString a = "";<br />
a.Format("about:%s",csCodiHTML);<br />
this->m_HTMLCtrl.Navigate(a);<br />
could you explain how to do it?
Thank you in advance!
|
|
|
|
|
I tried the above with some simple HTML on a CHTMLView and not the HTMLCtrl (which should work the same though) and it worked.
I can think of two things.
1) I used the Navigate2 method.
2) Is the URL VERY long? See the above threads on limitations.
or you can try what someone else suggested (the atricle on codeguru).
HTH
Jignesh
|
|
|
|
|
|
Hello all...
I am having a problem with the animation control on a dialog. In my
WM_INITDIALOG handler, I have the following code:
<br />
case WM_INITDIALOG:<br />
hAnim = CreateAnimationCtrl(hDlg, IDC_ANIMATE);<br />
Animate_Play(hAnim, 0, -1, -1); <br />
RedrawWindow(hDlg, NULL, NULL, RDW_INVALIDATE | RDW_ERASE |<br />
RDW_UPDATENOW | RDW_ALLCHILDREN);<br />
<br />
RECT rect;<br />
GetClientRect(hAnim, &rect); <br />
InvalidateRect(hAnim, &rect, FALSE);<br />
<br />
SetTimer(hDlg, 1, 350, NULL);<br />
<br />
etc...<br />
In the timer event, I have the following code:
<br />
case WM_TIMER:<br />
KillTimer(hDlg, 1);<br />
SetTimer(hDlg, 1, 20, NULL);<br />
theMain.m_nErrCode = theMain.m_lpDevice->Communicate(hDlg,<br />
&bPercent, &wPacketCount, szStatus);<br />
<br />
etc...<br />
As you can see, I am running a communcation routine that is sending
data through the USB port using an HID driver and standard WriteFile
calls. However, when the dialog first loads up, sometimes, not all the
time, the animation will not show up immediately. I'm trying to make a
dialog like the Windows Explorer dialog shown during a long copy
operation. Is there anything that I can do to make sure that the
animation is up before running the communication?
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
Using MFC in a MDI program.
The view has no background, so nothing is painted automatically.
I have this BitBlt on the OnDraw function of a view.
CRect r;<br />
pDC->GetClipBox(&r);<br />
<br />
pDC->BitBlt(r.left, r.top, r.Width(), r.Height(), &pDoc->m_map.m_canvas,<br />
r.left, r.top, SRCCOPY);
But it doesn't seem to do anything! Not a pixel gets painted.
I tried a FillSolidRect too here and that worked fine.
m_canvas is a DC created with CreateCompatibleDC(NULL)
the rect r seems to be correct and the m_canvas seems to be a valid canvas too.
Oh and the BitBlt returns 1, so it's not failing internally it seems...
|
|
|
|