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

C / C++ / MFC

 
GeneralRe: about MessageBox Pin
csc6-Dec-04 19:50
csc6-Dec-04 19:50 
GeneralRe: about MessageBox Pin
David Crow7-Dec-04 3:46
David Crow7-Dec-04 3:46 
GeneralI'm looking for solutions Pin
Rassul Yunussov6-Dec-04 19:24
Rassul Yunussov6-Dec-04 19:24 
GeneralRe: I'm looking for solutions Pin
David Crow7-Dec-04 3:01
David Crow7-Dec-04 3:01 
GeneralRe: I'm looking for solutions Pin
Rassul Yunussov7-Dec-04 4:47
Rassul Yunussov7-Dec-04 4:47 
GeneralRe: I'm looking for solutions Pin
Antony M Kancidrowski7-Dec-04 4:59
Antony M Kancidrowski7-Dec-04 4:59 
GeneralRe: I'm looking for solutions Pin
David Crow7-Dec-04 7:27
David Crow7-Dec-04 7:27 
GeneralSAFEARRAY Pin
Rassul Yunussov6-Dec-04 17:23
Rassul Yunussov6-Dec-04 17:23 
Whell let me explain my problem:
I got next sructures of data:
struct Station
{
  CString Name;
  ULONG Number;
  CTime TimeArrivial;
  CTime TimePlannedArrivial;
  ULONG TimeAccuracy;
};
struct Vehicle
{
 CString Name;
 ULONG Circle;
 vector <Station> vStations;
};

vector<Vehicle> vVehicles;
So, i tried to pack it in SafeArray, but i don't know right it or not:
struct saStation
{
  BSTR Name;
  ULONG Number;
  LONG TimeArrivial;
  LONG TimePlannedArrivial;
  ULONG TimeAccuracy;

};
struct saVehicle
{
 BSTR Name;
 ULONG Circle;
 SAFEARRAY *psaStations;
};

then i pack it:
SAFEARRAYBOUD rgsabound[1];
rgsabound[0].cElements = vVehicles.size();
rgsabound[0].lLbound = 0;
SAFEARRAY* pMainArray = SafeArrayCreate(VT_VARIANT,1,rgsabound);
saVehicle* psaVehicles;
SafeArrayAccessData(pMainArray,(void**)&psaVehicles);
for(int i = 0;i<pMainArray->rgsaboud[0].cElement;i++)
{
 psaVehicles[i].Name = vVehicles[i].Name.AllocSysString();
 psaVehicles[i].Circle = vVehicles[i].Circle;
 SAFEARRAYBOUD rgsastationbound[1];
 rgsastationbound[0].cElements = vVehicles[i].vStations.size();
 rgsastationbound[0].lLbound = 0;

 psaVehicles[i].psaStations = SafeArrayCreate(VT_VARIANT,1,rgsastationbound);
 saStation* psaStation;
 SafeArrayAccessData(psaVehicles[i].psaStations,(void**)&psaStation);
 for(int j = 0;j<vVehicles[i].vStations.size();j++)
 {
  //Fill In The psaStation...
  //....
 }
 SafeArrayUnaccessData(psaVehicles[i].psaStations);
}
SafeArrayUnaccessData(pMainArray);


But, whe i try to call SafeArrayDestroy(pMainArray) i got an error...
First got all the data from vehicle and stations, then SafeArrayDestroy to Stations,
after all this i call SafeArrayDestroy to pMainArray, and my programm crashes with assembler text in my visual studio, in function call stack i got NTDLL something like this...
What's wrong here??
And Another question:
If i want to create a multidimensional safearray, can i do next
SAFEARRAYBOUD sab[10];//for example???
Will it be 10 dimensional Array?
GeneralRe: SAFEARRAY Pin
Steve S7-Dec-04 1:23
Steve S7-Dec-04 1:23 
GeneralRe: SAFEARRAY Pin
Rassul Yunussov7-Dec-04 4:45
Rassul Yunussov7-Dec-04 4:45 
GeneralRe: SAFEARRAY Pin
Steve S7-Dec-04 6:09
Steve S7-Dec-04 6:09 
GeneralCFormView Pin
bluehai6-Dec-04 17:09
bluehai6-Dec-04 17:09 
GeneralRe: CFormView Pin
Antony M Kancidrowski7-Dec-04 5:04
Antony M Kancidrowski7-Dec-04 5:04 
GeneralRe: CFormView Pin
Steve S7-Dec-04 23:51
Steve S7-Dec-04 23:51 
Generalread the DOC file Pin
tiem6-Dec-04 16:35
tiem6-Dec-04 16:35 
GeneralRe: read the DOC file Pin
David Crow7-Dec-04 3:43
David Crow7-Dec-04 3:43 
GeneralCheck file exist Pin
jinxmanh6-Dec-04 15:56
sussjinxmanh6-Dec-04 15:56 
GeneralRe: Check file exist Pin
ThatsAlok6-Dec-04 17:12
ThatsAlok6-Dec-04 17:12 
GeneralRe: Check file exist Pin
PJ Arends6-Dec-04 18:06
professionalPJ Arends6-Dec-04 18:06 
GeneralRe: Check file exist Pin
ThatsAlok6-Dec-04 18:52
ThatsAlok6-Dec-04 18:52 
GeneralRe: Check file exist Pin
David Crow7-Dec-04 3:54
David Crow7-Dec-04 3:54 
GeneralProblem about tab stop Pin
ytod6-Dec-04 14:55
ytod6-Dec-04 14:55 
GeneralRe: Problem about tab stop Pin
ytod6-Dec-04 15:05
ytod6-Dec-04 15:05 
GeneralRe: Problem about tab stop Pin
namaskaaram6-Dec-04 22:19
namaskaaram6-Dec-04 22:19 
GeneralParent window not on the top Pin
Vancouver6-Dec-04 14:34
Vancouver6-Dec-04 14:34 

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.