Click here to Skip to main content
15,914,070 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: Templates compile error - errata 2 Pin
toxcct25-Jul-06 21:24
toxcct25-Jul-06 21:24 
QuestionTemplate compile error - errata Pin
nvatia21-Jul-06 3:26
nvatia21-Jul-06 3:26 
AnswerRe: Template compile error - errata Pin
prasad_som21-Jul-06 3:37
prasad_som21-Jul-06 3:37 
QuestionTemplates compile error Pin
nvatia21-Jul-06 3:23
nvatia21-Jul-06 3:23 
QuestionATL WTL STL Pin
mathumala21-Jul-06 3:11
mathumala21-Jul-06 3:11 
AnswerRe: ATL WTL STL Pin
toxcct21-Jul-06 3:22
toxcct21-Jul-06 3:22 
GeneralRe: ATL WTL STL Pin
Zac Howland25-Jul-06 10:11
Zac Howland25-Jul-06 10:11 
Questionsafearray access returns junk pls help Pin
nikhil_ag198520-Jul-06 1:52
nikhil_ag198520-Jul-06 1:52 
Hi All,
Im writing a dll in ATL COM called by a vb.net client. the client passes a 2d integer array when it calls MyMethod.
i have tow problems
I. i have trouble accessing the values in the array passed, i get junk values. this is the code.
<br />
STDMETHODIMP ExposedATLClass::MyMethod(SAFEARRAY **psa)<br />
{<br />
	AFX_MANAGE_STATE(AfxGetStaticModuleState())<br />
	long arrlengthx,arrlengthy;<br />
	long **myarray;<br />
	int indexx,indexy;<br />
	try<br />
	{<br />
		arrlengthx=(*psa)->rgsabound[0].cElements;<br />
		arrlengthy=(*psa)->rgsabound[1].cElements;<br />
		myarray=(long**)malloc(arrlengthx*sizeof(long**));	<br />
                for(long tempvar=0;tempvar<=arrlengthx;tempvar++)<br />
		{<br />
			myarray[tempvar]=(long*)malloc(arrlengthy*sizeof(long*));<br />
		}<br />
		SafeArrayAccessData(*psa,(void**)myarray);	//accessing data stored in safearray by obtaining pointer<br />
		char details[100];<br />
		for(int tempx=0; tempx<=arrlengthx; tempx++, indexx++, indexy=0)<br />
	{<br />
			for(double tempy=0; tempy<=arrlengthy; tempy++, indexy++)<br />
			{<br />
					sprintf(details,"%d %d %d",indexx,indexy,myarray[indexx][indexy]);<br />
					this->Error_Logger(details);	//this function prints 'details' in a txt file.<br />
			}<br />
		}<br />
	}<br />
	catch(CException ex)<br />
	{<br />
		char error[300];<br />
		ex.GetErrorMessage(error,300);<br />
		this->Error_Logger(error);<br />
		ex.Delete();<br />
	}<br />
	return S_OK;<br />
}<br />

in the program

SafeArrayAccessData(*psa,(void**)myarray); returns success

other methods i've used to access data are (replace the line "SafeArrayAccessData(*psa,(void**)myarray);" with code below )
1. using SafeArrayGetElement
<br />
long ai[2]={0,0}<br />
for(int temx=0;temx<=arrlengthx;temx++,ai[0]++)<br />
{<br />
	for(int temy=0;temy<=arrlengthy;temy++,ai[1]++)<br />
{<br />
		SafeArrayGetElement(*psa,ai,&myarray[temx][temy]);<br />
	}<br />
}<br />


here SafeArrayGetElement(*psa,ai,&myarray[temx][temy]); returns index out of bounds

2. using safearraylock/unlock
<br />
/*SafeArrayLock(*psa);	<br />
*myarray=(long*) (*psa)->pvData;<br />
SafeArrayUnlock(*psa);*/<br />


both lock and unlock returned success

all methods return this junk value for myarray[indexx][indexy] -842150451
the values of indexx and indexy are correct and so are the boundaries.

II. my other problem.. no exception is logged.

where am i wrong. pls help
Thanks in advance
Nikhil
Questionneed ATL???for login to server and access data Pin
With_problem19-Jul-06 21:40
With_problem19-Jul-06 21:40 
AnswerRe: need ATL???for login to server and access data Pin
Steve S19-Jul-06 21:50
Steve S19-Jul-06 21:50 
GeneralRe: need ATL???for login to server and access data Pin
With_problem19-Jul-06 22:12
With_problem19-Jul-06 22:12 
GeneralRe: need ATL???for login to server and access data Pin
Steve S19-Jul-06 22:24
Steve S19-Jul-06 22:24 
QuestionC# BHO question Pin
elefas19-Jul-06 3:15
elefas19-Jul-06 3:15 
QuestionProperty page loading to FireFox Browser. Pin
shivditya19-Jul-06 3:04
shivditya19-Jul-06 3:04 
QuestionIE - simulating ENTER key Pin
rana7418-Jul-06 21:55
rana7418-Jul-06 21:55 
Questiona way around constructor arguments Pin
nikhil_ag198518-Jul-06 21:05
nikhil_ag198518-Jul-06 21:05 
Questionhash_map file in VC6 Pin
misha_grewal18-Jul-06 20:24
misha_grewal18-Jul-06 20:24 
AnswerRe: hash_map file in VC6 Pin
Stuart Dootson18-Jul-06 21:58
professionalStuart Dootson18-Jul-06 21:58 
AnswerRe: hash_map file in VC6 Pin
Stephen Hewitt19-Jul-06 0:26
Stephen Hewitt19-Jul-06 0:26 
Questionwhy are WM_CTLCOLORSTATIC and COLOR_BTNFACE not playing along? Pin
alianyn18-Jul-06 3:39
alianyn18-Jul-06 3:39 
QuestionHow to check if the Flash player installed Pin
hell_admin13-Jul-06 20:58
hell_admin13-Jul-06 20:58 
AnswerRe: How to check if the Flash player installed Pin
sudeesh26-Jul-06 2:58
sudeesh26-Jul-06 2:58 
GeneralRe: How to check if the Flash player installed Pin
hell_admin26-Jul-06 3:14
hell_admin26-Jul-06 3:14 
QuestionCompiler error Pin
HarishDixit13-Jul-06 5:04
HarishDixit13-Jul-06 5:04 
AnswerRe: Compiler error Pin
Jörgen Sigvardsson16-Jul-06 21:59
Jörgen Sigvardsson16-Jul-06 21:59 

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.