|
After reading several boards, I'm close but no cigar. I have an existing C++ app that calls my vc6 dll which calls a vb6 dll. That seems to work fine except when I try to call a function in the vc dll from the vb dll. It works fine if I call the c++ dll from a vb exe. For this test, the calling vc app does a simple call to fakePlugIn().
The vc dll:
#include "stdafx.h"
#import "testvb.dll"
using namespace testvb;
extern "C" __declspec(dllexport) fakePlugIn()
{
HRESULT hresult;
CLSID clsid;
_vbdllcls *t;
CoInitialize(NULL); //initialize COM library
hresult=CLSIDFromProgID(OLESTR("testvb.vbdllcls"), &clsid);
hresult=CoCreateInstance(clsid,NULL,CLSCTX_INPROC_SERVER,__uuidof(_vbdllcls),(LPVOID *) &t);
if(FAILED(hresult))
{
AfxMessageBox("Creation Failed");
return false;
}
t->InVbDll("string to vb dll"); //call the vb dll
t->Release();
CoUninitialize();
return true;
}
extern "C" void __declspec(dllexport) Callback(void)
{
AfxMessageBox("in callback");
}
The vb code:
Public Declare Function Callback Lib "testcpp.dll" () 'this is in a module
Public Function InVbDll(ByVal s As String) As Long 'this is in class vbdllcls
MsgBox s
Callback
End Function
With Callback defined as __declspec(dllexport), the message box in Callback gets executed but then I get a runtime error: Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.
OK so I tried __stdcall instead. Then I don't make it to the Callback and get a runtime error:
First-chance exception at 0x77e73887 in cppshell.exe: 0xC000008F: Floating-point inexact result.
First-chance exception at 0x77e73887 in cppshell.exe: Microsoft C++ exception: _com_error @ 0x0012fbac.
I've tried various combinations as well with the same result. Ultimately, I'd like to pass strings into and possibly out of Callback, but one step at a time.
Any light you could shed on this would be appreciated!
|
|
|
|
|
I am hosting the Web Browser control in an application, and am setting the initial nav URL to a local directory. I would like to default the "View" to Thumbnails, but I cannot find where the View Type property is exposed.
Does anyone know how I can get access to this property and set it?
I have checked all the exposed interfaces for this control and did not see where this might be exposed as a method. The IWebBrowser2 interface exposes two Methods "GetProperty and PutProperty", not sure I could use these, mainly because I would have to know the property to get/put.
Any help would be great!
Thanx,
D.
|
|
|
|
|
Douglas Troy wrote:
I am hosting the Web Browser control in an application, and am setting the initial nav URL to a local directory. I would like to default the "View" to Thumbnails, but I cannot find where the View Type property is exposed.
There is no relationship, or at least I am not aware of it, between the web browser control which can be used to navigate web pages, and the windows explorer thumbnail view.
More to the point, where the web browser is used is for image preview when windows explorer is in web page mode (not in thumbnail view) : in this mode, windows explorer reads and executes the html code described in <windows dir> \ folder.htt. By default this code uses an ActiveX control to build a picture preview from the current file selection.
RSS feed
|
|
|
|
|
If your application hosts the Web Browser control and you point your initial nav location to a local drive, it will display a list of files (like standard Windows Explorer) ... I was hoping that I could somehow drill down into the shell to hook the view type and set it by default to Thumbnail.
I'll mess with the Folder.htt, and see if perhaps we can't just dump that file into our images directory and get it to automatically thumb that folder.
Thanks,
D.
|
|
|
|
|
HRESULT IShellView::CreateViewWindow(
IShellView *psvPrevious,
FOLDERSETTINGS *pfs,
IShellBrowser *psb,
RECT *prcView,
HWND *phWnd
);
where
typedef struct {
UINT ViewMode;
UINT fFlags;
} FOLDERSETTINGS, *LPFOLDERSETTINGS;
and ViewMode is :
typedef enum {
FVM_FIRST = 1,
FVM_ICON = 1,
FVM_SMALLICON = 2,
FVM_LIST = 3,
FVM_DETAILS = 4,
FVM_THUMBNAIL = 5,
FVM_TILE = 6,
FVM_THUMBSTRIP = 7,
FVM_LAST = 7
} FOLDERVIEWMODE;
RSS feed
|
|
|
|
|
Excellent! I must be blind, because I swear I checked my Platform SDK Docs IShellView and did not see reference to the File Folder struct you've provided here; I'll check again.
Thank you for the information, this is a big help,
D.
|
|
|
|
|
Here is the code:
_ConnectionPtr pConnection = m_AdoDatabase.GetActiveConnection();
IUnknown* pUnk;
HRESULT hr = pConnection->QueryInterface(IID_IDispatch, (void**) &pUnk);
_ConnectionPtr pConnection2;
hr = pConnection->QueryInterface(__uuidof(Connection), (void**) &pConnection2);
if (FAILED(hr))
{
TRACE("Failed to get pointer the second time.\n");
TRACE("Error: %s\n\n", GetComError(hr));
}
Shouldn't I be able to go from an ADO Connection object, to IUnknown, and then back again? How do I get back my ADO Connection from IUnkown?
|
|
|
|
|
Haven't checked, but may be __uuidof(Connection) returns the CLSID of the Connection object, while what is expected in queryinterface() is the IID of the interface.
RSS feed
|
|
|
|
|
|
And as an aside, you're not asking for IUnknown in the first QueryInterface, but IDispatch. In the case you have, both should work, of course...
Steve S
[This signature space available for rent]
|
|
|
|
|
|
I believe either __uuidof(_Connection) or __uuidof(_ConnectionPtr) is better.
Make sure to check that the return IID is non-NULL by the way.
RSS feed
|
|
|
|
|
Hi,
I'm trying to export data to Excel from a C++ Application.
For now, i didn't find any documentation to do this using VC++
My goal is to export data that user will be able to run Macro on it, made changes or do what ever they want, and then, get back the data to my application.
for now, i've been able to :
launch execl with activex control,
create a workbook,
create a worksheet.
But i cant find how to change name of worksheet, how to access cells...
there a lot of property that i don't know how to change
In my application, I have pointer to my object that i've created with activex controls (excel.application, Workbooks, Worksheet). but i don't know how to access an existing worksheet, or to change data in cells...
if somebody have any good documentation, or some exemples, it will be very usefull.
Please, help !
Jauss
|
|
|
|
|
To do this, you really need to learn VB! (OK, calm down, just kidding...)
There is a lot of information on the Excel Object Model, primarily aimed at VB programmers. What you need to remember is
(a) VB object is an interface, as far as you're concerned.
(b) Many methods take optional parameters (which you have to pass, but you can say they're not known)
(c) Check for errors at every opportunity.
(d) everything is done using methods, rather than directly accessing members (standard COM rules apply)
There is more helpful information in the MSDN Knowledge base, a search for "EXCEL" and "Automation" should get you some results you can work with.
By using the Workbooks "open" method, you can open an existing workbook (ie XLS file), and then by using that workbook object, you can get from its Worksheets collection, a specific worksheet; you can then get a range of cells from that object, and set or read values using methods.
Hope this is some help.
Steve S
[This signature space available for rent]
|
|
|
|
|
jauss wrote:
if somebody have any good documentation, or some exemples, it will be very usefull.
Why don't you just record a macro in Excel, and then lurk the resulting VB code?
RSS feed
|
|
|
|
|
Stephane Rodriguez. wrote:
Why don't you just record a macro in Excel, and then lurk the resulting VB code?
cause Data are used in a VC++ application, and some customers need to use their own excel macro on those data. That's why it would be great to export those data to excel, and then to retreive the new data.
|
|
|
|
|
I think we don't understand each other well. If you record a macro with Excel, it produces automation code. You can then convert this automation code using C++ syntax to reflect just that.
Converting it is a breeze. What you need is to import the Excel type-library (#import statement), and then the Excel objet model is available to you.
RSS feed
|
|
|
|
|
Hello all
i am new at this, and i have a small quistion about ATL language support for arabic !!!
i am facing some problems with having the arabic flow from right to left, so i cant read it clearly....
is this can be solved ??
if any body knows how to solve that... please send me an email on a.elbirry@lme.tv
thank you so much
|
|
|
|
|
I'm working on active scripting (vb-script) support in my application, so my application must support some COM objects. I familliar with COM but relatively new to dispatch interfaces and vb-script. Hence, I'm wondering whether I should expose an interface of a child/sub object via a propery or via a method.
Is there a criteria for using properties / methods?
So for example, should I do this:
Dim module<br />
Set module = modules.module("<name>")
or this:
Dim module<br />
Set module = modules.GetModule("<name>")
|
|
|
|
|
I created a COM by pb,i invoked it in WinForm ,it worked well!
But,when i invoked it in Web Services,throw a "System.NullReferenceException" Exception!
Any help would be greatly appreciated!
Thankx!!!
|
|
|
|
|
Hello!
I know that a Visual Basic 6 in-process COM Server can create and give away a reference to a Form (a private type) like this:
' From Class MyComponent.FormCreator
Public Function CreateForm as Object
Set CreateForm = New frmMyForm
End Function
So, a VB client could use an object of type MyComponent.FormCreator to access an instance of frmMyForm:
' Client code
Dim objFormCreator As New MyComponent.FormCreator
Dim objForm as Form
Set objForm = objFormCreator.CreateForm
Set objFormCreator = Nothing ' I do not need this object anymore
objForm.Show ' I use the provided Form
What I would like to know if it is possible to make a C++ COM Server that behaves just like MyComponent.FormCreator. Can I expose my own Form object type that mimics exactly a VB 6 Form?
Thank you very much.
|
|
|
|
|
I'm trying to register an atl com object.
The self-registration succeeds in windows NT but not in win98.
iesharp.81630.com
|
|
|
|
|
Has anyone used the 'sharedpropertygroup' stuff avaiable in com+ ????
thanks in advance...
Pablo75
|
|
|
|
|
In Windows DNA Architacture, three layer,
Every client call COM+ Server,Server create a new process
for this client?
After this client want to create a com object,
a thread in which com object is run is in that process?
-----------------------------------------
Is the above right?
TIA
Hello everyone
|
|
|
|
|
Hello everyone
|
|
|
|
|