|
This is what the documentation says but in practice it doesn't seem to work that way. Data structure members get packed to offset that corresponds to the size of their type ie., shorts to a two-byte boundary, ints to a four-byte boundary.
Here is a sample program and its output :
<br />
#include "stdafx.h"<br />
<br />
typedef struct<br />
{<br />
unsigned short int bfType; <br />
unsigned long int bfSize; <br />
unsigned short int bfReserved1;<br />
unsigned short int bfReserved2;<br />
unsigned long int bfOffBits; <br />
} BMFH;<br />
<br />
<br />
int main( int argc, char* argv[] )<br />
{<br />
printf( "sizeof BMFH is %d bytes\n", sizeof( BMFH ) );<br />
printf( "offset of bfSize is %2d\n", offsetof( BMFH, bfSize ) );<br />
printf( "offset of bfReserved1 is %2d\n", offsetof( BMFH, bfReserved1 ) );<br />
printf( "offset of bfReserved2 is %2d\n", offsetof( BMFH, bfReserved2 ) );<br />
printf( "offset of bfOffBits is %2d\n", offsetof( BMFH, bfOffBits ) );<br />
return 0;<br />
}<br />
sizeof BMFH is 16 bytes
offset of bfSize is 4
offset of bfReserved1 is 8
offset of bfReserved2 is 10
offset of bfOffBits is 12
__________________________________________
a two cent stamp short of going postal.
|
|
|
|
|
I want to change the default settings, to be precise the color of the buttons and the message background that they appear. I want the background and the button to have to different colors. I have research the Internet and have found no answer. I’m programming in Microsoft Visual C++ 6.0. Thank you in advance.
YaX
|
|
|
|
|
Are you talking about the Appearance tab of the Display Properties dialog?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks Dave... I was thinking more of hard coding the color... but yes i'm talking about the appearance tab... if i change the colors of the 3-d object it changes both the button and the window color. I only want to change the color of the button. Do you have any Suggestions on how i could possible hard coded.
YaX
|
|
|
|
|
To change the color of a button, I believe you need to override the OnCtlColor() method of the dialog class.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
HI,
There r examples on CP. abut Skin thay use BMPs for skin
I want to use GIF or PNG (fire works) files
Like animated Skins on dialogs.
How can i do this.
any link , example etc
thanx
Regards.
|
|
|
|
|
have a browse through the dialog[^] section of CP. There are a few articles there dealing with skinable dialogs.
I Dream of Absolute Zero
|
|
|
|
|
There r many but use BMP Images/files.
I want to Use GIF and PNG images.
any help in this regard.
thanx
Regards.
|
|
|
|
|
hello everyone..
this is my first post in this forum and actually it's a question about DLL's:
I made a *.cpp file with the following
#include <afx.h><br />
#include <Mmsystem.h><br />
<br />
LPCSTR _stdcall OpenSound (LPCSTR lpfile){<br />
CString str = lpfile;<br />
MCIERROR dwRet;<br />
<br />
str = "open \"" + str + "\" alias jack";<br />
<br />
dwRet = mciSendString(str,NULL,0,NULL);<br />
if (dwRet)<br />
MessageBox(NULL,"Fail to open","Hello!",0);<br />
else<br />
if (mciSendString("close all",NULL,0,NULL))<br />
MessageBox(NULL,"Fail to close","Hello!",0);<br />
<br />
<br />
return lpfile;<br />
}
and ofcourse I made a *.def file for it..
the problem is that the final DLL is TOO big ((80.0 kb in Release and 1.23 mb in Debug))
I made a dll in vb which contains a lot of functions and the size of it was about 60.0 kb..
so is there a way to minimize the DLL made by c++..
|
|
|
|
|
80kb doesn't sound too large to me.
What version of CString are you using?
Is it the MFC or ATL version? Are you statically linking or dynaminc link ATL/MFC
What kind of compiler optimisation settings are you using?
Michael
CP Blog [^]
|
|
|
|
|
I'm using the MFC and I don't know how to know if it's statically or dynamically!!
also I don't know about the optimisation thing..
actually I'm a very newb to these stuff..
|
|
|
|
|
This is a very common misconception among new Windows programmers. I suggest you read these three articles:
http://www.flounder.com/howbig.htm
http://msdn.microsoft.com/msdnmag/issues/01/01/hood/
http://www.microsoft.com/msj/archive/S569.aspx
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
too big for what man
?
gabby
|
|
|
|
|
Any idea how to include the branch parameter in via header for a REGISTER/ INVITE message. I am using Microsoft RTC 1.2 Client API calls.
I tried passing a XML file which acts upon the entered User account, Password, SIP URI, Server Address etc.. I don't know how to enter the branch parameter for via header which is a required field . It look slike as shown below...
Via: SIP/2.0/UDP 10.20.30.40:5060;branch=z9hG4bKDB2DC20E6BEB4E0FB3C0F299D0F3114D
|
|
|
|
|
Hi,
I have the same problem.If you got to know the way to do it, please do reply.
Thank you.
regards,
Hasini.
|
|
|
|
|
HI ,
Usinf DirectX and VC++ , how can i add text in video. means when i captured it ,, that text it also in that captured(saved on disk ) video.
thanx
Regards.
|
|
|
|
|
My code is as follows
May be i have mistake in it.
str gives nothing;
void CCloseDlg::OnDropFiles(HDROP hDropInfo)
{
AfxMessageBox ("Darg n drop");
LPTSTR str;
UINT n;
DragQueryFile( hDropInfo, 0xffffffff , str, n);
AfxMessageBox(str);
CDialog::OnDropFiles(hDropInfo);
}
plz make correction... i want to get whole path and file name
thanx
Regards.
Regards.
|
|
|
|
|
You have to allocate the buffer for the return value, and also use a correct file index:
TCHAR str[MAX_PATH];
UINT n = MAX_PATH;
UINT nFileCount = DragQueryFile( hDropInfo, 0xffffffff , str, n);
for (int fileIndex = 0; fileIndex < nFileCount; ++fileIndex)
{
DragQueryFile( hDropInfo, fileIndex , str, n);
AfxMessageBox(str);
}
|
|
|
|
|
Indeed you have errors
MSDN:
lpszFile
Address of a buffer to receive the file name of a dropped file when the function returns. This file name is a null-terminated string. If this parameter is NULL, DragQueryFile returns the required size, in characters, of the buffer.
You dont have a buffer, u just have an address
Anyway check this class[^]
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
See here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I need to group variables into different segments.
At runtime I have to get the absolute start-adresses and sizes of the sections (in dll and/or exe).
I know using dumbbin.exe (and the map-file) will give me some information.
keywords: data_seg, bss_seg, dumbbin
|
|
|
|
|
Dear Programmers,
I am working on an MFC/Dialog based project. I defined a function pointer in a class's header file as a static like below;
...
typedef BOOL (WINAPI *blTagHCWDOGEnable)(DWORD IN_dwSecTime);
static blTagHCWDOGEnable blHCWDOGEnable;
...
Then I initialised this function pointer from a dll with ordinary function (LoadLibrary(...) , GetProcAddress(...))
Everything is working OK in this class. I am able to use this function but when I try to use this function from another class I am encountering errors. As if something modifying content of function pointer and it is equaling to NULL.
What may cause this?
Thanks and best regards
|
|
|
|
|
Erkan Ermis wrote:
What may cause this?
The static keyword. Each file that uses your header file will get its own copy of the variable, so if you set it from one file, other files won't see the change.
Change static to extern and define the variable in one of the .cpp files without the extern keyword. That should help it to work.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have not applied yet but I am sure it will work.
Thanks for your clear explanation.
|
|
|
|
|
or you can use
typedef VOID (CALLBACK* PROCEDURE)(VOID);//or any parameter
PROCEDURE procedure;
dllhinst=LoadLibrary("x");
if (dllhinst!=NULL)
{
procedure=(PROCEDURE)GetProcAddress(dllhinst, "Function");
}
I can assure this will work very well
gabby
|
|
|
|