|
hi there..
firstly thanks for your time..
secondly i wanted to know 3 things:
1. my container also crashes when i remove my control from the test container...cant figure out the reason...possibly something to do with the releasing of this pointer..
2. what is the normal procedure in which u can exit a control, i mean all the releases and exitinstances and destructors?
3. from where can i get a sample OLE control so that i can use it for studying purposes..
thanks and kindest regards
safee
|
|
|
|
|
The simplest way to solve the issue is to start a debug session for your ActiveX component by first of all pointing the executable to "ActiveX test container" in your Project settings \ Debug Tab.
If you put a breakpoint in a destructor somehow, the session will halt there and hopefully it will be possible to isolate the issue.
RSS feed
|
|
|
|
|
yup got it..
thanks a lot
One more thing if u may have time..how can i check for memory leaks in my application??
ne ideaz!
thanks
kindest regards
safee
|
|
|
|
|
safeeullah wrote:
One more thing if u may have time..how can i check for memory leaks in my application??
When the debug session ends, it shows all leaks in the console window. If you are using MFC, you'll have plenty of details and will be able to double-click on the messages to reach the actual code being guilty. If you are not using MFC, you can instrumentalize your code by either of those :
- lookup this article[^] on CodeProject
- buy a commercial product like BoundsChecker (from Numega).
RSS feed
|
|
|
|
|
thanks stephane..
one last thing
i solved the crashing issue as well as the leak checking..
then i build my control in release mode..
when i built it in release mode, my spreadsheet stopped taking in data entries to cells..
ne information on this?
thanks again
|
|
|
|
|
safeeullah wrote:
when i built it in release mode, my spreadsheet stopped taking in data entries to cells..
1) Check out you don't have significant code in a
#ifdef _DEBUG
...
#endif
section. Because in release mode, no code would be generated.
2) If the debug mode works fine, and the release mode doesn't, it's usually because the code is weak. There is a probably a bad use of pointers somewhere.
- check out the console window for all "exception errors" that might be produced by Excel (or any other ActiveX host).
- build the release mode with "Debug Info". And check the ".pdb" box. Doing so, you can put a breakpoint even in release mode.
- Add a DebugBreak() statement in your code. This allows to halt the code, start a session, and watch variables, etc. To have this to work properly, it's best to generate a release version with all the debug info (see above).
- add a few message boxes in your code, and watch them. That's the most primitive way of solving issues, but sometimes it's enough!
Good luck!
And if you are to go on with debugging, crash handlers, etc. don't hesitate to buy this book[^].
RSS feed
|
|
|
|
|
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>")
|
|
|
|
|