|
I've done this by using VariantToSystemTime to pick apart the DATE type, then set the corresponding members of a DBTIMESTAMP from the resulting SYSTEMTIME structure.
Steve S
|
|
|
|
|
Somebody use Microsoft IME in the code?
If yes, tell about it, please.
How can i add Microsoft IME support to my code?
|
|
|
|
|
Please can someone help me by explaining how i can convert a BSTR to DATE data type in ATL
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hello sohailkadiwala,
Does the BSTR contain a date in string format or does it contain the binary data of a date ?
- Bio.
|
|
|
|
|
Hello Lim Bio Liong
Well It does contain date in string format.
(actually i am using dd/mm/yyyy format in the BSTR)
There is a MFC Class but i am creating component for use with ASP page
Hence i have no support for MFC and the component is loaded InProcess.
So buddy, i am passing date from asp page to my component which is accepted in a BSTR
This BSTR contains date in dd/mm/yyyy format and i want to convert it into DATE.
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hello sohailkadiwala,
I think the function to use is VarDateFromStr() (#include <oleauto.h>). This function is for general OLE Automation support and its use is not confined to MFC apps alone.
I've written a simple ATL object with a method BstrToDate() :
STDMETHODIMP CDateTimeConversion::BstrToDate(BSTR date_string, DATE *date_value_receiver)
{
// TODO: Add your implementation code here
_bstr_t _bs_t_date_string(date_string, true);
return VarDateFromStr
(
(OLECHAR *)_bs_t_date_string,
(LCID)LOCALE_SYSTEM_DEFAULT,
(unsigned long)(VAR_DATEVALUEONLY),
(DATE *)date_value_receiver
);
}
I've also written a sample client app as follows :
void main()
{
::CoInitialize(NULL);
if (true)
{
IDateTimeConversionPtr spIDateTimeConversion;
BSTR bstr_date_string = _bstr_t(TEXT("04/11/2003")).copy();
DATE date;
spIDateTimeConversion.CreateInstance(__uuidof(DateTimeConversion));
spIDateTimeConversion -> BstrToDate ((BSTR)bstr_date_string, (DATE*)&date);
if (bstr_date_string)
{
::SysFreeString(bstr_date_string);
bstr_date_string = NULL;
}
}
::CoUninitialize();
}
If you need, I can email to you the full source codes to my ATL object and my sample client. Let me know your email address.
Best Regards,
Bio.
|
|
|
|
|
Thanx buddy
Wel i'll try out this function today. If i need i'll let you know about your source code.
BTW my mail id is sohail_k@lycos.com
modified 21-Apr-21 21:01pm.
|
|
|
|
|
convert the BSTR to _bstr_t or LPCSTR and then pass the string to a COleDateTime , see MSDN for COleDateTime help.
it's not so hard. good luck.
|
|
|
|
|
Hi there
Copy your BSTR Object into CComVariant
like
BSTR bstrobj;
CComVariant var(bstrobj);
use this method
var.ChangeType(VT_DATE);
this will convert your var which is holding bstr data to Date type data ,condition applys :BSTR must not hold malicious data
Now u can dine and date with your BSTR..objs.
Abhishek Srivastava
Software Engg (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
Hi,
is there any way to create in Outlook a Folder under an existing Folder such as "Inbox".
I have to do it in C++ by using the Wrapper-Classe from the Outlook Type Libraries.
I´m new in Automation and have some problems to do it.
Please send help !
Paul
|
|
|
|
|
For this Problem I have the solution.
And here comes the next:
In this new Folder I want to save an item.
How can I search for this folder wich is not the default folder.
Paul
|
|
|
|
|
Hello,
I created 2 .net dlls using C# and visual studio.net. One of the dlls (DLL1) references the other (DLL2).
I then create a .net exe (windows forms) which referenced both the DLLs.
I registered DLL1 with my system com+ services using regsvcs.exe. This was created as a server application with maximum access rights given.
I then created a proxy (proxy application) and deployed it on one workstation along with the .net exe.
When the exe file runs it is able to access DLL1 on the server. But DLL1 is not able to access DLL2.
To overcome this i registered DLL2 in the GAC but the problem was still present.
I want to know whether user created COM+ dlls can access other user created dlls on the system. If so how to do this.
A.Almeida
|
|
|
|
|
does anyone have any experience in this?
I am using a CRecorset (C++) object to pull data from a database. The data field in the recordset is a CTime data object. I am trying to pass the data to a class defined in VB and the property is a Date data type.
Any pointers would be greatly appreciated.
thanks
roger
|
|
|
|
|
We have an .NET service (written in C#, running in the LocalService account), which impersonates an account, opens a CDO session and then reads/writes mails and tasks from/to folders only accessible by the impersonated user.
If the service calls windowsImpersonationContext.Undo() after the CDO session has logged on, it usually can read public folders and their content without a problem. But every once in a while (average after 20 objects have been read), it throws a System.NullReferenceException at System.Runtime.InvokeDispMethod.
If the service does not undo the impersonation and runs in the account which is logged on to Exchange, the NullPointerException is thrown exactly when the fourth CDO object is retrieved. I have already tried opening a new session before opening a folder, but then the Exception is thrown while logging on the fourth session.
If the fourth action is reading the contents of a folder, the NullreferenceException occurs in MAPI.Folder.get_Messages(). If I try to read a message, it occurs in MAPI.Message.get_Text(),
MAPI.Message.get_Attachments() or another get-method.
Here is a typical stack trace for reading message properties:
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at MAPI.Message.get_Attachments()
at Vita.Bk.SecureItem.CopyFrom(Message message)
And here is a typical stack trace for listing folder items:
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at MAPI.Folder.get_Messages()
at Vita.Bk.OutlookService.OutlookService.ListUserTodoItems(Object[] parameters) in c:\visual studio-projekte\mba kataster\outlookservice\outlookservice.cs:line 529
That is how the service behaves on .Net Framework 1.0 without service packs. I have installed Service Pack 2, now the NullReferenceExceptions always occur at random, no matter if the service is still impersonating a user or not.
The "Outlook EMail Security" stuff has been configured to allow all MAPI and CDO actions, but there is still no change, the CDO objects are throwing Exceptions after a while.
Does anyone know what happens here? Is is a problem of CDO or .NET Interop?
Thanx in advance,
corinna
|
|
|
|
|
We get a similar situation with our ASP.NET site that uses CDO to access our Exchange server. I never have figured it out and usually just "kicked" it to get it going again (kill the ASP.NET worker process). I'm betting it's a similar issue...except we don't use interop. At least, not directly. But we don't use impersonation, either. ASP.NET uses the System.Web.Mail namespace classes, which do use CDO. I'm guessing this problem is with CDO.
As far as configuring the Outlook email security, this shouldn't affect anything. They only affect MAPI, not Extended MAPI (or CDO, which seems to use some EMAPI).
I wish I could be of more help, but like I said, I never figured it out myself.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
i compiled a atl project to implement dhtm binary behavior by vc6.0.
but, the error, 'IElementBehavior' : base class undefined, had appeared.
i included mshtml.h in my project.but i find that the interface 'IElementBehavior' is not in it. why?help me.thanks.
vc++6.0 winxp pro
|
|
|
|
|
Are you sure your INCLUDE path is setup right? Sure, it is supposed to throw an error when a header file isn't found, but one never knows. Are you sure you have the latest Platform SDK? I have the most recent PSDK and IElementBehavior is showing up in my mshtml.h header file.
If all you have is the PSDK that came with VC++ 6.0, chances are you don't have it. Go to http://www.microsoft.com/msdownload/platformsdk/sdkupdate/default.htm[^] and update the PSDK on your machine. This could take a while, so make sure you have a fast connection or get the CD, in which case you pay only for S&H.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
That is ok! thanks to Heath Stewart.;)
|
|
|
|
|
Hi guys,
I'm pretty sure what I'm going to ask is impossible, (I can't think of a way round it), however I'm trying to write a program which can get past a software firewall (outgoing) on a local machine (I KNOW there is not much you can do if someone has a linux firewall on a remote machine). Is there anyway to defeat software level (ie ZoneAlarm) packet filtering.
The reasoning behind this request is a program for stolen computers to report back to a server.
regards,
entr0py
|
|
|
|
|
|
I have an application which represents the filesystem of a device connected via a serial link. I do navigate the device's filesystem and copy files to/from using drag/drop or clipboard. Here comes the problem. I implemented Drag/Drop and Clipboard using CF_FILEDESCRIPTOR and CF_FILECONTENTS with IStream. But i donno how to copy the nested folders from the application to the Windows Explorer. Should i enumerate the contents of folder and all itz subfolders? It can be timeconsuming over the serial link.
Somewhere i read that 'IStorage' can be used for the purpose. But how ? No information or examples regarding "how to implement IStorage" is not available. Can anybody help me to solve out this, pleeeeeeeease?
|
|
|
|
|
Our applicatiosn hosts the WebBrowser control. I need to catch the onclick event on a web page from our application.I am able to catch the onclick event except for frames in my handler in the event sink. When I click on a frame in a webpage, I am not able to get the onClick event to be handled in my code. Can anyone tell me why it is behaving this way?
|
|
|
|
|
Each frame hosts it's own document. You'll have to advise each document by enumerating all the frames and getting the documents for each (remembering to clean them up later).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank you very much. It really helped.
|
|
|
|
|
I have developled a SDI application using MFC (VC++ 6.0) which may be launched with an ini file as a parameter or directly from the executable.
If the ini file is provided this is read to ascertain a number of parameters, including details for a sockets connection which creates a telnet type user interface, processed via OnOpenDocument.
If no ini file is provided the program derives this from the name of the executable, processed via OnNewDocument which then calls OnOpenDocument passing in the correct file as though read from the command line.
I am now trying to invoke the Automation, which I requested when I created the original program via the wizard, so I can drive it from a script, but am having some difficulties.
From VBA I want to be able to either
create the application then via an automation function pass in the address of the ini file and process as though I had launched it from a shortcut
or
pass in the ini file with the original CreateObject.
I am getting a number of errors when I follow the normal documentation which I think means that I am going through the startup process multiple times.
Does anyone know of a diagram of the process followed when an object is created via Automation or have any hints which may put me on the correct path.
I had expected it to behave like Word or Excel where you CreateObject the application then Open a "Document" but that doesn't seem to be the process which the wizard has created in my application.
Sara
|
|
|
|