La intencion es portar el codigo C++ (que rota la pantalla) a FOXPRO mediante llamdas api pero no logro portarlo, el problema esta en la estructura DEVMODE, hice el siguiente codigo que me muestra las direcciones de los miembros, se que no deben estar alineadas pero... hay alguna documentacion por ahi que pueda ver para solucionar?, las de MS no coinciden.
void RotateScreen(int a) {
DEVMODE dm;
memset(&dm, 0, sizeof(dm));
dm.dmSize = sizeof(dm);
int b=0;
char debug[100];
cout << "sizeof dm" << sizeof(dm) << ", ENUM_CURRENT_SETTINGS:" << ENUM_CURRENT_SETTINGS << ", DMDO_180:" << DMDO_180 << ", DMDO_DEFAULT:" << DMDO_DEFAULT;
if (0 != EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm))
{
int savew = dm.dmPelsWidth;
int saveh = dm.dmPelsHeight;
//dm.dmPelsWidth = 1024;
//dm.dmPelsHeight = 768;
dm.dmDisplayOrientation=DMDO_180; /*VALUE:2*/
//LONG result = ChangeDisplaySettings(&dm, 0);
ofstream outfile;
outfile.open("output.txt", ios::out | ios::trunc );
outfile << "Structure DEVMODE:" << sizeof(dm) << endl;
outfile << "dm.dmDeviceName:" << sizeof(dm.dmDeviceName) << ", value:" << dm.dmDeviceName << ", address:" << (void *)&dm.dmDeviceName << debug << endl;
outfile << "dm.dmSpecVersion:" << sizeof(dm.dmSpecVersion) << ", value:" << dm.dmSpecVersion << ", address:" << (void *)&dm.dmSpecVersion << endl;
outfile << "dm.dmDriverVersion:" << sizeof(dm.dmDriverVersion) << ", value:" << dm.dmDriverVersion << ", address:" << (void *)&dm.dmDriverVersion << endl;
outfile << "dm.dmSize:" << sizeof(dm.dmSize) << ", value:" << dm.dmSize << ", address:" << (void *)&dm.dmSize << endl;
outfile << "dm.dmDriverExtra:" << sizeof(dm.dmDriverExtra) << ", value:" << dm.dmDriverExtra << ", address:" << (void *)&dm.dmDriverExtra << endl;
outfile << "dm.dmFields:" << sizeof(dm.dmFields) << ", value:" << dm.dmFields << ", address:" << (void *)&dm.dmFields << endl;
outfile << "dm.dmOrientation:" << sizeof(dm.dmOrientation) << ", value:" << dm.dmOrientation << ", address:" << (void *)&dm.dmOrientation << endl;
outfile << "dm.dmPaperSize:" << sizeof(dm.dmPaperSize) << ", value:" << dm.dmPaperSize << ", address:" << (void *)&dm.dmPaperSize << endl;
outfile << "dm.dmPaperLength:" << sizeof(dm.dmPaperLength) << ", value:" << dm.dmPaperLength << ", address:" << (void *)&dm.dmPaperLength << endl;
outfile << "dm.dmPaperWidth:" << sizeof(dm.dmPaperWidth) << ", value:" << dm.dmPaperWidth << ", address:" << (void *)&dm.dmPaperWidth << endl;
outfile << "dm.dmScale:" << sizeof(dm.dmScale) << ", value:" << dm.dmScale << ", address:" << (void *)&dm.dmScale << endl;
outfile << "dm.dmCopies:" << sizeof(dm.dmCopies) << ", value:" << dm.dmCopies << ", address:" << (void *)&dm.dmCopies << endl;
outfile << "dm.dmDefaultSource:" << sizeof(dm.dmDefaultSource) << ", value:" << dm.dmDefaultSource << ", address:" << (void *)&dm.dmDefaultSource << endl;
outfile << "dm.dmPrintQuality:" << sizeof(dm.dmPrintQuality) << ", value:" << dm.dmPrintQuality << ", address:" << (void *)&dm.dmPrintQuality << endl;
outfile << "dm.dmPosition.x:" << sizeof(dm.dmPosition.x) << ", value:" << dm.dmPosition.x << ", address:" << (void *)&dm.dmPosition.x<< endl;
outfile << "dm.dmPosition.y:" << sizeof(dm.dmPosition.y) << ", value:" << dm.dmPosition.y << ", address:" << (void *)&dm.dmPosition.y<< endl;
outfile << "dm.dmDisplayOrientation:" << sizeof(dm.dmDisplayOrientation) << ", value:" << dm.dmDisplayOrientation << ", address:" << (void *)&dm.dmDisplayOrientation << endl;
outfile << "dm.dmDisplayFixedOutput:" << sizeof(dm.dmDisplayFixedOutput) << ", value:" << dm.dmDisplayFixedOutput << ", address:" << (void *)&dm.dmDisplayFixedOutput << endl;
outfile << "dm.dmColor:" << sizeof(dm.dmColor) << ", value:" << dm.dmColor << ", address:" << (void *)&dm.dmColor << endl;
outfile << "dm.dmDuplex:" << sizeof(dm.dmDuplex) << ", value:" << dm.dmDuplex << ", address:" << (void *)&dm.dmDuplex << endl;
outfile << "dm.dmYResolution:" << sizeof(dm.dmYResolution) << ", value:" << dm.dmYResolution << ", address:" << (void *)&dm.dmYResolution << endl;
outfile << "dm.dmTTOption:" << sizeof(dm.dmTTOption) << ", value:" << dm.dmTTOption << ", address:" << (void *)&dm.dmTTOption << endl;
outfile << "dm.dmCollate:" << sizeof(dm.dmCollate) << ", value:" << dm.dmCollate << ", address:" << (void *)&dm.dmCollate << endl;
outfile << "dm.dmFormName:" << sizeof(dm.dmFormName) << ", value:" << dm.dmFormName << ", address:" << (void *)&dm.dmFormName << endl;
outfile << "dm.dmLogPixels:" << sizeof(dm.dmLogPixels) << ", value:" << dm.dmLogPixels << ", address:" << (void *)&dm.dmLogPixels << endl;
outfile << "dm.dmBitsPerPel:" << sizeof(dm.dmBitsPerPel) << ", value:" << dm.dmBitsPerPel << ", address:" << (void *)&dm.dmBitsPerPel << endl;
outfile << "dm.dmPelsWidth:" << sizeof(dm.dmPelsWidth) << ", value:" << dm.dmPelsWidth << ", address:" << (void *)&dm.dmPelsWidth << endl;
outfile << "dm.dmPelsHeight:" << sizeof(dm.dmPelsHeight) << ", value:" << dm.dmPelsHeight << ", address:" << (void *)&dm.dmPelsHeight << endl;
outfile << "dm.dmDisplayFlags:" << sizeof(dm.dmDisplayFlags) << ", value:" << dm.dmDisplayFlags << ", address:" << (void *)&dm.dmDisplayFlags << endl;
outfile << "dm.dmNup:" << sizeof(dm.dmNup) << ", value:" << dm.dmNup << ", address:" << (void *)&dm.dmNup << endl;
outfile << "dm.dmDisplayFrequency:" << sizeof(dm.dmDisplayFrequency) << ", value:" << dm.dmDisplayFrequency << ", address:" << (void *)&dm.dmDisplayFrequency << endl;
outfile << "dm.dmICMMethod:" << sizeof(dm.dmICMMethod) << ", value:" << dm.dmICMMethod << ", address:" << (void *)&dm.dmICMMethod << endl;
outfile << "dm.dmICMIntent:" << sizeof(dm.dmICMIntent) << ", value:" << dm.dmICMIntent << ", address:" << (void *)&dm.dmICMIntent << endl;
outfile << "dm.dmMediaType:" << sizeof(dm.dmMediaType) << ", value:" << dm.dmMediaType << ", address:" << (void *)&dm.dmMediaType << endl;
outfile << "dm.dmDitherType:" << sizeof(dm.dmDitherType) << ", value:" << dm.dmDitherType << ", address:" << (void *)&dm.dmDitherType << endl;
outfile << "dm.dmReserved1:" << sizeof(dm.dmReserved1) << ", value:" << dm.dmReserved1 << ", address:" << (void *)&dm.dmReserved1 << endl;
outfile << "dm.dmReserved2:" << sizeof(dm.dmReserved2) << ", value:" << dm.dmReserved2 << ", address:" << (void *)&dm.dmReserved2 << endl;
outfile << "dm.dmPanningWidth:" << sizeof(dm.dmPanningWidth) << ", value:" << dm.dmPanningWidth << ", address:" << (void *)&dm.dmPanningWidth << endl;
outfile << "dm.dmPanningHeight:" << sizeof(dm.dmPanningHeight) << ", value:" << dm.dmPanningHeight << ", address:" << (void *)&dm.dmPanningHeight << endl;
outfile.close();
LONG result = ChangeDisplaySettings(&dm, 0);
if (result == DISP_CHANGE_SUCCESSFUL) /*DISP_CHANGE_SUCCESSFUL=0*/
{
//MessageBox(NULL, "Window Changed","Changed",MB_ICONEXCLAMATION|MB_OK);
cout << "window changed";
//Add a dialog to ask the user to confirm.
//The dialog should close automatically if user is unable to confirm
//if (confirm()) return;
Sleep(5000);
//dm.dmPelsWidth = savew;
//dm.dmPelsHeight = saveh;
dm.dmDisplayOrientation=DMDO_DEFAULT;
ChangeDisplaySettings(&dm, 0);
}
else
{
//MessageBox(NULL, "Window Rotated","Error",MB_ICONERROR|MB_OK);
cout << "failed change";
}
}
}
Este codigo me arroja el resultado que no comprendo...
Structure DEVMODE:156
dm.dmDeviceName:32, value:CDD, address:0x80fb90
dm.dmSpecVersion:2, value:1025, address:0x80fbb0
dm.dmDriverVersion:2, value:1025, address:0x80fbb2
dm.dmSize:2, value:124, address:0x80fbb4
dm.dmDriverExtra:2, value:0, address:0x80fbb6
dm.dmFields:4, value:544997536, address:0x80fbb8
dm.dmOrientation:2, value:0, address:0x80fbbc ***
dm.dmPaperSize:2, value:0, address:0x80fbbe
dm.dmPaperLength:2, value:0, address:0x80fbc0
dm.dmPaperWidth:2, value:0, address:0x80fbc2
dm.dmScale:2, value:2, address:0x80fbc4 ***
dm.dmCopies:2, value:0, address:0x80fbc6
dm.dmDefaultSource:2, value:0, address:0x80fbc8 ***
dm.dmPrintQuality:2, value:0, address:0x80fbca
dm.dmPosition.x:4, value:0, address:0x80fbbc ***
dm.dmPosition.y:4, value:0, address:0x80fbc0 ***
dm.dmDisplayOrientation:4, value:2, address:0x80fbc4 ***
dm.dmDisplayFixedOutput:4, value:0, address:0x80fbc8 ***
dm.dmColor:2, value:0, address:0x80fbcc
dm.dmDuplex:2, value:0, address:0x80fbce
dm.dmYResolution:2, value:0, address:0x80fbd0
dm.dmTTOption:2, value:0, address:0x80fbd2
dm.dmCollate:2, value:0, address:0x80fbd4
dm.dmFormName:32, value:, address:0x80fbd6
dm.dmLogPixels:2, value:0, address:0x80fbf6
dm.dmBitsPerPel:4, value:32, address:0x80fbf8
dm.dmPelsWidth:4, value:1440, address:0x80fbfc
dm.dmPelsHeight:4, value:900, address:0x80fc00
dm.dmDisplayFlags:4, value:0, address:0x80fc04 ***
dm.dmNup:4, value:0, address:0x80fc04 ***
dm.dmDisplayFrequency:4, value:64, address:0x80fc08
dm.dmICMMethod:4, value:0, address:0x80fc0c
dm.dmICMIntent:4, value:0, address:0x80fc10
dm.dmMediaType:4, value:0, address:0x80fc14
dm.dmDitherType:4, value:0, address:0x80fc18
dm.dmReserved1:4, value:0, address:0x80fc1c
dm.dmReserved2:4, value:0, address:0x80fc20
dm.dmPanningWidth:4, value:0, address:0x80fc24
dm.dmPanningHeight:4, value:0, address:0x80fc28
todos los atributos que tienen al final tres asteriscos estan repetidos, agradeceria cualquier luz o idea....