|
Christian Graus wrote: You;re trying to automate Word using C++ and .NET ?
No, using C++ and COM.
Code I am using:
VARIANT root[64] = {0}; // Generic IDispatchs
VARIANT parm[64] = {0}; // Generic Parameters
VARIANT rVal = {0}; // Temporary result holder
int level=0; // Current index into root[]
// Initialize the OLE Library...
OleInitialize(NULL);
// Line 1: Set oWord = CreateObject Word.Application
CLSID clsid;
CLSIDFromProgID(L"Word.Application", &clsid);
HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER|CLSCTX_INPROC_SERVER, IID_IDispatch, (void **)&rVal.pdispVal);
rVal.vt = VT_DISPATCH;
VARIANT oWord = {0};
VariantCopy(&oWord, &rVal);
VariantClear(&rVal);
// Line 2: oWord . Visible = 1
rVal.vt = VT_I4;
rVal.lVal = 0;
VariantCopy(&root[++level], &oWord);
hr = AutoWrap(DISPATCH_PROPERTYPUT, NULL, root[level].pdispVal, L"Visible", 1, rVal);
VariantClear(&root[level--]);
VariantClear(&rVal);
// Line 3: oWord . Documents . Open C:\\Test.doc
VariantCopy(&root[++level], &oWord);
hr = AutoWrap(DISPATCH_PROPERTYGET|DISPATCH_METHOD, &root[level+1], root[level++].pdispVal, L"Documents", 0);
The purpose of the AutoWrap function in this sample is to wrap the calls for GetIDsOfNames and Invoke to facilitate automation with straight C++.
|
|
|
|
|
indra20 wrote: No, using C++ and COM.
OK, then you're in the wrong forum. Try the Visual C++ forum.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I have a C++ (Borland 5.02 - I know is old stuff...anyway) I have function where I can print reports. Now what I need to to modify this function to instead of printing to a printer I need to save that as MDI or PDF file, but I want to bypass the Save As dialog box because I have several hundreds of reports to print. How can I do that? Please help!!!
Flavio
|
|
|
|
|
Borland does not support .NET, therefore you're in the wrong forum. Even in hte right forum, I'm not sure how many people can offer Borland specific help.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
For managed C++ what is the difference between:
using
#using
using namespace
?
Thanks in advance
|
|
|
|
|
A quick look with the F1 key yields:
"The #using Directive...Imports metadata into a program compiled with /clr."
"The using directive allows the names in a namespace to be used without the namespace-name as
an explicit qualifier."
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hey All,
I've run into a problem where under Visual Studio 2005 if a crash occurs in my managed code, I simply get the MS .NET Framework dialog box. Of course it tells me to make sure the reg key is set, debugging info is turned on and that my config file sets <system.windows.forms jitdebugging="true">. I seem to be doing everything, yet I can't get the debugger to open.
Any ideas? Am I missing some other step, or does mixed code fail to invoke the debugger?
Thanks!
Ant
|
|
|
|
|
Hi,
I have some doubts in Virtual functions.
What is the use of Virtual Functions?
In which scenario, virtual functions will be useful ?
For what real time problems, virtual function is preferred?
Please clear my doubt.
Thanks,
Arun AC
|
|
|
|
|
It's all about polymorphism!
A Googly search on "C++ virtual functions" yields billions of articles on the subject (ok, maybe
not that many).
For example: Polymorphic and Virtual Functions in C++[^]
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
After designing my report using Dataset(payroll05DataSet) of my project, How can I fill my Dataset and set Datasource so i can see data on my report.
-- modified at 13:29 Friday 20th July, 2007
|
|
|
|
|
mikobi wrote: How can I fill my Dataset and set Datasource
Have you looked at the scores of .NET Database Articles here on CodeProject?
|
|
|
|
|
CAn you give me the link.
|
|
|
|
|
Hello Sir
I am very happy because for the first time I print in Visual c++ NET with report. This what I do:
SqlConnection^ cprl = gcnew SqlConnection();
cprl->ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;database=payroll05;server=sem;Trusted_Connection=Yes;" ;
cprl->Open();
Ds_report^ data = gcnew Ds_report();
SqlDataAdapter^ adapt = gcnew SqlDataAdapter();
SqlCommand^ Cmd = gcnew SqlCommand();
Cmd->CommandText = "select* from ficag21";
Cmd->CommandType = CommandType::Text;
Cmd->Connection = cprl;
adapt->SelectCommand::set(Cmd) ;
adapt->Fill(data,"ficag21");
rptsearchsig->SetDataSource(data);
rptsearchsig->Load("C:\\Documents and Settings\\miki\\Mes documents\\Visual Studio 2005\\Projects\\payroll\\payroll\\rp_signal.rpt");
rptsearchsig->PrintToPrinter(1,true,0,65500);
It's very simple but I take three days to do it.
I will send you my article to explain well for helping others that are in the same difficult.
Thanks to all halp me
|
|
|
|
|
Hi,
i would get my Mac adresse, Please help me to resolve this problem
Thank you verry mutch
|
|
|
|
|
Here's an example using WMI to get the MAC addresses for all the "Ethernet 802.3" adapters on
the system:
#using <System.Management.dll>
using namespace System::Management;
...
ManagementObjectSearcher searcher("SELECT Name,MACAddress FROM Win32_NetworkAdapter WHERE AdapterType = 'Ethernet 802.3'");
ManagementObjectCollection::ManagementObjectEnumerator^ enumerator = searcher.Get()->GetEnumerator();
while (enumerator->MoveNext())
{
Console::WriteLine(enumerator->Current["Name"]);
Console::WriteLine(" {0}", enumerator->Current["MACAddress"]);
}
Mark Salsbery
Microsoft MVP - Visual C++
"Remember the five Ds of dogeball: Dodge, Dip, Duck, Dive, and Dodge."
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Hi,
Thank you verry mutch for your answer, i work with C++ CLi and it doesn't know using namespace System::Management;
best regards
|
|
|
|
|
abbd wrote: it doesn't know using namespace System::Management;
What error are you getting?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Remember the five Ds of dogeball: Dodge, Dip, Duck, Dive, and Dodge."
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
which probably means you should "Add a reference" to System.Management.dll to your project
|
|
|
|
|
|
Which language are you coding in? This forum is for dot net cpp stuff. Whatever the case you'll probably need to provide some more info or post some small sections of your code. I've been doing some UDP stuff the last few months so I might be able to help
|
|
|
|
|
I would suggest that you post this in the Visual C++ forum and enclose the code inside
tags, or click the "Ignore HTML tags in this message" check box so that its easier to read
|
|
|
|
|
I'm not sure I'm understanding your problem, but do you have your recvfrom() call in a loop? If you don't, you'll just get one datagram and your thread function will continue to whatever's next.
|
|
|
|
|
I am using Visual c++ NET 2005
After creating report with Crystal report and create field on it(ADO.NET), how can I set DataSource programmatically on ReportDocument?
-- modified at 13:08 Thursday 19th July, 2007
|
|
|
|
|
How to programatically verify that an assembly has been installed in the global assembly cache??
|
|
|
|
|