|
Thanks again,
Apologies - but really struggling with this one
MessageBox::Show(dateTimePicker2->ToString());
MessageBox::Show(dateTimePicker2->ToString(), "MMMM dd, yyyy - dddd");
Both lines of code show same results -
System.Windows.Forms.DateTimePicker, Value: 22/01/2019 14:26:18
whereas I'd just like to see January 22, 2019 and in this case no time
|
|
|
|
|
Sorry, my mistake. You need to call ToString on the Value property like:
MessageBox::Show(dateTimePicker2->Value.ToString("MMMM dd, yyyy - dddd"));
|
|
|
|
|
Many , many thanks - your swift responses appreciated enormously
Works fine
|
|
|
|
|
Happy to help. I don't know what your background is, but if you are just starting out you might find C# a better choice than C++/CLI.
|
|
|
|
|
Many thanks.
Very mixed background
Wrote first programs in 60's (machine code, user code, Fortran, Algol & many more)
Moved into IT sales / management
Have developed Forex applications in MT4 which is sort of C based
Started with this C++ / CLi on Saturday - so sort of making progress
I've fought shy of 'understanding' the ins / outs of C
Now retired and need to keep brain cells stimulated !
Thanks for support & comments and will read around
|
|
|
|
|
Since you have only just started with C++/CLI, my advice would be to stop now and switch to C#. It is so much better for this sort of application, and the learning curve is not as bad as it may at first appear. There is a great free starter document at .NET Book Zero[^] which you can work through fairly quickly. Like you, I am retired and followed this route myself, so I am far from being a C# expert, but I can code simple applications without too much trouble.
|
|
|
|
|
hi guys love this site so helpful. i have a c++/cli program im writing. im not going to post no code at this time cause i hope my problem can be solved with just a explanation. in my main form i run some code that controls a pic chip that runs some servo motors, communicating through the serial port. all runs fine. the problem im having is that well you know serial port is on another thread. so i use invoke and run a data received method on the ui. now that has a switch statement that may call some other functions in my ui thread that all works fine until one of the functions actually needs some input from the serialport. but i dont get any data in until the invoke completes. i tryed to run it with begininvoke which seems to work fine for the serialport but the ui doesnt update the form at all during the invoktion. so i thought i would just try to have the datareceived funtion fire an event on the ui. but then i get a crossthread error. maybe im not doing the event correctlly im still trying to get my head around delegates and events. question? does this seem reasonable? what i need to do is get that serialport freed up so that it can receive data again while the ui runs its code. Please bear with me im learning. and i have been reading post after post about threads, delegates, and events. ive problebly seen the answer and didnt know it. ill be happy to read im just not sure of the correct implementation. and im writing this in c++/cli cause i copied some code from an old borland c++ program. thanks in advance. yes i could post some code but ill have to clean it up first and pick out important parts right now its quite sizable.
|
|
|
|
|
Unfortunately your manner to describe the problem, you need the assistance with, does not help to help you.
Or, maybe your keyboard failed to work properly (so neither Shift, nor Caps Lock, nor Enter key does work?)
|
|
|
|
|
My apologies:
Let me try this again. I'm wondering if there is a way to free my serial port thread after i invoke to my UI thread.
Once i Invoke from the Data Received event on the Serial port Thread to a receive function on the UI thread, my switch statement in the receive function may call a function that sends data to the pic program. Now the pic responds immediately but the data doesn't appear cause the invoke method hasn't quite exited yet. any suggestions would be Appreciated.
|
|
|
|
|
|
This is not the place for such messages.
|
|
|
|
|
What?? This is the Managed C++/CLI forum. This crash directly affects C++/CLI code. I'd think anyone that cares about successfully coding in C++/CLI will care about this. Thus, the post.
|
|
|
|
|
Hi
I am working on a C++ Project in which i am using some third party SDK to read some data. Some times few API's in that third party SDK are getting crashed such that my program getting terminated\crash.
So, instead of crash i want to handle those exceptions in the third party API's. May i know how to do handle them. I am using Visual studio 2015 and used exception handling too but unable to catch the exceptions thrown by third party API's.
Regards
Sampath
|
|
|
|
|
Contact the owners of the library for help. Unless you know exactly where the exceptions occur, and what they are caused by, you will find it very difficult to gather any meaningful information.
|
|
|
|
|
Thank You. As of now we are reporting the issues to the owners of the library and they are fixing and providing the fixes in their next release. But i cannot hold my work till their fix. Some how i need to proceed by excluding those exceptions in my code. Is it possible by any chance or any technique to skip those crashes and handling them in my code?
|
|
|
|
|
No idea, only the owners of the library can answer that question. And ignoring errors is probably the most dangerous thing you can do in any application.
|
|
|
|
|
You can add generic Catch block in your code for function which is calling that third party APIs and in catch you do nothing.But its just to avoid your application from getting crash, ideally you should not do it as it makes no sense.
~Sam
|
|
|
|
|
I am currently working on fixing a project for a client. A little information about the project first:
1. Originally developed in Visual Studio 2012 using xp_v110 build tools
2. Multiple projects in the solution
3. Currently updating/debugging in Visual Studio 2017 using VS 2015/xp_v140 build tools
4. Working on Windows 10
The application will run in debug mode, however if I just leave the application after starting the debug session (i.e. not opening/clicking on the application to open it as it starts minimized in the tray), the application crashes after 1-2 minutes.
Unfortunately the IDE is showing that the crash is taking place in chkstk.asm with the following message:
Exception thrown at 0x0064EDF9 in <<exe name="">>: 0xC00000FD: Stack overflow (parameters 0x00000000, 0x000A2000).
I have updated the exception settings to break when all C++ Exceptions are thrown, checked the box that says "Break when this exception type is thrown", and wrapped the initial method that runs in a try block, however I can never catch the error in the C++ code; it always occurs in the chkstk.asm file.
Any suggestions on how I can find out where in the C++ code the exception is occurring. Like I said, this is an update for a client and the original programmer is not available, and they never commented their code, so it is difficult enough trying to go through all this. Any help/suggestions would be greatly appreciated. Thanks in advance.
A black hole is where God tried to divide by zero.
There are 10 kinds of people in the world; those who understand binary and those who don't.
|
|
|
|
|
You need to get the stack trace at the time of the crash and walk back through it to find out who is using all the stack space.
|
|
|
|
|
You should make small memory dump using windows task manager. If you have application .pdb files and source files you can load windows dump file with Visual studio and debug it as managed code. If there are symbols debugging files (pdb) you can see thread`s stack in appropriate state.
|
|
|
|
|
I think this message was meant for the OP.
|
|
|
|
|
I suggest you launch the app in the debugger and then wait for ~20 seconds then break into the debugger. Most likely you'll see the a deep stack as it's in the midst of eating up stack space. That callstack should lead you to the issue.
|
|
|
|
|
please tell me what is going on in below code
if(curl)
{
curl_easy_setopt(curl,CURLOPT_URL,url.c_str());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&ret);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,WriteFunction);
CURLcode res = curl_easy_perform(curl);
if(res != CURLE_OK)
{
curl_easy_cleanup(curl);
return 0;
}
curl_easy_cleanup(curl);
if(ret.find("Ok"))
{
char* r=new char[ret.length()+1];
strcpy(r,ret.c_str());
char* p=strtok(r,"|");
p=strtok(NULL,"|");
return atoi(p);
}
}
return 1;
}
|
|
|
|
|
It appears to use some third party library (curl ?) to obtain text input, find the first token and convert its text to an integer, which it then returns to the caller. I would suggest getting the documentation for the library and studying that.
|
|
|
|
|