|
I have "inherited" an application that has the ability to start a COM service to communicate through VB to an Access database. It also can run in a standalone mode, where the service is not started and there is no network connection.
My problem comes in with regional settings. In the system where the service is running, if I do not format dates in US format in my sql statements, the access database does not process them. However, if I run the application on the standalone system without formatting the dates in the sql from VB it works fine (access accepts the sql statements and processes them). Naturally, if the regional setting is US all is fine, but when any other regional setting is chosen, the system with the service running does not update, while the standalone system does.
Does anyone know if Access has a way of knowing whether it is associated with a "networked" application or not? Or is this some how related to the COM service?
JeanneD
|
|
|
|
|
This is probably that the system default locale on the computer is set to English (US). The COM service will run under whichever user it's configured to, but often this will be the default of SYSTEM or LocalSystem. I'm not sure if the COM service infrastructure loads the user's profile, so you may find that the system default locale is being used even if you've configured the service to run as a normal user and that user has a different locale selected.
You should consider using parameterised SQL statements rather than using string concatenation to build a SQL statement. See the documentation for CreateParameter on the Command object. For Access/Jet, you'll want to use a ? as a parameter placeholder.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
how to show a button which will create in seprate dll ,
in detail:
i am calling a DLL in which a button is created but i want to show this button on my main dialog please tell me what i have to do for this.
Bankey Khandelwal
Software Engineer
Bankey Khandelwal
Software Engineer
|
|
|
|
|
STOP CROSS POST[^]
you are definitely not a Software Engineer as you say in your sig
|
|
|
|
|
v2.0 wrote: you are definitely not a Software Engineer as you say in your sig
Wow!.... Clever Decision
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
i don't like abusive guys, and engineers have generaly good common knowledge and good speaking, which is obviously not the case here...
-- TTD --
|
|
|
|
|
I have written a COM add-in for MS.Word in MFC. I can get the content of a document, and control ms.word's document successfully. However, I can't do functions as ms.Equation 3.0 does, such as adding a mathematical symbol. I don't know how to do that, how the ms.equation does as well as what ms.equation solves in detail. I'm in dark. Would you like to give me some advice, or point me some webpages. Thanks...
|
|
|
|
|
Hi,
I would replace the moniker that load data from internet when a HTML page (and its images) is browsed.
I'm not able to provide a moniker to MSHTML nor IE (thru the IBindHost).
How can I achieve to replace the moniker ?
|
|
|
|
|
I fill a pointer to a com object via CoCreateInstance. Now I use this one and must "get rid of" the connection and reinstanciate this object. Tried this via
Release() method, but this seems not to be enough. Any one an idea?
|
|
|
|
|
If you are talking about something like delete Object; then a call to Release should work for you. You have to make sure that there are no additional references to this object of yours. Release will return you ULONG which is the count of existing reference to this object.
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Thanks for the fast answer. Reference count is 0 afer release but the object doesn't destroy correctly. Posted the same subject in C++ Forum and got an answer that makes me think that the com dll has bugs. If you're interested to read my other comments please read the thread in the c++ forum. Thanks again for trying to help.
|
|
|
|
|
My pleasure!
I'll go through your C++ Forum thread.
BTW, a quick question - Do you have source code for the COM Server (DLL)? If yes, you could check the Release code
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Sorry I doesn't have source code of the dll.
|
|
|
|
|
What happens when the reference count of an object reaches 0 is a decision for the objects implementers to make. Lets assume the COM object is written in C++. Most objects will delete themselves when the reference count reaches zero. This is not mandatory however; A singleton will not delete itself when the reference count reaches 0, for example. In general it's an implementation detail which you shouldn't be concerned about. As a client you just follow the rules:
- Call AddRef when you copy an interface pointer.
- Call Release when an interface pointer goes out of scope.
- Don't use an interface pointer after you've called Release on it.
Steve
|
|
|
|
|
|
Can anyone tell me how do I add a .Net FCL Control to my C# project.
The problem that I am getting is that I have made a control in C# by selecting the project type as "Windows Control Library", In this project I am using just a Listbox and I have not made this project as a Component.
Then I make another C# project and on its toolbar I select "Choose Item" by right clicking my mouse button. On that I see a window which shows a list of .Net Framework Class Library Components and COM components, but since my project is not a Component I don't see my control in that list.
After that I tried adding the dll of my control in the references folder of my Client project, I was able to add that dll as a reference but the problem is that since my control is a visible control, I would like to see the Listbox which this control contains, whenever I use the control in my project.
I want my Control to appear on the tolbox of my client project, I was unable to do that?I was able to implement a class as a component, and use it as a control in my client, this worked perfectly fine and I saw my Class control on the toolbox of my C# client after I selected Choose
Item on the toolbox.
Please let me know what should I do regarding this issue?
|
|
|
|
|
|
Can anyone tell me how to create a Visible .Net Control and add it to a C# form?
|
|
|
|
|
Hi
Im dyeing here!!!!!!
I have writen a COM addin for word and excel in .net.
Everything was fine until the customer started installing my addin in their systems.
Eventually i understood that the problem is that im not the only fish in the sea.
Other addins, such as Acrobat Maker and others, prevent my addin to load.
I went to MSDN in search for answers, and, as usual i returned with more questions.
PLEASE !!! SOMEONE !!! i realy a good (working and understandeable - not like http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_comshim.asp ) tutorial to guide me in the horrable jurney of applying a shim to my Office Addin.
10x
Alex
|
|
|
|
|
Hi
iam trying to create a derived class of Win32_Process class using the following code .
but when iam trying to access that derived class in my query iam gettting error . can u please help me regarding this and tell me where iam doing wrong
IWbemClassObject *pNewDerivedClass = 0;
IWbemClassObject *pExampleClass = 0;
IWbemContext *pCtx = 0;
IWbemCallResult *pResult = 0;
BSTR PathToClass = SysAllocString(L"Win32_Process");
//The pSv variable is of type IWbemServices *
HRESULT hRes = pSvc->GetObject(PathToClass, 0, pCtx,
&pExampleClass, &pResult);
SysFreeString(PathToClass);
if (hRes != 0)
return;
pExampleClass->SpawnDerivedClass(0, &pNewDerivedClass);
pExampleClass->Release();
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = SysAllocString(L"Win32_DerivedProcess");
BSTR Class = SysAllocString(L"__CLASS");
pNewDerivedClass->Put(Class, 0, &v, 0);
SysFreeString(Class);
VariantClear(&v);
BSTR OtherProp = SysAllocString(L"OtherInfo2");
pNewDerivedClass->Put(OtherProp, 0, NULL, CIM_STRING);
SysFreeString(OtherProp);
hRes = pSvc->PutClass(pNewDerivedClass, 0, pCtx, &pResult);
pNewDerivedClass->Release();
Query to access Derived class
IEnumWbemClassObject* pEnumerator = NULL;
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_DerivedProcess"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
Thanks in Advance
abhi
|
|
|
|
|
Hi,
Does anyone know if it's possible to host an activeX control in a GUI-less console application, the control in question has no GUI itself (much like the WinInet activex control) and provides serial communication services (in the same way the WinInet provides socket services)
Thanks.
Phil Harding. myBlog [^] | mySite [^]
|
|
|
|
|
My bets are on that you'd have to have a message loop somewhere. Perhaps it would be easiest to just kick off a separate thread, which creates a modeless dialog window containing the ActiveX control. Depending on the control, you may have to marshal the interface pointer, in order to use in the main thread.
I think such a solution would have the least impact on your existing console code. You should also add ATL support to your code, which can manage the message loops and COM/ActiveX stuff for you. Regarding how to do that, create an ATL exe-server, and take a look at the module initialization. You may have to tweak it a little, since the wizard generated code assumes that you start in WinMain().
|
|
|
|
|
I want to add a my own shortcut item to the outlook shortcuts with VC,but I don't how to do this ,someone can help me! Thanks in advance!
|
|
|
|
|
I have created teh addin for Outlook 2003 and this is the sample code for . It may contain code which is not required
CComPtr<outlook::_application>olApp;
CComPtr<outlook::_explorer> spExplorer;
CComPtr<outlook::panes> panes;
IDispatch *scBarItem;
scBarItem=NULL;
//assign with application handle
olApp=m_Application;
olApp->ActiveExplorer(&spExplorer);
spExplorer->get_Panes(&panes);
panes->Item(CComVariant("OutlookBar"),&scBarItem);
if (scBarItem==NULL)
return S_OK;
CComQIPtr<outlook::_outlookbarpane>olBarPane(scBarItem);
CComQIPtr<outlook::outlookbarstorage>olbar;
CComPtr<outlook::_outlookbargroups>groups,groups1,groups2;
CComPtr<outlook::outlookbargroup>group,Item,todaysWorkBtn,othergroup;
CComPtr<outlook::_outlookbarshortcuts>shortcuts;
CComPtr<outlook::outlookbarshortcut>shortcut;
CComPtr<outlook::mapifolder>MFolder;
// CComPtr<outlook::_namespace>session;
olBarPane->put_Visible(true);
BSTR grName,todayName, otherName; //long count;
olBarPane->get_Contents(&olbar);
wchar_t Name[]=L"Test";
grName=SysAllocString(Name);
olbar->get_Groups(&groups);
//group=NULL;
long n;
groups->get_Count(&n);
BSTR temp1;
HRESULT hr123;
//for(int m=1;m<=n;m++){
hr123=groups->Item(CComVariant(1),&group);
if(hr123 == S_OK && group)
hr123= group->get_Name(&temp1);
//}
HRESULT hr=groups->Item(CComVariant(L"Test"),&group);
if(group==NULL)
{
CComQIPtr<outlook::_namespace> mysession;
CComPtr<outlook::mapifolder> InboxFolder;
BSTR sName;
CComPtr<outlook::_folders> Folders;
CComPtr<outlook::_folders> spFolders;
CComPtr<outlook::mapifolderptr> spNewFolder;
groups->Add( grName,CComVariant(1),&group);
group->get_Shortcuts(&shortcuts);
m_Application->ActiveExplorer(&m_Explorer);
m_Explorer->get_Session(&mysession);
mysession->GetDefaultFolder(olFolderInbox,&InboxFolder);
sName=_com_util::ConvertStringToBSTR("Inbox");
shortcuts->Add(CComVariant(InboxFolder),sName,CComVariant(1),&shortcut);
}
Cheers
"Peace of mind through Technology"
|
|
|
|
|
can anyone tell me how do I resolve this error? I get this error when I include FileName_i.c file in my managed C++ client. The complete error is:
cl : Command line error D8045 : cannot compile C file '..\Trial\Trial_i.c' with the /clr option
I also tried switching off the /clr option and used "No Common Language Runtime Support" option, but on that there comes a huge list of errors because I am writing managed code (i.e. Forms etc.), can anyone tell me how do I build my Client which includes the above filename.
|
|
|
|