|
I have created a non MFC win32 application,non dialog based.
I want to open powerpoint slide in my application window.
Is it possible to write OLE controller for powerpoint?
Please Help
|
|
|
|
|
Soumyadipta wrote: Is it possible to write OLE controller for powerpoint?
An OLE container? Have you tried importing from PowerPoint's type library?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry no idea,any sample example available
|
|
|
|
|
Soumyadipta wrote: any sample example available
Yes, have you bothered to search for such examples?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes,but all applications are MFC based
|
|
|
|
|
But the code that actually communicates with PowerPoint is not.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
But I can't choose automation class from class wizard for non MFC application
Please help me to find a proper sample
|
|
|
|
|
Soumyadipta wrote: But I can't choose automation class from class wizard for non MFC application
I just created a Win32 project, opened ClassWizard, clicked the Automation tab, and created an Excel class from its type library. It worked fine.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have also created a non MFC win32 Project but i can't add class from type library using class wizard.
I Think you have created MFC based win32 project.
If i am wrong please tell me the detailed steps.
|
|
|
|
|
Soumyadipta wrote: I have also created a non MFC win32 Project but i can't add class from type library using class wizard.
Lay out the exact steps you are using.
Soumyadipta wrote: I Think you have created MFC based win32 project.
You would be wrong in your thinking.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Here is the details
------------------------------
I am using Visual Studio 2005 (8.0)
File ->New -> Project
Visual C++ Project ->Win32 -> Win32 Project
Name=Oletest ,Saved to Desktop
Application Settings -> Windows Application -> Finish
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Oletest.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "Oletest.h"
#define MAX_LOADSTRING 100
// Global Variables:
HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_OLETEST, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_OLETEST);
// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// This function and its usage are only necessary if you want this code
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
// function that was added to Windows 95. It is important to call this function
// so that the application will get 'well formed' small icons associated
// with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_OLETEST);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (LPCTSTR)IDC_OLETEST;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
return RegisterClassEx(&wcex);
}
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
//
// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// Message handler for about box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
Which shows nothing of how you are attempting to create the PowerPoint classes via ClassWizard.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I want to change background color of ListCtrl.
I try to use this function
<br />
m_List.SetBkColor(RGB(76,85,118));<br />
but no work
Please advise me for this issue,May be it need more of code
Thanks
|
|
|
|
|
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
add message OnCtlColor
and add this code inside:
<br />
switch(pWnd->GetDlgCtrlID())<br />
{<br />
case IDC_LIST1: <br />
pDC->SetBkColor(RGB(0,0,0)); <br />
hbr = ::CreateSolidBrush(RGB(0,0,0)); <br />
pDC->SetTextColor(RGB(0,255,102)); <br />
return (HBRUSH)hbr;<br />
break;<br />
}<br />
then you are there where you wanted;)
|
|
|
|
|
Hi,
I am using ON_COMMAND_RANGE_HANDLER(ID_FIRST,ID_LAST,Onmenuitemselected)
The problem is When the user logs in as admin all the menu items are displayed and hence proper menu id gets invked.
If the user logs in to the application as operator, he does not have proper privileges , hence some of the menu items will not be displayed.
At this time, when the user clicks , third item in the menu (ID_FOURTH),ID_THIRD gets passed as wid.
Is there any way to handle this?
Regards,
Anitha
|
|
|
|
|
Menu IDs should stay the same whether the option itself is displayed or not.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
It does not when he assembles the menu entirely "by hand".
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Why would that make any difference? Whether the menu is "designed" at design time or at run time, the IDs should all be known ahead of time.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No, Menu id's are same they r defined in header file like
ID_FIRST 2001
ID_SECOND 2002
But when some menu items are not displayed, the ON_COMMAND_RANGE_HANDLER takes the menu items in sequence.hence , wrong functionality gets invoked.
|
|
|
|
|
If ON_COMMAND_RANGE_HANDLER() (which I was not able to find on MSDN or Google) is not working, try using:
ON_COMMAND(ID_FIRST, Onmenuitemselected)
ON_COMMAND(ID_SECOND, Onmenuitemselected)
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You are probably better off when you use a menu resource with the maximum of entries and then disable/hide some depending in the OnUpdate...() handler, depending on the application state.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Hi. I have a CTreeCtrl menu, and every once and a while I refresh the tree by calling DeleteAllItems() then re-adding all nodes. How can I prevent display updates of the the control until all items are added? Right now when the tree is refilled, you can see it all being deleted then filled up. All happens in a flash, but you can still see it refresh and I'd like to get rid of that if possible. Thanks!
|
|
|
|
|
Use the SetRedraw() method.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks! I knew it was something simple, I just couldn't find the method.
|
|
|
|
|