Click here to Skip to main content
15,923,557 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMFC Gurus Only1 Pin
John R. Shaw2-Sep-03 19:24
John R. Shaw2-Sep-03 19:24 
GeneralRe: MFC Gurus Only1 Pin
Joey Bloggs2-Sep-03 20:22
Joey Bloggs2-Sep-03 20:22 
GeneralRe: MFC Gurus Only1 Pin
John R. Shaw3-Sep-03 6:14
John R. Shaw3-Sep-03 6:14 
GeneralRe: MFC Gurus Only1 Pin
John R. Shaw3-Sep-03 8:20
John R. Shaw3-Sep-03 8:20 
QuestionHow to get redrew rectangel of screen? Pin
greatesky2-Sep-03 15:18
greatesky2-Sep-03 15:18 
AnswerRe: How to get redrew rectangel of screen? Pin
John R. Shaw2-Sep-03 20:07
John R. Shaw2-Sep-03 20:07 
GeneralMSBNx API help... Pin
JoeSox2-Sep-03 14:18
JoeSox2-Sep-03 14:18 
GeneralI still don't get it... Pin
Roger Knowles2-Sep-03 13:59
sussRoger Knowles2-Sep-03 13:59 
I have posted several questions on this project, and every answer has gotten me a little closer to my goal. I am stuck AGAIN so, here it goes:
 void __stdcall GetAccount(_clsAccount &Acct)<br />
{<br />
	HRESULT hr;<br />
	dbAccount dbAcct;<br />
<br />
	hr = CoInitialize(0);  //initializes COM library<br />
	if (SUCCEEDED(hr))<br />
	{<br />
		hr = CoCreateInstance( CLSID_clsAccount, <br />
			NULL, CLSCTX_INPROC_SERVER, IID__clsAccount, (void**) &Acct); <br />
<br />
		if(SUCCEEDED(hr))<br />
		{<br />
			if(dbAcct.Open())<br />
			{<br />
				_bstr_t bstr1(_T("This is the test string.")); //use constructor to enter string <br />
				Acct.put_AccountName(bstr1); ***********<br />
				//Acct->put_AccountName(bstr1);				//Acct->put_AccountName(BSTR __MIDL_0048)<br />
				dbAcct.Close();<br />
			}<br />
		}<br />
	CoUninitialize(); //Closes the COM library on the current apartment, <br />
					  //unloads all DLLs loaded by the apartment, frees <br />
					  //any other resources that the apartment maintains,<br />
	}<br />
}

The line Acct.put_AccountName(bstr1); (marked with ***) causes an Access Violation error, and I don't know why.
FYI. If I define the function as
void __stdcall GetAccount(_clsAccount *Acct)
and try to use Acct->put_AccountName(bstr1); to set the value...the same error occurs.
Please help if you can!
Thank you.
GeneralRe: I still don't get it... Pin
valikac2-Sep-03 14:19
valikac2-Sep-03 14:19 
GeneralRe: I still don't get it... Pin
rajdawg2-Sep-03 15:50
rajdawg2-Sep-03 15:50 
GeneralRe: I still don't get it... Pin
vcplusplus2-Sep-03 14:27
vcplusplus2-Sep-03 14:27 
GeneralRe: I still don't get it... Pin
rajdawg2-Sep-03 15:53
rajdawg2-Sep-03 15:53 
GeneralNewbie question on MFC Controls Pin
Binayak2-Sep-03 13:33
Binayak2-Sep-03 13:33 
GeneralRe: Newbie question on MFC Controls Pin
Shog92-Sep-03 16:26
sitebuilderShog92-Sep-03 16:26 
GeneralInvisible Dialog Pin
ez_way2-Sep-03 12:57
ez_way2-Sep-03 12:57 
GeneralRe: Invisible Dialog Pin
valikac2-Sep-03 14:20
valikac2-Sep-03 14:20 
GeneralRe: Invisible Dialog Pin
ez_way2-Sep-03 14:46
ez_way2-Sep-03 14:46 
GeneralRe: Invisible Dialog Pin
Joel Lucsy3-Sep-03 9:15
Joel Lucsy3-Sep-03 9:15 
GeneralI need as many opinions as possible Pin
DougW482-Sep-03 12:40
DougW482-Sep-03 12:40 
GeneralRe: I need as many opinions as possible Pin
Ted Ferenc2-Sep-03 12:51
Ted Ferenc2-Sep-03 12:51 
GeneralRe: I need as many opinions as possible Pin
valikac2-Sep-03 14:23
valikac2-Sep-03 14:23 
GeneralRe: I need as many opinions as possible Pin
Terry O'Nolley2-Sep-03 15:04
Terry O'Nolley2-Sep-03 15:04 
GeneralRe: I need as many opinions as possible Pin
DougW482-Sep-03 15:59
DougW482-Sep-03 15:59 
GeneralGetting the number of local drives on a system Pin
Dor2-Sep-03 12:32
Dor2-Sep-03 12:32 
GeneralRe: Getting the number of local drives on a system Pin
Michael Dunn2-Sep-03 12:38
sitebuilderMichael Dunn2-Sep-03 12:38 

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.