Click here to Skip to main content
15,912,204 members
Home / Discussions / COM
   

COM

 
AnswerRe: Question about MFC &COM Application ? Pin
Skond23-Dec-06 2:50
Skond23-Dec-06 2:50 
QuestionCall DLL in VB.Net Pin
rajiv KumarMM18-Dec-06 19:48
rajiv KumarMM18-Dec-06 19:48 
AnswerRe: Call DLL in VB.Net Pin
Stephen Hewitt19-Dec-06 18:25
Stephen Hewitt19-Dec-06 18:25 
Questioncreate a process using WMI? Pin
abhiramsss18-Dec-06 8:55
abhiramsss18-Dec-06 8:55 
QuestionStarting COM Client from script Pin
Manfred Staiger218-Dec-06 2:37
Manfred Staiger218-Dec-06 2:37 
Questiontree view problem? Pin
sajid.salim.khan16-Dec-06 8:15
sajid.salim.khan16-Dec-06 8:15 
AnswerRe: tree view problem? Pin
User 21559718-Dec-06 1:07
User 21559718-Dec-06 1:07 
Questionusing BSTR Pin
chrigi00115-Dec-06 3:15
chrigi00115-Dec-06 3:15 
Hi
First: I know there are many topics in codeproject about using BSTR but i cant help myself further after 2 days trying to solve this problem...

1) Situation
============
My task is to write a program in VC++ which makes a windows program communicate to a sensor (MTi). There is a fully functional command line program from the producer of the sensor. Now i want to change severel settings (using specific functions) of the sensor like sample frequency and so on. The main function makes a Motion Tracker Object (written in c) to realize the communication through a virtual COM Port.

2) Problem
==========
I want to change the sample frequency of the data exchange between the program and the sensor (default it is 100Hz which is to fast for my application):

<br />
int nSFreq=25; //Sample Frequency in Hz<br />
int nUSFreq=0; //Used sample Frequency<br />
//Set new sample Frequency where pMT is the created Motion Tracker Object<br />
pMT->MT_SetMotionTrackerSampleFrequency(nSFreq);<br />
//Show the Sample Frequency for checkup <br />
MT_GetMotionTrackerSampleFrequency(&nUSFreq);<br />
//Show it on command Line<br />
printf("Your sample Frequency %d", nUSFreq);<br />


--> the command line shows 25 as expected, but the sensor samples still with 100Hz. Now i read that i have to safe the settings on the sensor using the sensor ID which is a BSTR. The ID i can get from this function:

<br />
//get the device ID<br />
virtual HRESULT STDMETHODCALLTYPE MT_QueryMotionTrackerB(<br />
            /* [out] */ BSTR __RPC_FAR *bstrDeviceID) = 0;<br />
//safe the new settings trough this function<br />
virtual HRESULT STDMETHODCALLTYPE MT_SaveToMTS( <br />
            BSTR bstrDeviceID) = 0;<br />


--> now, what i have done in my program:

<br />
BSTR nDId;<br />
//get the Device ID<br />
pMT->MT_QueryMotionTrackerB(&nDId);<br />
//safe settings<br />
pMT->MT_SaveToMTS(nDId);<br />


-->The program compiles very nice but when i run the .exe i got this damn error message all the time:
"An exception 'System.NullRefereceException' has occured in MTi.cmd1.exe"
(-->The error is only caused when i use the BSTR function shown above)

I know the problem is this BSTR but i cant help myself. Maybe someone can tell me what i need to do.
1000Thx

chris
AnswerRe: using BSTR Pin
lafleon15-Dec-06 8:51
lafleon15-Dec-06 8:51 
AnswerRe: using BSTR Pin
prasad_som15-Dec-06 19:14
prasad_som15-Dec-06 19:14 
QuestionHow to debug Pin
skylarmei14-Dec-06 15:52
skylarmei14-Dec-06 15:52 
JokeRe: How to debug Pin
Anton Afanasyev14-Dec-06 16:06
Anton Afanasyev14-Dec-06 16:06 
GeneralRe: How to debug Pin
skylarmei14-Dec-06 16:10
skylarmei14-Dec-06 16:10 
AnswerRe: How to debug Pin
prasad_som16-Dec-06 0:01
prasad_som16-Dec-06 0:01 
QuestionCalling an executable from Internet Explorer as a script? [modified] Pin
ghost120713-Dec-06 22:30
ghost120713-Dec-06 22:30 
AnswerRe: Calling an executable from Internet Explorer as a script? Pin
mejax13-Dec-06 23:00
mejax13-Dec-06 23:00 
GeneralRe: Calling an executable from Internet Explorer as a script? Pin
ghost120713-Dec-06 23:17
ghost120713-Dec-06 23:17 
AnswerRe: Calling an executable from Internet Explorer as a script? Pin
Colin Angus Mackay13-Dec-06 23:15
Colin Angus Mackay13-Dec-06 23:15 
GeneralRe: Calling an executable from Internet Explorer as a script? Pin
JacquesDP13-Dec-06 23:23
JacquesDP13-Dec-06 23:23 
GeneralRe: Calling an executable from Internet Explorer as a script? Pin
ghost120713-Dec-06 23:24
ghost120713-Dec-06 23:24 
GeneralRe: Calling an executable from Internet Explorer as a script? Pin
Colin Angus Mackay13-Dec-06 23:30
Colin Angus Mackay13-Dec-06 23:30 
QuestionPowerPoint Shape Export Pin
Topsen13-Dec-06 21:35
Topsen13-Dec-06 21:35 
QuestionDetermine virtual function table size Pin
J.B.13-Dec-06 17:21
J.B.13-Dec-06 17:21 
AnswerRe: Determine virtual function table size Pin
Roger Stoltz13-Dec-06 21:54
Roger Stoltz13-Dec-06 21:54 
QuestionDLL hell Pin
rockyl12-Dec-06 3:15
rockyl12-Dec-06 3:15 

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.