|
What are the errors?
I don't see a ListView.ListViewItemCollection.Add overload that takes a "cli::array^" as an
argument.
Also managed object references don't work like C++ pointers so this won't work:
cli::array^ tabChaine = {"Element 1", "Element 2"}
Have you seen the example code here[^]?
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Mark Salsbery wrote: Also managed object references don't work like C++ pointers so this won't work:
cli::array^ tabChaine = {"Element 1", "Element 2"}
However, the below code works but not in the context our friend was using it in.
array<String^>^ items = {L"Hello", L", ", L"world!\n"};<br />
<br />
for each (String^ item in items)<br />
{<br />
Console::Write(item);<br />
}
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
wow. I need to move to VS 2005
Thanks!
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Hey guys, it has been a while /cry. I seem to be having some issues with comparing values in a file, such as finding the highest value in a file in mixed order and outputting to a file in correct order. I have a file created with the following text 4,3,1,2, my object is to find the highest value then output to a file in correct orsder to 1,2,3,4. This is all I have and I am a little rusty cause it has been a while:
// iofilecomp.cpp : Defines the entry point for the console application.
// iofilecomp.cpp : Explains how to copy the contents from one file to another.
//
#include "stdafx.h"
#include <conio.h>
#include <string>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ifstream ins; //reads from file
ofstream ous; //writes to file
ins.open("in.dat");
ous.open("ou.dat");
string line;
if( ins.is_open )
{
while ( ! ins.eof() )
{
getline(ins, line);
cout << line << endl;
}
ins.close();
}
else cout << "Unable to open file.";
ous.close();
_getch();
return 0;
}
The above will only output in the order read from the file. Possibly could I get some assistance or pointed in the right direction please. Thank you.
|
|
|
|
|
Probably, you can ask this in right forum. VC++[^] in this case.
|
|
|
|
|
Sorry I am unfamiliar with the sort/vector function i was hoping something a little more basic something like using the if do func, I just need to get either the lowest value first or the highest value first then start comparing. How would I go about find the highest/lowest value in a file.
|
|
|
|
|
I guess you didn't understand prasad_som! This is the wrong forum to ask a Native C++ question. You need to go to the Visual C++/MFC forum to ask your question. This is the (MANAGED) C++/CLI forum.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I would create an executable who can run in any computer, I work with WinForms
Thank you very mutch
|
|
|
|
|
You would like to create a managed C++/CLI executable using Windows Forms that can run on any computer?
No, you cannot create such an executable.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I use Windows Forms Application and i would execute an another application like a Word file, i try ShellExecute; But there are errors, i write :
ShellExecute(0,'OPEN','C:\Documents and Settings\abbd\Bureau\App2.0\Ids 0.0\Ids 0.0\az.doc',Nil,Nil, SW_SHOW);
error C2015: too many characters in constant
error C2065: 'Nil' : undeclared identifier
error C2065: 'SW_SHOW' : undeclared identifier
error C3861: 'ShellExecute': identifier not found
Please help to execute this file, thank you.
|
|
|
|
|
Since you are using .NET, you should use Process::Start
|
|
|
|
|
abbd wrote: error C3861: 'ShellExecute': identifier not found
That error indicates you don't know how to #include header files for C++ development. The fact that you don't know that indicates that you need to step back to student mode and learn some prerequisite programming topics before you try to write working windows applications.
led mike
|
|
|
|
|
first of all the type of formas application you need is.... CLR Windows Forms Aplication
create a process outside the namespace.. and use these headers..
#include string
#include windows.h
#include process.h
using namespace std;
unsigned __stdcall execplz(void *params);
string cl;
somewhere in your program you need to place the following line to execute the command;
<br />
unsigned sID; (HANDLE)_beginthreadex( NULL, 0, execplz, NULL, 0, &sID);<br />
and keep in mind the command line string is std::string cl;
which i have set as global string at top so you can use anywhere..
the process below will create a process invisibly to yours ok.. so
to change that you need to remove... si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
<br />
unsigned __stdcall execplz(void *params){<br />
string fnn;<br />
int nLen = cl.length();<br />
bl=cl; std::string::size_type idx; idx=bl.rfind("\\");<br />
bl=bl.substr(idx, string::npos);<br />
cl=cl.substr(0, idx-1);<br />
int nLeng = bl.length();<br />
<br />
LPWSTR szCmdLine = new WCHAR[nLen+1];<br />
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,cl.c_str(),nLen,szCmdLine,nLen);<br />
szCmdLine[nLen] = '\0';<br />
<br />
LPWSTR fnonly = new WCHAR[nLeng+1];<br />
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,bl.c_str(),nLeng,fnonly,nLeng);<br />
fnonly[nLeng]='\0';<br />
<br />
STARTUPINFO si;<br />
PROCESS_INFORMATION pi;<br />
GetStartupInfo(&si);<br />
si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;<br />
si.wShowWindow = SW_HIDE;<br />
ZeroMemory( &si, sizeof(si) );<br />
si.cb = sizeof(si);<br />
ZeroMemory( &pi, sizeof(pi) );<br />
<br />
if( !CreateProcess( szCmdLine, fnonly, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) ) { printf( "CreateProcess failed (%d).\n", GetLastError() ); }<br />
return 0;<br />
}<br />
ok so the reason why i have this a separate process.. is because its using threads..
you can use this at anytime even when soemthing else is going on..multiple times at once
if wished.. good for creating webservers and such...
-- modified at 5:26 Saturday 10th March, 2007
|
|
|
|
|
I trvail with Windows Forms application, when I click on Form1.h in Solution Explorer an error arrive:
Requested registry access is not allowed. <br />
Hide <br />
<br />
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)<br />
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)<br />
at System.Diagnostics.EventLog.GetEventLogRegKey(String machine, Boolean writable)<br />
at System.Diagnostics.EventLog.Exists(String logName, String machineName)<br />
at System.Diagnostics.EventLog.OpenForRead(String currentMachineName)<br />
at System.Diagnostics.EventLog.get_EntryCount()<br />
at System.Diagnostics.EventLog.StartListening(String currentMachineName, String currentLogName)<br />
at System.Diagnostics.EventLog.EndInit()
Knowing that i introduced in Begining:
using namespace System::Diagnostics;<br />
using namespace System::Threading;
But before this work, and Form1.h opens normally, when I click on Form1.h the interface of my project which cames but there are error.
Thank you
|
|
|
|
|
Looks like you are running as a low-privileged user. Try running as administrator (or a non-admin higher-privileged user).
|
|
|
|
|
Where i can fin this? in Proprities?
Thank you very mutch.
|
|
|
|
|
abbd wrote: Where i can fin this? in Proprities?
I am talking about the Windows logon user here. You'd have to change user permissions from the control panel. The exact applet to do that would depend on your OS.
|
|
|
|
|
The privilege was administrator,
Help me to get solution for this great problem
|
|
|
|
|
But this same application work in my cmputer,and Form1.h opens normally.when i open this application on another cputer and when I click on Form1.h the an error came.please help me,thank you very mutch.
|
|
|
|
|
hi friends please reduce me good refrence for beginer in c++ and i want that i can download it from internet
|
|
|
|
|
Since this is the the C++/CLI forum and not the Visual C++ forum, I will suggest the following book on Managed C++:
C++/CLI, The Visual C++ Language for .NET by Gorden Hogenson, Apress, ISBN-13: 978-1-59059-705-7 and ISBN-10: 1-59059-705-2
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Why is it that I answered you, and you ignored my answer and just asked again ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 friends, please help me i want to start to programing in c++ i want to know how i learn to programming in c++
|
|
|
|
|
Like the message said, this forum is for C++/CLI and mixed mode programming only. So, the first step is to learn to read and follow directions.
The next step is to buy a good beginner book and work through it. VC++ 2005 Express Edition is free to download, so no problem there. Once you work through a good book, you will know enough to take on some simple projects and ask questions as you continue to learn from there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
I want to open a word document with Windows Forms applications, from a boutton; when i click on this boutton a document text which is going to execute, thank you.
|
|
|
|