|
first rid yourself of the [50]'s cause you don't need them. the string attribute tells MIDL to look for the null terminator and it does size calculations on its own. Next get rid of the typedef. MIDL doesn't need it. just use
<br />
struct PATIENT_INFO<br />
{<br />
[string] wchar_t wszPatientID;<br />
[string] wchar_t wszLastName;<br />
};<br />
Hope this helps ya out.
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
I am using automation to open an Access 97 database, and run a report. It works fine as long as I'm not trying to use a WHERE clause.
For example, this code works fine:
void CAccessReports::RunReport(CString strReportName)
{
if (m_pAccess && m_pDoCmd)
{
m_pDoCmd->OpenReport(
COleVariant(strReportName),
2, // acViewPreview
COleVariant(),
COleVariant());
m_pAccess->SetVisible(TRUE);
}
}
but this code:
void CAccessReports::RunReport2(CString strReportName,CString dfilter)
{
if (m_pAccess && m_pDoCmd)
{
m_pDoCmd->OpenReport(
COleVariant(strReportName),
2, // acViewPreview
COleVariant(),
COleVariant(dfilter);
m_pAccess->SetVisible(TRUE);
}
}
blows up with an Access error:
"Data type mismatch in criteria expression.@@@2@5003464@2"
(My WHERE clause is: [StartDate]>='04/02/2001' and [EndDate]<='04/18/2001')
What am I doing wrong here?
Thanks in advance for any help!
|
|
|
|
|
Hi all,
I am trying to pass BSTR arguments to a component's function from a client !I am using L prefix for the arguments !The problem is I am not getting any argument value in the function at the component !What may be the problem !
How can i successfully pass the BSTR arguments to the Interface function !
Thanx in advance for the help !
Y.Yamini Devi
|
|
|
|
|
Using L before a string makes it Unicode, not a BSTR. Read up on SysAllocString() and related APIs, and the _bstr_t CComBSTR wrapper classes.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Hi Yamini
The component u r using in VC++, i suppose have u tried L"xyz" in this fashion.if not then try it,possibly u will get the answer.Or try in this way:-
CString str;
str="ABC";
str.SysAllocString();
This may solve the problem.
Bye
|
|
|
|
|
Hi Yamini
The component u r using in VC++, i suppose have u tried L"xyz" in this fashion.if not then try it,possibly u will get the answer.Or try in this way:-
CString str;
str="ABC";
str.SysAllocString();
Then pass this instead of BSTR argument.
This may solve the problem.
Bye
|
|
|
|
|
How do I return an array of strings in IDL and COM? E.g. I would like a function that does something like this:
struct StringListType
{
long m_lNumStrings;
[string, size_is(lNumStrings)] wchar_t ** pStrings; // Is this correct???
};
void GetStrings( [out] struct StringListType * pStringList )
{
wchar_t Str1[] = "A silly string!";
wchar_t Str2[] = "You're da bomb ";
// What goes here to put Str1 and Str2 into pStringList???
}
I know I have to do some TaskMemAlloc() but am not sure of the correct way to do it. Also, I'm not sure of the proper way to specify an array of strings in the IDL above.
Thanxs for any help!
|
|
|
|
|
Hi everyone,
I don't know how to use two filtergraphs simultaneously in my application. When I
build two identical filtergraphs to capture two video sources simultaneously, it
works fine when the two filtergraphs run at the same time. But at the time when I
stop them, the application cracks. Each of the filtergraphs can run and stop
properly if the other is stopped.
Does anyone have the same experience as mine? Please help me solve this puzzle
thanks.
|
|
|
|
|
I'm used to using #import on a type library or the DLL itself and using that to set up my smart pointer to the interface(s) I need.
I'm now writing a COM object that wrappers a COM object written in JAVA. I've never even looked at Java before so what I was given is a series of *.class files which are apparently the equivalent of Java "exectuables" of a sort.
At any rate, I know the ProgID and CLSID of the COM object and can look at it under the OLE viewer. What's the correct way to load an interface to this COM object without having a DLL or TLB to import?
Thanks,
Matt Philmon
|
|
|
|
|
I'm used to using #import on a type library or the DLL itself and using that to set up my smart pointer to the interface(s) I need.
I'm now writing a COM object that wrappers a COM object written in JAVA. I've never even looked at Java before so what I was given is a series of *.class files which are apparently the equivalent of Java "exectuables" of a sort.
At any rate, I know the ProgID and CLSID of the COM object and can look at it under the OLE viewer. What's the correct way to load an interface to this COM object without having a DLL or TLB to import?
Thanks,
Matt Philmon
|
|
|
|
|
what is COM????
thanks for any help...
|
|
|
|
|
|
When I install my control from a CAB file I need to add a registry value as
well as download and register my .dll. None of the reg values reference in
the AddReg statements in my INF file are getting added.
If I extract the INF file manually and right-click Install on the INF
file in Windows Explorer the registry
value is added so I know the syntax of the INF file is correct. I can't use
binary code to simply add the necessary registry values because the people
who are deploying this control need to be able to change the reg values in
the INF to suit their needs and repackage the CAB file. Any ideas of how I
can do this would really be helpful.
Thanks,
Phil
|
|
|
|
|
I am trying to write an out of process com server that is capable of passing back to the client over the network a _ConnectionPtr. It is really a simple 2-tier application. But although the pointer I am getting back looks valid I get an error when I try and open a recordset using the connection returned.
Can anybody help.
I can post some sample code if that would help.
Cheers
AndyC
|
|
|
|
|
Hi,
I´m beggining with ATL and I don´t know how powerfull is it, or in which cases is better to use MFC or...
The most important questions that I have, is that if it is easy to use Compound documents with ATL ( like MFC with Compound documents server), so the user can paste one of this docs in MS Word and then pressing double click edit it there directly... ( that pretty things).
I know with MFC is just a wizard option, but with ATL.... ??? How it works, where can I find one example about that ?
Thanks in advance, Bye !
Braulio
|
|
|
|
|
Hi,
I´m beggining with ATL and I don´t know how powerfull is it, or in which cases is better to use MFC or...
The most important questions that I have, is that if it is easy to use Compound documents with ATL ( like MFC with Compound documents server), so the user can paste one of this docs in MS Word and then pressing double click edit it there directly... ( that pretty things).
I know with MFC is just a wizard option, but with ATL.... ??? How it works, where can I find one example about that ?
Thanks in advance, Bye !
Braulio
|
|
|
|
|
I have a method in an ATL COM component declared as follows:
STDMETHODIMP CHash::Digest(BSTR szString, BSTR* szRetval)
And I want to copy the szString variable into a string object, so I tried the following:
//copy the source into a string object
string source;
source = *szString;
However when I do this I only get the first character... what am I doing wrong? According to the documentation I found I should be able to do this but this doesn't work either:
string source = szString;
Help...?
|
|
|
|
|
The reason is that the string STL class is templated for types of char. Since a BSTR is double byte the string template assignment operator sees the second byte of the first char of your BSTR value as a null and terminates the string and stops continuing. If you want to copy the BSTR value into a STL "string" class then use the STL wstring template which is for Wide charater strings (double byte).
wstring source;
source = szString;
Or convert the szString to a single byte string using one of the converstion functions available like wcstombs and then copy it into your char string source variable. or use the USES_CONVERSION macro and use OLE2A() like follows.
Digest(BSTR szString, ...)
{
USES_CONVERSION;
string source = OLE2A(szString);
}
Cheers,
-Erik
|
|
|
|
|
/* -------------------------------------------------------------------------
Function: FromBstrToStr
Converts a BSTR to <string> ( not double byte...), well it´s no the
best method, but it seems to be the easiest one, without leaking memory
( well maybe...)
------------------------------------------------------------------------ */
string FromBstrToStr(BSTR TextB)
{
string ret;
_bstr_t bstrConv(TextB, FALSE);
ret = (const char *) bstrConv;
return ret;
}
|
|
|
|
|
/* -------------------------------------------------------------------------
Function: FromBstrToStr
Converts a BSTR to <string> ( not double byte...), well it´s no the
best method, but it seems to be the easiest one, without leaking memory
( well maybe...)
------------------------------------------------------------------------ */
string FromBstrToStr(BSTR TextB)
{
string ret;
_bstr_t bstrConv(TextB, FALSE);
ret = (const char *) bstrConv;
return ret;
}
|
|
|
|
|
I'm hosting the IWebBrowser2 object in a window (based on CWindowImpl). the mouse works perfectly within the browser, as does all navigation, however, I can not type within a textbox on a web page. Do I have to implement IDispach:Invoke and then redirect all keyboard events back to the browser? If so, how?
The relevant section of code for hosting the browser is
class CTest : public CWindowImpl>Ctest<
CTest() {
Create( phWnd, rcClient, _T("Browser"), WS_CHILD | WS_VSCROLL | WS_HSCROLL);
}
HRESULT CTest::DoAddBrowser(CComVariant t_URL) {
CAxWindow wnd(this->m_hWnd);
HRESULT hr = wnd.CreateControl(IDH_DEFAULTPAGE);
if (SUCCEEDED(hr)) {
hr = wnd.QueryControl(IID_IWebBrowser2, reinterpret_cast<void**>(&m_pIWebBrowser));
return m_pIWebBrowser->Navigate2(&t_URL,NULL,NULL,NULL,NULL);
}
return hr;
}
};
Thanks
Angus
|
|
|
|
|
|
I'm trying to create a window by implementing CWindowImpl and I want to remove the title bar from the window. I can do this using the WS_POPUP style using the win32 API, but when applied to CWindowImpl, the window is not visible.
The code below gives me an unusable window.
#include <atlwin.h>
class CWindowTest : public CWindowImpl<cwindowtest>
{
public:
CWindowTest() {
Create(NULL, CWindow::rcDefault, _T("Test"), WS_THICKFRAME|WS_POPUP|WS_VISIBLE);
}
virtual ~CWindowTest(){}
BEGIN_MSG_MAP(CWindowTest)
END_MSG_MAP();
};
Cheers,
Angus
|
|
|
|
|
Found the error!
rcDefault cannot be used with the WS_POPUP style. Yet another wasted few hours...
|
|
|
|
|
Hi !,
I´m new using this STL, now I can add members to a list an iterate though that list, but ... still don´t now how to delete members from it, and free the list in a right way...
Can anybody help me ? Thanks a lot,Bye !
Braulio
|
|
|
|