Click here to Skip to main content
15,905,558 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionProblem in call Bitmap::FromFile GDI function Pin
Member 417071117-Jul-09 4:18
Member 417071117-Jul-09 4:18 
QuestionProblem in call Bitmap::FromFile Gdi function Pin
Member 417071117-Jul-09 4:12
Member 417071117-Jul-09 4:12 
QuestionCRect Pin
kumar sanghvi17-Jul-09 3:35
kumar sanghvi17-Jul-09 3:35 
AnswerRe: CRect Pin
Iain Clarke, Warrior Programmer17-Jul-09 3:37
Iain Clarke, Warrior Programmer17-Jul-09 3:37 
QuestionConversion from Cstring to LPSTR Pin
Pardhu_M17-Jul-09 3:18
Pardhu_M17-Jul-09 3:18 
AnswerRe: Conversion from Cstring to LPSTR Pin
Cedric Moonen17-Jul-09 3:23
Cedric Moonen17-Jul-09 3:23 
GeneralRe: Conversion from Cstring to LPSTR Pin
Rajesh R Subramanian17-Jul-09 3:39
professionalRajesh R Subramanian17-Jul-09 3:39 
GeneralRe: Conversion from Cstring to LPSTR Pin
ThatsAlok18-Jul-09 7:45
ThatsAlok18-Jul-09 7:45 
AnswerRe: Conversion from Cstring to LPSTR Pin
Nemanja Trifunovic17-Jul-09 3:42
Nemanja Trifunovic17-Jul-09 3:42 
QuestionHow to disable CDockablePane context menu? Pin
eight17-Jul-09 1:37
eight17-Jul-09 1:37 
AnswerRe: How to disable CDockablePane context menu? Pin
Randor 17-Jul-09 2:26
professional Randor 17-Jul-09 2:26 
GeneralRe: How to disable CDockablePane context menu? Pin
eight19-Jul-09 17:02
eight19-Jul-09 17:02 
GeneralRe: How to disable CDockablePane context menu? Pin
eight19-Jul-09 17:54
eight19-Jul-09 17:54 
AnswerRe: How to disable CDockablePane context menu? Pin
severin09-Oct-09 8:17
severin09-Oct-09 8:17 
QuestionPragma pack, pointer, 32 vs 64 bits build Pin
Kochise17-Jul-09 0:55
Kochise17-Jul-09 0:55 
AnswerRe: Pragma pack, pointer, 32 vs 64 bits build [modified] Pin
Kochise17-Jul-09 1:17
Kochise17-Jul-09 1:17 
GeneralRe: Pragma pack, pointer, 32 vs 64 bits build Pin
Randor 17-Jul-09 1:54
professional Randor 17-Jul-09 1:54 
AnswerRe: Pragma pack, pointer, 32 vs 64 bits build Pin
Stuart Dootson17-Jul-09 1:50
professionalStuart Dootson17-Jul-09 1:50 
GeneralRe: Pragma pack, pointer, 32 vs 64 bits build [modified] Pin
Kochise17-Jul-09 5:44
Kochise17-Jul-09 5:44 
GeneralRe: Pragma pack, pointer, 32 vs 64 bits build Pin
Stuart Dootson17-Jul-09 13:05
professionalStuart Dootson17-Jul-09 13:05 
AnswerRe: Pragma pack, pointer, 32 vs 64 bits build Pin
cmk17-Jul-09 8:54
cmk17-Jul-09 8:54 
GeneralRe: Pragma pack, pointer, 32 vs 64 bits build Pin
Kochise17-Jul-09 10:32
Kochise17-Jul-09 10:32 
Yeah, I'm slownly working toward a solution to the problem, yet some stuff should still find an issue :

1- #pragma pack(8) align on a 8-byte boundary members of size >= 8, it doesn't add padding byte (what is in fact not a problem)
2- #pragma pack(1) align on a 1-byte boundary every members, nice for sending/receiving the struct as a frame. However that show the problem of software alignment fault on FPU members (float, double) and members whose size is greater than the current architechture word
3- #pragma pack(2) might lift up the problem upon most cases, but FPU members still get troubles
4- anonymous union is a nice stuff, yet I not always own the headers. Understand I work with compiled third party libraries and their header file. I work with struct coming out from these header files, and while I need the native format to deal with the library, I'd like to use the struct definition as a skeleton for my message's declaration as well. I 'just' need to enforce that the format of my message will be both 32 and 64 bit compatible (best is packing on 2 with 64 bits pointer).

#include <<foreign_lib.h>>

/* ======== foreign_lib.h ========
typedef struct foreign_struct
{ char  nMode;
  float fValue;
  int*  pArray;
};

foreign_struct* get_struct(void);
=== I HAVE NO CONTROL OVER THIS === */

// int send_frame(void* pBuffer, size_t nSize);

int test_struct(foreign_struct* frame)
{
#pragma pack(2)
  struct foreign_struct sFrame;
#pragma pack()

// foreign_struct : native struct format
// sFrame : my packed struct frame

  if(send_frame(frame, sizeof(foreign_struct))
  == send_frame(&sFrame, sizeof(sFrame)))
    return (int) TRUE;
  else
    return (int) FALSE;
}

int main(int argc, char *argv[])
{
  return test_struct(get_struct());
}


But thanks for you offer, good stuff to know !

Kochise

In Code we trust !

GeneralRe: Pragma pack, pointer, 32 vs 64 bits build Pin
cmk17-Jul-09 11:43
cmk17-Jul-09 11:43 
QuestionBHO IE7 problem when protected mode is ON? Pin
svt gdwl17-Jul-09 0:16
svt gdwl17-Jul-09 0:16 
AnswerRe: BHO IE7 problem when protected mode is ON? Pin
Michael Schubert17-Jul-09 0:51
Michael Schubert17-Jul-09 0:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.