|
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
|
|
|
|
|
Wim Jans wrote:
Does anybody know how they calculate the exact width of the text.
CListCtrl::GetStringWidth() would be one way.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
And a nice way to do it!
Just fits my needs.
Thanks for that
|
|
|
|
|
I have a dialog as a child window to a CSizingControlBar. The dialog was created using the resource editor with 5 button controls at the top of it. At run time I dynamically add CListCtrls to it (the number of list controls will vary - depends on how many the user wants). The issue I am having is with the scroll bars when a new control is added while the scroll bar is scrolled down (not at the top position) the list controls get properly added in the right position but when I scroll back to the top of the dialog because I reset my scroll position to 0 before I add the new controls my original static controls are no longer there - They seem to disappear
If anyone can tell me what I am doing wrong I would greatly appreciate it
Thank you
|
|
|
|
|
I am getting this very strang problem while tracing my program with VS 6.0 debugger.
my program is written in VC++ 6.0, and it runs fine in release mode and in debug mode if I don't step into any functions.
But,my system looks like dead( freeze, stuck, what ever...) if I try to step into the program. This could happen any where in the program, it even happened at one line which contains only simple assignment statement (like: int x= 1;).
Would anybody give me some clues on this problem? Why do I get this? How to fix it?
Thank you very much in advance!
|
|
|
|
|
I see this from time to time, usually when debugging multithreaded apps on XP. Never noticed it on W2K. Ofter press Ctrl+Alt+Del to bring up Task Manager brings it back to life. That is the only solution I've found.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Which message do I need? I am trying NM_CLICK, and in that handler I check to see if any of my items is checked (have checkboxes). Problem is, the first item I click, triggers the event and the code steps into the function where I look for a checked item:
void CDlgFTP::OnClickLstftp(NMHDR* pNMHDR, LRESULT* pResult)
{
for( int index = 0; index < m_lstFiles.GetItemCount(); index++)
{
BOOL chk = m_lstFiles.GetCheck(index);
if (chk)
{
m_bGet.EnableWindow(TRUE);
}
}
*pResult = 0;
}
but this time around, chk is 0, but when I check the second item, and step into the code, the chk for element # 1 becomes 1, since its now checked. SO it looks like I am triggering my checkbox checking code prematurely. What message should I use instead?
Basically I want a button to get enabled when any item is selected in the listctrl.
Thanks,
ns
|
|
|
|