|
Awesome!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Awesome!
Nah, that was mildly amusing. This is awesome.[^]
led mike
|
|
|
|
|
Indeed!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am new to Visual C++/.Net, I have a simple question. I have a DateTimePicker object which I need to display future date in days (i.e. if you pick 11/21/2009, I will display 365 days).
I have managed to compute my 365 days and converted it to a char * but I am not able to assign the char* to the label Text i.e. Sysytem::String ^
Can anyone help me? Thanks in advance
|
|
|
|
|
If you have a number, just call ToString() to get a System::String^
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
niiAmoo wrote: I have managed to compute my 365 days and converted it to a char *
Why are you using char * in C++/CLI?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Sorry, That was what I was used to . I tried this code and it worked
TimeSpan expirationDay = expirationDateTimePicker->Value.Date - expirationDateTimePicker->Value.Now.Date;
expiration->Text = expirationDay.Days.ToString();
Thanks for your help
|
|
|
|
|
Mark Salsbery wrote: Why are you using char * in C++/CLI?
nostalgia
|
|
|
|
|
because he is a real programmer that doesnt like to be "managed"
|
|
|
|
|
the ascii code of char '1' and int (1) has 48 numbers defrence
it means if you wanna change the char '1' to int 1 you should minus 48 from the ascii code !
it really works, i`ve test it
|
|
|
|
|
Hi all.
Need some help please.
Does someone know how to display windows explorer window with specified path? Managed and unmanged variants is ok.
Thanks.
|
|
|
|
|
Process.Start or ShellExecute with the path, should do it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks very much. ShellExecute is ok.
|
|
|
|
|
Hi there,
I am having some problems to create a dll file to use in my java application. Let me try to explain the scenario:
1.- Java GUI which uses JNI to call native C functions.
2.- This C functions uses C++ classes inside.
And at this moment i don't have the faintest idea of how to build a correct idea, so i would appreciate any help.
Thanks in advance,
Hector.
|
|
|
|
|
i have solved the problem: these are the steps i have followed
1.- Create a java class with native methods. Create code to load the dll library.
Example:
import java.io.File;
/**
* @author hectorhg
*
*/
public class CLangWrapper {
/**
* Path of the .dll file
*/
public static final String dllName = "C:\\clangwrapper.dll";
// Code to Load the dll
static{
try{
File l_file = new File(".");
System.load(dllName);
}
catch (UnsatisfiedLinkError e) {
e.printStackTrace();
}
catch (Exception ex){
ex.printStackTrace();
}
}
/*********************************************
* N A T I V E M E T H O D S *
*********************************************/
/**
* Starts wrapper
* @return
*/
public static native int wrapperStart();
}
2.- javac myclass.java
3.- javah -jni package.myclass # in the ../ directory of package.
4.- A .h file is generated. implement it in a .c file.
5.- I have used vs2008, to create a dll project. In this project i included those files (don't forget about jni.h and jni_md.h) and my .cpp files.
6.- in the .c file implementing the native methods.
struct CPLUPLUSCLASS cppClass; // Global variable
#if defined(__GNUC__) && defined(_WIN32)
extern "C" JNIEXPORT jint JNICALL Java_sidsaTvAppControl_CLangWrapper_wrapperStart
(JNIEnv *, jobject){
#else
JNIEXPORT jint JNICALL Java_sidsaTvAppControl_CLangWrapper_wrapperStart
(JNIEnv *, jobject){
#endif
jint l_retVal = 0;
l_retVal = cppClass.myFunc();
return l_retVal;
}
7.- Note that the file that implements the .h file generated by jni must be included in the dll.
8.- compile and place the .dll into the rigth directory according to your java class implementation.
9.- run your java application.
10.- Check everything is working and smile
I hope that this can help someone
Regards,
Hector.
|
|
|
|
|
Hi,
I am working on a C++/CLI project using winforms. I need to consume a 3rd party native C++ dll.
Can any one send me some sample code to do the same.
Thanks,
Pratap
|
|
|
|
|
Here's a sample (with bad variable names):
[System::Runtime::InteropServices::DllImport("kernel32", EntryPoint="AA", ExactSpelling=false, CharSet=System::Runtime::InteropServices::CharSet::Ansi, SetLastError=true)]
static int A(System::String ^x, int ^y);
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
VB & C# to Java Converter
Java to VB & C# Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB, C#, or Java to C++/CLI
|
|
|
|
|
|
vikramaditya234 wrote: I am trying to port the code to UNIX in C language
See the name of the forum? The questions here are about C++/CLI Managed and Mixed Mode development for the .NET platform. Is that what you are doing?
led mike
|
|
|
|
|
What does this have to do with Managed C++?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hello all,(Sory about my English) Please help....
VC++ 2005.
I have a func that call to Socket,Bind, Listen & Receive.
I call this func from timer that see if the Client send data.
I get the data in the first call but in the second call I got errors.
I understand that I need to operate the Socket,Bind, Listen only once.
I got err when put this line in a global scope or as a member data in class declaration:
Socket^ listenerSocket = nullptr;
So, I tried to store it with the help of global pointer.
It is good till I call the funcs of the Socket type, after all it just pointer that set to some place in the memory.
Socket^ *GlistenerSocket = nullptr;
Socket^ *GserverSocket = nullptr;
int CMotoScopeDlg::DoSocketGet( String^ server )
{
Socket^ listenerSocket = nullptr;
listenerSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp );
if (false == SocketBindFlag )
{
listenerSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp );
GlistenerSocket = &listenerSocket ;
(*GlistenerSocket)->Bind(hostEndPoint ); //Only once
(*GlistenerSocket)->Listen( 4 );
SocketBindFlag = true;
}else{
listenerSocket = *GlistenerSocket; //check this. allocate place??
}
Socket^ serverSocket = (*GlistenerSocket)->Accept(); //ERROR at second time
...
I think that if I could put this Socket variable in the global place it will help.
Thanks in advance,
Eyal
|
|
|
|
|
cra034 wrote: I think that if I could put this Socket variable in the global place it will help.
Sure, maybe if you put everything in "global place" it will work. Where is that anyway, next to Park Place?
I think if you learn about Programming Logic and Design it will help.
Your not in VB Drag and Drop land anymore toto.
led mike
|
|
|
|
|
I'm working on a program that basically sits and acts as a system monitor. Two of the primary things that I want it to do are monitor system memory and display when the last time a virus scan was made. Any suggestions on how I might go about this?
Thanks in advance
|
|
|
|
|
|