|
Great reply, thanks jhwurmbach!
regards,
George
|
|
|
|
|
for normal string operations, you only need to work with std::string .
(inspired from Scott meyers's More Effective C++ )
std::string is a typedef of std::basic_string , something like std::basic_string<char> (and/or support for unicode? with std::wstring ).
If you want to specify what is stored in the std::basic_string and how it is allocated, then you will need to explicitly use std::basic_string and learn to use char_traits and Allocator to tell the string what is in it and how to allocated the memory for it.
|
|
|
|
|
Great reply, thanks Maximilien!
regards,
George
|
|
|
|
|
I have made all the necessary registry entries to associate my app with a project file that it creates. When I double click on the file my app starts up but I get an invalid path error when opening the file. Once the application is running, however, I can open the project file without any problems. I am getting the file name from the m_lpCmdLine variable in my CWinApp derived class.
Does anyone have any suggestions how to resolve this problem?
Thanks.
|
|
|
|
|
masnu wrote: ...but I get an invalid path error when opening the file.
Does the path contain spaces?
"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
|
|
|
|
|
why don't you use your debugger for this ?
you could check where something is lost.
what i suspect is that you have spaces in your file path, and passing it through the commandline will not work since you don't put the path within quotes ("" ).
|
|
|
|
|
masnu wrote: Does anyone have any suggestions how to resolve this problem?
Yes, some kinda of debugging: for instance printout (maybe with a message box) command line content.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I managed to solve the problem. For those who are intrested I did the following:
CommandLineInfo cmdInfo;<br />
ParseCommandLine( cmdInfo );<br />
<br />
CString strProjectName = cmdInfo.m_strFileName;
This works without any issues.
Thanks.
|
|
|
|
|
our instrouctur gives as an assignment.i like to fouce on book store system.can i use c++(file)?can i connect my c++ code to my sql?
hi
|
|
|
|
|
afeson wrote: to fouce
afeson wrote: can i connect my c++ code to my sql?
Of course.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
You need to read the forum guidelines. Give your message a title with meaning. Everyone here needs help. These forums are for people having trouble with code they have already written. For basic questions use Google.
|
|
|
|
|
|
What do you need excatly?
|
|
|
|
|
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
|
|
|
|