|
I don't understand why failing to call FreeLibrary causes a lot of problems in your app. But that's what I would do: comment out the FreeLibrary calls (temporarily) and see if you can get a better reading on where the leaks are occurring.
If that doesn't work, let me know and I'll help you find the leaks the hard way.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Hello,
I have created a dll in c that can draw on a picture box. But the problem is that i need to be able to place new lines or rect or ellipses... using the mouse and also be able to move or resize them (using the mouse) after placement. Any ideas???
Thank you in advance
Nicolas Siatras
|
|
|
|
|
Is there any way to create a device context that will let me draw on a bitmap that isn't necessarily the same format as the display device?
For example, if I created a 640 x 480 8-bit bitmap wit CreateDIBSection, could I somehow create a device context to draw text on the bitmap even if the primary display is 24-bit?
|
|
|
|
|
You need a DIBSection. To be honest, there is no reason I can see ever to use anything else. A DIBSection is a DIB, but it can be selected into a DC and drawn on with GDI functions as if it was a DDB.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
When you create a DC with ::CreateCompatibleDC, it basically creates a DC that is ready to support a monochromatic display. It does not create a display that matches the same color format as the display. When you select a bitmap into the memDC, the color depth of the DC is set to the same as what is set in the bitmap.
Then when you use bitblt or stretchblt, the GDI does all of the color conversions for you if you are drawing from a 24 bit color DC to an 8-bit DC.
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!
|
|
|
|
|
Hi everyone,
my knowledge of VC++ is slightly over basic so please be gentle with any responses.
My problem is that I have a generated image array (300x300) of 8-bit data (gray levels) stored in an unsigned char called imagedata (ironically).
I want to display this image on the screen of a dialogue based application but have been failing miserably.
If anyone can let me know what classes and routines I need to use, or even any sample code I can get my hands on, would be much appreciated.
Thanks in advance,
Rooster76
|
|
|
|
|
for a start, have a look at CBitmap::CreateBitmap.
Max.
|
|
|
|
|
you first need to convert that image into a DIB. this is Window's native image type.
1. a DIB is vertically flipped (first pixel is bottom-left)
2. all pixel rows in a DIB must be a multiple of four bytes wide. this may mean you have to add padding bytes to the end of the rows
3. a DIB starts with a BITMAPINFOHEADER struct
4. in an 8-bit DIB, the palette (256 entries in this case) immediately follows the header struct
5. the pixel bytes immediately follow the palette
so, to turn that image of yours in to a DIB:
find out how wide the pixel rows will be (accounting for the row padding), multiple that by the height. add 256 * sizeof(RGBQUAD) for the palette and sizeof(BITMAPINFOHEADER) for the header. allocate that much memory. then, fill in the header, copy the palette, copy the pixel rows (accounting for padding! and the vertical flip), and you're done!
-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
|
|
|
|
|
Its sooooo eaaassyyyy.....
But then you write graphic apps all the time don't you?
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!
|
|
|
|
|
Roger Allen wrote:
But then you write graphic apps all the time don't you?
yep. but i wrote the ISColormappedToDIB function just once.
-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
|
|
|
|
|
In CMainFrame file,
I defined CSplitterWnd m_wndSplitter;
and Split a Docounment into two View.
here is code:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) <br />
{<br />
m_wndSplitter.CreateStatic(this,1,2);<br />
<br />
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CMyFindDialogView),CSize(400,400),pContext);<br />
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CMyFindDialogView),CSize(400,400),pContext);<br />
<br />
return 1;<br />
}
In A NEW CLASS ,
I am do :
#include "MainFrm.h" in it's cpp header.
and
i want to do :
<br />
CWnd* m_pHexWnd = CMainFrame::m_wndSplitter.GetPane(0,1);<br />
but faied.
how to do it?
explain: i want get the CWnd* of SplitterWnd'CWnd.
because ,i want use it in a Create(,parameters,A CWnd*) Function.
i feel good.
|
|
|
|
|
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 !!!
|
|
|
|
|