|
Best not to apply that globaly, it might have a serious impact on performence.
Surround the offending struct like so:
<br />
#pragma pack(push,1)<br />
struct blah<br />
{<br />
}<br />
#pragma pack(pop)<br />
That will force the compiler to use byte alignment just for the offending structure. A better soloution would be to provide aprropriate iostream serialisers.
Ryan
|
|
|
|
|
The pragmas work perfectly! The data is written correctly to file. I will use your method because apps including my sources don't have to be set to one-byte-alignment manually then.
Thank you!
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
I set it to one-byte-alignment and now it works!
Thank you very much!!
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Can someone provide me with an explanation of a CALLBACK
function? In other words, what is a CALLBACK function?
Basic, I know....
Thanks.
|
|
|
|
|
It provides a means for Windows to communicate with your program. For example, the EnumFonts() API enumerates the fonts available on a specified device. The third parameter is a function pointer that you supply that EnumFonts() will call for each font found. Inside your callback function, you'd receive information about the font (e.g., name, height, quality, character set).
|
|
|
|
|
The CALLBACK macro resolve to something like __stdcall , which is a calling convention for callback fucntions used by Windows. It is there to prevent you from using other calling convientions, like __cdecl , which would make your program crash.
From windef.h:
#define CALLBACK __stdcall
#define WINAPI __stdcall
#define WINAPIV __cdecl
#define APIENTRY WINAPI
#define APIPRIVATE __stdcall
#define PASCAL __stdcall
|
|
|
|
|
I was wondering if anybody knows of where i could find some simple tutorial on using sockets in vc++ I had a look at the msdn site and i found some stuff on CSocket for the MFC classes but i was more interested in using the winsock api
|
|
|
|
|
Easiest way to go...
Google Search[^]
-Mike Zinni
"No sh*t it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job."
|
|
|
|
|
One excellent reference on winsock is right here at CodeProject.
http://www.codeproject.com/internet/
Kuphryn
|
|
|
|
|
I can't figure out how to change the size of my mainframe in my project. I'm using CFormview. When I execute the program, the default size of the window is too large.
|
|
|
|
|
->MoveWindow (...); could help you out ...
|
|
|
|
|
You would adjust the placement/size in the CFrameWnd::PreCreateWindow() method.
|
|
|
|
|
Hi.
I wrote a small drawing SDI aplication for my child, (2 years old). He press a key, and he draw a figure in a Window view. But I want to disable the "Window button" and the "context menu button" of the keyboard, 'cause I won't show the start menu and the context menu while the aplication run, but when I close it I want to enable the buttons again.
How could I do that?.
Thank you and regards from Argentina.
Demian.
Demian.
|
|
|
|
|
One solution is to add a handler for PreTranslateMessage() and handle the virtual code accordingly.
Kuphryn
|
|
|
|
|
Or, you could handle the WM_SYSCOMMAND message and trap the SC_MOUSEMENU and SC_TASKLIST command types. See WM_SYSCOMMAND in the doc for details.
|
|
|
|
|
I will write you some of my code, and if you can tell me please where is an error:
CIPAddressCtrl m_ip_address;
CString set1="127",set2="0",set3="0",set4="1";
int s1,s2,s3,s4;
s1=atoi(set1);
s2=atoi(set2);
s3=atoi(set3);
s4=atoi(set4);
m_ip_address.SetAddress(a1,a2,a3,a4);
it doesn't create, because in debugger I see such picture:
a1 = 127 ''
a2 = 0 ''
a3 = 0 ''
a4 = 1 ''
I don't understand where it take's this ''.
|
|
|
|
|
Uh, you've not declared a1, a2, a3, or a4 anyplace. What are they?
|
|
|
|
|
Can I change the desktop theme through program? Please help me with some ideas...
Thanx in advance
Mahesh
|
|
|
|
|
I don't use themes so I can't verify this but you might be able to use SystemParametersInfo().
|
|
|
|
|
When saving settings the the registry I try and use a key that is the apps name. When the apps name is over 8 characters long the program shortens the key name to 8 characters. (example... for RegistryTest it would shorten it to REGIS~1) I would like it to save to RegistryTest. It works fine when run inside of Visual Studio but does not work when run directly.
Thanks for any help you can give me.
|
|
|
|
|
Do you have a code snippet that shows how you are creating the aforementioned key?
|
|
|
|
|
Yes...
In the registrytest.cpp I have the following line....
SetRegistryKey("TEST"); // sets the Registry location were values will be stored
and in registrytestDlg.cpp I have...
CWinApp *pApp = AfxGetApp();
pApp->WriteProfileString("Values","DBLocation","TEST");
this is a test app I made but the problem happens in every prodject I create that is over 8 characters long in the name.
Coyotedw
|
|
|
|
|
So does this create a key named HKEY_CURRENT_USER\Software\TEST\Values\DBLocation?
In the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem registry key, I'm wondering if you have the PreserveLongNames value set to 0x00000000. I doubt this is the problem as you've no doubt created files with names longer than 8.3 characters in the past. Other than that, you might step into the SetRegistryKey() and WriteProfileString() functions to see what they are doing.
|
|
|
|
|
While run inside the studio enviroment it creates a key named HKEY_CURRENT_USER\Software\TEST\registrytest\Values\DBLocation. When run outside of the studio enviroment it creates the key HKEY_CURRENT_USER\Software\TEST\REGIS~1\Values\DBLocation.
Coyotedw
|
|
|
|
|
I would recommend you use the registry function like RegSetValue(),RegQueryValueEx(), etc...
I have not had any problems using these.
|
|
|
|