Click here to Skip to main content
15,913,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWindows Networking reference Pin
Vimal Earnest10-Mar-03 7:08
Vimal Earnest10-Mar-03 7:08 
GeneralRe: Windows Networking reference Pin
dazinith10-Mar-03 7:30
dazinith10-Mar-03 7:30 
GeneralRe: Windows Networking reference Pin
Mike Zinni10-Mar-03 10:26
Mike Zinni10-Mar-03 10:26 
GeneralRe: Windows Networking reference Pin
Kuniva10-Mar-03 11:00
Kuniva10-Mar-03 11:00 
GeneralRe: Windows Networking reference Pin
valikac10-Mar-03 11:09
valikac10-Mar-03 11:09 
QuestionNT I/O Port access !? Is it easy? Pin
Behzad Ebrahimi10-Mar-03 6:29
Behzad Ebrahimi10-Mar-03 6:29 
AnswerRe: NT I/O Port access !? Is it easy? Pin
Tim Smith10-Mar-03 6:40
Tim Smith10-Mar-03 6:40 
GeneralPassing Strings to and from VB via a dll Pin
dazinith10-Mar-03 6:18
dazinith10-Mar-03 6:18 
i am so utterly frustrated right now.. i have been trying to pass a string from VB into a function, modify it and return it back to VB.. but i just cannot understand this BSTR crap.. i have tried to accomplish this 2 ways and im stuck both.. so im gunna list em both, and maybe someone will know how to fix one? thanks a bunch for any advice..

Problem number 1:
I pass 3 variables into my function..
FindBankName(strFilename, strRoutingNumber, strBankName)
when i call this function from VB i pass it these values in this order:
("C:\\FedACHdir.txt", "282976020", "bankname")
but as you will see below my c++ function does not get them in this order..
c++ function:
void __stdcall CFpsPayTaxxApp::FindBankName(BSTR strFilename, BSTR strRoutingNumber, BSTR strBankName)
{
	CString strTemp;
	strTemp = "The Filename passed is: >" + (CString) (LPCTSTR)strFilename + "<";
	AfxMessageBox(strTemp);
	
	strTemp = "The RoutingNumber passed is: >" + (CString)(LPCTSTR)strRoutingNumber + "<";
	AfxMessageBox(strTemp);

	strTemp = "The BankName passed is: >" + (CString)(LPCTSTR)strBankName + "<";
	AfxMessageBox(strTemp);
}

what i get for output is 3 message boxes.. the first says ">282976020<", the second ">bankname<", and the third has funky characters.. so the first parameter is never seen.. i have tried passing by reference, not by reference, passing with a return value, without a return value, passing as char* instead of BSTR, but i never get the first parameter.. the other problem with this approach is that i crash when i modify the passed in BSTR's..

Problem number 2:
I tried to take an ATL dll that is on CP which has examples involving BSTR's.. i got that dll to work fine with the parameters being passed.. the function even modified the string and returned it as modified (which i cant seem to do in the first method at all without crashing).. the problem here is that i can't seem to modify the string and return it.. probably because i am not handling the BSTR's properly.. but at least the example works, its just way to cryptic for me.. here is what i have trying to just return the variable modified.. it doesn't work either..
void __stdcall GetBankName(BSTR strFilename, BSTR strRoutingNumber, BSTR strBankName, BSTR strErrResponce)
{
strBankName = "what the?";
}
this doesnt change the text.. and the example i have i cant even follow..http://www.codeproject.com/dll/superdll.asp[^]

Conclusion:
problem #1 working would be alot better for me because i could use CStrings and other MFC things, where as problem #2 uses ATL and I am so lost dealing with these BSTR strings.. all I need to do is be able to set a char* array to a BSTR.. but i just cant seem to follow it..

if you have any idea what im doing wrong in #1, or can offer some suggestions on understanding modifying BSTR's in problem #2 i would be very appreciative.. thanksConfused | :confused:

still a newb.. cut me some slack :P
-dz
GeneralRe: Passing Strings to and from VB via a dll Pin
AlexO10-Mar-03 6:29
AlexO10-Mar-03 6:29 
GeneralRe: Passing Strings to and from VB via a dll Pin
dazinith10-Mar-03 7:27
dazinith10-Mar-03 7:27 
GeneralRe: Passing Strings to and from VB via a dll Pin
Brian Shifrin10-Mar-03 8:58
Brian Shifrin10-Mar-03 8:58 
GeneralRe: Passing Strings to and from VB via a dll Pin
dazinith10-Mar-03 7:51
dazinith10-Mar-03 7:51 
GeneralCDialog from a MFC dll... Pin
RobJones10-Mar-03 6:09
RobJones10-Mar-03 6:09 
GeneralRe: CDialog from a MFC dll... Pin
Bill Gates Antimatter Particle10-Mar-03 6:35
Bill Gates Antimatter Particle10-Mar-03 6:35 
GeneralRe: CDialog from a MFC dll... Pin
Alvaro Mendez10-Mar-03 7:36
Alvaro Mendez10-Mar-03 7:36 
GeneralChange menu name on run-time Pin
whofmans10-Mar-03 5:55
whofmans10-Mar-03 5:55 
GeneralRe: Change menu name on run-time Pin
RobJones10-Mar-03 6:16
RobJones10-Mar-03 6:16 
GeneralThanks! I have used it for language translation Pin
whofmans10-Mar-03 23:47
whofmans10-Mar-03 23:47 
GeneralThanks! I have used it for language translation Pin
whofmans10-Mar-03 23:51
whofmans10-Mar-03 23:51 
GeneralThanks! I have used it for language translation Pin
whofmans10-Mar-03 23:56
whofmans10-Mar-03 23:56 
GeneralRe: Change menu name on run-time Pin
Renjith Ramachandran10-Mar-03 7:49
Renjith Ramachandran10-Mar-03 7:49 
Generalnew comer Pin
Mr. Andrea10-Mar-03 5:16
Mr. Andrea10-Mar-03 5:16 
GeneralRe: new comer Pin
Maximilien10-Mar-03 5:29
Maximilien10-Mar-03 5:29 
GeneralRe: new comer Pin
Alvaro Mendez10-Mar-03 7:37
Alvaro Mendez10-Mar-03 7:37 
Generalsave increment filenames... Pin
macmac3810-Mar-03 5:10
macmac3810-Mar-03 5:10 

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.