|
hi again,
i want to transfer my code from console to form application.
for console:
void main(int argc, char *argv[])
{
//variables here...
}
for form:
btnConnect_Click(System::Object^ sender, System::EventArgs^ e)
{
}
//how to put in the code of argc and argv[]
******************************
to know
everything
is to know
yourself...
|
|
|
|
|
The arguments are passed in to your main method, if they are passed in at all. I thought they were, they sure are long gone by the time you get to a button event.
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 all,
I have read the article on MSDN about Redistributing Visual C++ Files, but was left wondering whether there isn't another way of compiling ones application (fiddling in the project properties or something) so that it can run on another computer (without having to run any of the Microsoft Visual C++ 2005 Redistributable Packages) ??
Many Thanks
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Sure, try Googling: Fiddle with Project Properties
Seriously though, you can't avoid installing the C Runtime library but most of the others (MFC, ATL, etc.) can be statically linked by "fiddling".
|
|
|
|
|
You can link statically to the dlls, which makes your app bigger, as it will copy them into your exe.
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 everyone,
i have a problem, i want to convert string to character array. heres is the scenario:
char *echostring;
char ip[RCVBUFSIZE]; //32
ip =txtIpAdd->Text; //textbox
echostring = ip //<--- cause an error,it says, cannot
convert string to char[32]
thanks in advance,
jeof
******************************
to know
everything
is to know
yourself...
|
|
|
|
|
This normally works for me
char* echostring = (char*)Marshal::StringToHGlobalAnsi(ip).ToPointer();
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
you would have to point to ip[0] or &ip
echostring = ip[0];// << this will make it be the address of the first position[0] of the string same as &ip.
by the way this is for C++.
|
|
|
|
|
echostring = ip;
is fine.
The error is here:
ip = txtIpAdd->Text; //textbox
You can't do that
As programm3r mentioned, something like this should work:
char *echostring;
char ip[RCVBUFSIZE]; //32
const char *chars = (const char *)(void *)Marshal::StringToHGlobalAnsi(txtIpAdd->Text);
strncpy(ip, chars, RCVBUFSIZE);
Marshal::FreeHGlobal(System::IntPtr((void*)chars));
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello,
I converted VS2003 code to VS2005 (C++, C#).
I try to use DLLs which use: System::Runtime::InteropServices.
Do you know if it is OK? I got runtime error...
Thanks!
|
|
|
|
|
Tal S. wrote: Do you know if it is OK? I got runtime error...
You're not giving us much to work with
I'm going to guess it's not ok, since you get a runtime error.
Does debugging yield any clues?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello, I work with visual studio 2005, VC++ Managed, I want to carry out a reading of a document .TXT, and to post it in a list view or other, I want by exemle to post that the 10 line 1st. Thank you enormously.
|
|
|
|
|
Have a look at StreamReader class
|
|
|
|
|
Where is the StreamReader class,
Thank you verry mutch.
|
|
|
|
|
In the System.IO namespace
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
Firstly, this is incorrect forum. You should have posted this here: http://www.codeproject.com/script/comments/forums.asp?forumid=1647
Secondly, here is answer to your question:
GetProcAddress()[^]
|
|
|
|
|
hi friend i want souece code of polynomial program (add,multipy,..two polynomial) and also need the source code of aoe network in graphs and source code of winner tree program please help me as soon as possible.
Sincerely yours
|
|
|
|
|
My contract rate is > $100 an hour. Alternatively, you can do your own homework, and then I'll help for free, when you ask specific questions that show you've done somethig yourself.
I suspect you meant to post this in 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 am using sendASPI32Command for writing data to CD. But for a particular size of data sendASPI32Command returns SS_ASPI_IS_BUSY error. The error occurs when writes the last track data.
Could u pls tell in which condition this case occurs.Please help..........
Ajay
AJay
|
|
|
|
|
Have you tried MSDN ? This doesn't look like a C++/CLI question to me, have you tried the visual C++ forum ?
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 have a window handle (HWND) obtained from a DLL (the lib creates its own dialog form and returns handle to it - /library is written using MFC - code is as follows/).
What I need to do is to 'dock' this window somehow in a TabControl of an application written in Managed C++, VS 2005 (preferrably as a new Tab).
So basically I need sth like conversion from HWND to a usable object in .NET (Control^ or TabPage^ perhaps?). What I tried to do, is use of System::Windows::Forms::Control::FromHandle() function with my Handle casted to IntPtr, but it didn't work (my guesses: it only handles controls already created using .NET, not 'simple' WinAPI windows). It's also possible, that I've missed something obvious - I'm a complete newbie to all this .NET stuff.
My 'main' application used to also be written using MFC, so I could convert this handle back to CWnd* (using FromHandle() )and act on it as on a 'normal' MFC window (in eg.: call ShowWindow(SW_SHOW) or SetParent() for it).
How to do such a thing in .NET (meaning: to get a window from HWND, place it as a child of a Windows::Forms container (like TabControl or sth else), move/resize it to client's dimensions, and then show it to the user)?
A sketch of code that creates the window:
HWND LoadDialog() {<br />
CMyDialog* pNewDialog = new CMyDialog(); <br />
<br />
pNewDialog->Create (MAKEINTRESOURCE(IDD_RESOURCE), NULL))<br />
<br />
return pNewDialog->GetSafeHwnd();<br />
}
PS. I've posted a copy of this post to codeguru
|
|
|
|
|
matmus wrote: PS. I've posted a copy of this post to codeguru
If you get a solution, please post it here I'm curious about this one.
I do know Control::FromHandle() returns the Control already associated with an HWND, not a
Control created from an HWND.
I have always wondered if you could create a control from an HWND though. At first thought,
there's alot of reasons it wouldn't work well, especially with an MFC HWND...
Thanks,
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: At first thought,
there's alot of reasons it wouldn't work well, especially with an MFC HWND...
To be honest... now I'm having these thoughts (I still hope that it's possible though, my faith is just a bit weaker - WinApi is not assembly language after all, and what I need is not a 'full object' (meaning ::Form) - I was thinking of it rather as some kind of a wrapper, to call functions on (thought it'll be easier to use embedded .NET/Managed C++ functions than go down to API level).
BTW: why do you think, that MFC HWND is somehow special? In my opinion windows after creation are indistinguishable. Till now I was convinced that (in MFC) i can call FromHandle() on every window (even windows, which I don't own) - now I'm not so sure of that.
Since I've got no answer so far, I've slightly changed my approach.
Basically the question still is:
How to place this window (having only its HWND) as a new tab page in TabControl created via Managed C++ /I get the window by HWND and have to handle/display it somehow in my application. Creation/destruction ow this window is performed by the plugin itself/
But... I no longer care if I need to convert HWND to System::Control or do the exact opposite: convert TabPage to HWND and use API functions to bind them). I just need to get it done.. somehow (if it involves mixing managed and unmanaged code - so be it however I still hope that this is avoidable ). I've considered even converting .NET object to MFC, still I don't even know if it's possible, not to mention the 'howto' part.
Could someone point me at a usable piece of code?
Thanks in advance,
|
|
|
|