|
Downloads are on this page:
http://www.prof-uis.com/download.aspx
Best Regards,
Haldir
|
|
|
|
|
Needed to use straight CDC instead of CPaintDC or CClientDC.
I've found this code on msdn:
PAINTSTRUCT ps;<br />
CDC* pDC=NULL;<br />
pDC=BeginPaint(&ps);<br />
...<br />
EndPaint(&ps);
This results in a BIG memory leak. And I haven't got a clue.
Tried delete pDC; but that leads to a crash.
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Try something like this:
CClient dcDisplay( this );
CDC dc;
dc.CreateCompatibleDC( &dcDisplay );
CBitmap bmBitmap;
bmBitmap.CreateBitmap( ... ); // How ever you want to do it
dc.SelectObject( &bmBitmap );
... GDI functions
<end of function, GDI gets released>
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
OOPs, never mind last...
Call EndPaint( &ps );
Don't delete the Pointer.
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
Sorry, but I found out that the leak wasn't caused by creating/destroying the DC.
It seems that the leak comes from dc.SelectObject(...) . There's a thread about SelectObject() a bit higher.
I don't understand, cause it's standard code that you'll find anywhere on this site ...
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
I'm guessing that you did:
CPen pen( < Created stuff here > );
CPen* pOldPen = pDC->SelectObject( &pen );
< code stuff here >
pDC->SelectObject( pOldPen );
Something like that or:
pDC->SaveDC();
< Code Stuff here >
pDC->RestoreDC( -1 );
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
Could somebody explain the n in #pragma pack(push,n).
I understand the concept of packing data, that is "no" padding anyway around stored data, right?.But I'm having trouble with what this n is supposed to do the packing of the data.
I'm using .NET (C++).
Thanks.
|
|
|
|
|
n is the byte boundry. If you say #pragma pack(push,4) you have a 4 byte boundry.
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
For the most part, 'n' specifies the alignment. The easiest way to think of it is that if a structure element isn't a multiple of 'n' then pad bytes are added after the element to make it a multiple of 'n'.
Example:
4 byte packing (n=4)
char sz [3]; is a 3 byte element. To make the next variable in structure align properly, a single pad byte has to be added to the end.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
cool thanks for the info.
|
|
|
|
|
"Unresolved external symbol"
It's in a dialog app that has some function declared in a C file and then prototyped in a header file. I include the header file in the file I call the function from and that is where I get the error.
I have tried a number of things but can't seem to get this to work.
Please help!
Thanks,
Jim
|
|
|
|
|
If the original header file was from the C Programming Language, then you need to add:
#ifdef __cplusplus
extern "C" {
#endif
... function defs...
#ifdef __cplusplus
}
#endif
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
Thanks Larry, worked like a charm
|
|
|
|
|
Just Thinking out loud.
Using that test code that I posted (posted over at www.codeguru.com), (I changed the mapping mode to MM_TWIPS and associated the rich edit with the printer) and created a new file. Created one text box, one line and placed the line on it. I then did a Print Preview and noticed where the line fell. I then saved the file, went to a different system running a different resolution and operating system. Ran the same program openning the same file. The text did exactly like it did before; BUT, when I did a print preview, the line was at the exact same location.
I wonder if to make something WYSIWYG from the display to the printer, is to make the display look like the printer! Using the MM_ANISOTRIPIC (or MM_ISOTROPIC), getting the printer's resolution and size (both in the vert/horz) and making the screen look the same way. So, when you draw a line/box/text on the screen, it will be placed in the same location and length as on the printer!
Any thoughts? Anyone?
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
You need to get the actual DPI uses in both monitor and printer to achive WYSIWYG.
Usually a 14" 800x600 monitor uses 72 DPI which somehow defer on manufacturers. The printers however usually in the 300, 600, 1200 and etc.
Just my opinion.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
What I was thinking ( and I could be out in left field, or right ) was to use the MM_ANISOTRIPIC and set up the screen in the same manner (resolution/size) as the printer and use the ScaleViewportExtEx (I think that is the method name) to zoom in/out.
Does that sound about like it?
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
My App is running and I am typing words in NotePad.exe
I want my App show a messagebox (such as "hello") (when I press Ctrl+Shift+H) when I using any program in Windows?
which function to do this?
thank you!
|
|
|
|
|
If you are using MFC.
They have this Acceralator resource which is meant for this purpose.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Look at SetWindowsHookEx(WH_KEYBOARD, ...) for this.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Check the message WM_SETHOTKEY. I stumbled across this looking for something else so don't ask how to use it!
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
I'm trying to figure out how to get the color Visual Studio .NET uses for the inactive/background color of its own tab controls. In Blue and Green mode, they use pale yellow, in Silver mode, they use white.
I wrote a quicky app to show the colors from GetSysColor() to no avail. Why do I suspect they use yellow unless they detect the silver color scheme is in use?
Joe Woodbury
"If other countries wanted their opinions to matter, they shouldn't be so small and weak." -- Ari Fleischer according to Frank J. (Parody at IMAO[^])
|
|
|
|
|
Can someone explain difference between these in an easy way to me :
const char *p="Test" ;
char const *p="Test";
char * const p="Test";
const char * const p ="Test";
|
|
|
|
|
act_x wrote:
const char *p="Test" ;
A pointer to a constant string - i.e. the pointer can be changed to point somewhere else, but the string itself is constant.
act_x wrote:
char const *p="Test";
Same as const char*.
act_x wrote:
char * const p="Test";
A constant pointer to a non-constant string - i.e. the string can be changed, but the pointer cannot be changed to point to something else.
act_x wrote:
const char * const p ="Test";
A constant pointer to a constant string - i.e. neither the string nor the pointer can be changed.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
A constant pointer to a non-constant string - i.e. the string can be changed, but the pointer cannot be changed to point to something else.
That is the beauty of C++, pointers.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hello,
I'm interested in the process behind the LVSCW_AUTOSIZE_USEHEADER used to set the width of the header control of a CListCtrl.
Does anybody know how they calculate the exact width of the text. This is based of the font used.
What is I want to write this myself?
m_cListCtrl.SetColumnWidth(i, CString("This is Column1).GetLength())
gives me the length of the string (15 points), but what I think I need to do is multiply this length by the average length (in points) of the characters used in the string.
Let's say a character average width is 6 points, my header will be 15 (=GetLength)*6, which is a reasonable width for the header.
Anybody knows of such a function. Or how I really should tackle this?
Thanks in advance
Wim
|
|
|
|