|
Ok, here my code excerpts:
hr = CreateObject(OLESTR("Excel.Application"), &pdispApplication);
V_VT(&v) = VT_BOOL;
V_BOOL(&v) = TRUE;
hr = Invoke(pdispApplication, DISPATCH_PROPERTYPUT, NULL, NULL, NULL,
OLESTR("Visible"), TEXT("v"), v);
hr = Invoke(pdispApplication, DISPATCH_PROPERTYGET, &vRet, NULL, NULL,
OLESTR("WorkBooks"), NULL);
pdispWorkbooks = V_DISPATCH(&vRet);
V_VT(&v) = VT_I2;
V_I2(&v) = xlWorkSheet;
hr = Invoke (pdispWorkbooks, DISPATCH_METHOD, &vRet, NULL, NULL,
OLESTR("Add"), TEXT("v"), v);
hr = Invoke(pdispApplication, DISPATCH_PROPERTYGET, &vRet, NULL, NULL,
OLESTR("ActiveWorkBook"), NULL);
pdispWorksheet = V_DISPATCH(&vRet);
hr = Invoke(pdispWorksheet, DISPATCH_PROPERTYGET, &vRet, NULL, NULL,
OLESTR("VBProject"), NULL);
Everything works fine till the last invoke. Excel gets started, and a new workbook opened. ActiveWorkBook also works, but not the last invoke. I even cant call ThisWorkbook, same result: exception error...
DKT
|
|
|
|
|
Anonymous wrote:
hr = Invoke(pdispWorksheet, DISPATCH_PROPERTYGET, &vRet, NULL, NULL,
OLESTR("VBProject"), NULL);
Are the first and sixth arguments correct?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I think so.
As I saw in the VBA "code", it is called like that:
ActiveWorkbook.VBProject.VBComponents.Import
What I did: I call "ActiveWorkbook" to get the active workbook. This gets stored in the pdispWorksheet, and is used for "VBProject". (I know this pdispWorksheet is confusing, but its just for testing).
I also tried to take the pdisp of my newly added Workbook directly, but it gets me the same result.
If I use pdispApplication or something like this, it shows me: Unknown method. If I change DISPATCH_PROPERTYGET to something else, I get: wrong member.
So, I thought it should be ok, how I am calling the method. But I dont see any logic why I get exceptions all the time. Theres not much more in this Invoke...
DKT
|
|
|
|
|
What I just found out:
I also got exceptions when Invoking "Run" to run a given macro.
I just found out that it happens cause the macro didnt exist in the sheet.
I put a breakpoint before the run, and created a little macro with the correct name. Then I traced over the run, and wow, it works...
What does that mean for the VBProject? I mean, it doesnt take any parameters, does it?
It just holds a retVal which is from type VARIANT.
DKT
|
|
|
|
|
how can i get a BYTE* from a bmp file?
thankyou
|
|
|
|
|
REPOST !!!
you didn't even way 1 hour !!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
dave2k wrote:
how can i get a BYTE* from a bmp file?
check out this api :- [CBitmap::GetBitmapBits]
"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 have facing a problem. I have a tool bar on a window.
When the child window is resized the tool buttons are obscured which I did like. So solve the problem I used rebar control hosted my tool bars on this rebar when the window is resized now and hides a portion of the toolbar ,a chevron appears. when you click on the chevron a menu pop ups which contains the obscured buttons.
BUT THE PROBLEM is that some of my tool bars contain a combo boxes.
HOW SHOULD I AM I GOING TO MAKE THE MENU DISPLAY MY COMBO BOXES TOO?
ANY IDEA ,ANY ONE
|
|
|
|
|
why wouldn't you make it a sub menu instead ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
both of us share the same point of view but my does not seem to agree with us .
A little while ago i got the idea that instead of using a menu I should create a dialog box where the menu should have appeared .
But i will need your help in doing so.
|
|
|
|
|
hum, i'm not sure i understand what is that new point you want to achieve.
moreover, what is the relation with the first point you asked on the forum ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
What I want achieve is to show a combo in a menu box.
but creating a combox requires it to be created as child window of some other window. But since Menu is not derived from cwnd so we cant make a menu a parent of a combo box. I hope I am clear till this point.
What i am trying to do is not something very new. because in visual studio.net 2003 when you resize tool bars the combo boxes can now appear in the pop up menu that appears when you click the >> (chevron).
What I was trying to suggest was since we cant use the CMenu class now ,we should consider using a dialog box. This dialog log box will appear where the menu appears now when we click the >> button on a tool whose all buttons are not visible.
The dialog will act as a menu and we will make it act like as menu i.e. hightlighting and unhighlighting items when mouse moves over it and destroy it when it loses focus.
I hope I make some sense this time.
if anything is still obscure please ask
|
|
|
|
|
What I want achieve is to show a combo in a menu box.
but creating a combox requires it to be created as child window of some other window. But since Menu is not derived from cwnd so we cant make a menu a parent of a combo box. I hope I am clear till this point.
What i am trying to do is not something very new. because in visual studio.net 2003 when you resize tool bars the combo boxes can now appear in the pop up menu that appears when you click the >> (chevron).
What I was trying to suggest was since we cant use the CMenu class now ,we should consider using a dialog box. This dialog log box will appear where the menu appears now when we click the >> button on a tool whose all buttons are not visible.
The dialog will act as a menu and we will make it act like as menu i.e. hightlighting and unhighlighting items when mouse moves over it and destroy it when it loses focus.
I hope I make some sense this time.
if anything is still obscure please ask
|
|
|
|
|
I'm having a small problem with my test program.
I have a Dialogbased program that has a bunch of buttons.
When I click on one of them, another Dialog appears. This new Dialog has only one button, called
"Continue".
Here's where my problem starts. This new dialog that appears should after a couple of seconds
activate another Dialog. This is done by a timer or Sleep function. The thing is that I manage
to get the third Dialog to appear automatically but I found that the Second Dialog with the button
"Continue" didn't show the button. It's like the Dialog is drawn but not the button.
Hope you understand my problem.
Is there any event that is sent afte the whole Dialog is painted, including the button or other controls?
I've tryed, WM_PAINT, WM_ACTIVATE, WM_SHOWWINDOW.
Please help!
|
|
|
|
|
Hachaso wrote:
When I click on one of them, another Dialog appears. This new Dialog has only one button, called
"Continue".
Here's where my problem starts. This new dialog that appears should after a couple of seconds
activate another Dialog.
Is your third Dialog is Model or ModelLess i.e. is it created with CDialog::DoModal [Model] or CDialog::Create and CDialog::ShowWindow [Modelless].....
"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
|
|
|
|
|
My thir Dialog is ModelLess.
Hope you have an answer to my problem.
|
|
|
|
|
Hachaso wrote:
Hope you have an answer to my problem.
I can help, But your problem seems to very unique!!.... can you show me little code snippet... so i can dig into you code.....
"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
|
|
|
|
|
If you want I can attach the whole project.
I'm trying to do this unique things to learn.
Where can I send you all my files?
This way you can see my problem.
|
|
|
|
|
Are you able to move your second dialog (in your terms, new Dialog with one continue button)
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
I have the structrue
[code]
struct Card{
char szFileName[MAX_PATH];
BYTE *lpImage;
Cards CardType;
};[/code]
an array of this structure will store 52 images representing different cards.
at the begining of my program i need to load all the images, and this is my effort for loading an image:
[code]
HBITMAP hbm = LoadImage(0, (LPCTSTR)"img.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE);[/code]
hbm is of type HBITMAP, so how can i get it into the structure where theimage type is of BYTE?
cheers
|
|
|
|
|
in your structure, why don't you just replace BYTE* by HBITMAP* ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
someone created that structure for me. later on, each image will be passed into memcmp (memory compare), along with a gui bitmap, to see whether the bitmap exists.
will this still work with HBITMAP?
|
|
|
|
|
I have some problems handling two print buffers of the printer's native resolution (720 dpi).
I can do one m_hBitmap=CreateCompatibleBitmap(pDC->m_hDC,5784,7938), but the second buffer returns me a NULL handle...
How can I increase the heap memory buffer ? The GDI object's memory seems very thigh. Can the HeapCreate function solve the issue ? Just a quick note, the PC features 1.5 GB of RAM, and currently only 300 MB is used. So it's not a memory problem...
Kochise
In Code we trust !
|
|
|
|
|
can anyone give me the programme to make telephone dictionary in c++
|
|
|
|
|
std::map<std::string, std::string>
where the first string could be the name and the second one the phone number...
if you're not satisfied, please be more specific in your question !!!!!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|