|
|
You already posted this in the C/C++ forum: please do not repost.
|
|
|
|
|
I have a program that works fine on most machines. Every now and then I find a
computer and the edit boxes are shifted to the right. I have an image of the
shifting here
http://ruthtechnology.com/temp/Untitled2.jpg[^]
In the past, I use to be able to go to display settings and change it from 125% to 100% and reboot and the boxes would line up nicely with the form. But its on a 100% and I dont know why its not lining up.
Any comments or suggestions are greatly appreciated.
|
|
|
|
|
In my C++ application, I have added CLR support((/clr) to use WCF communication.
Everything is working well, but i observed handle leak. When I analyze this with WinDbg(!htrace). Its shows handle leaks in .NET libs as shown below.
Handle = 0x0000000000003300 - OPEN
Thread ID = 0x0000000000004dbc, Process ID = 0x000000000000414c
0x000000007785a30a: ntdll!ZwCreateThreadEx+0x000000000000000a
0x000007fefd37ac73: KERNELBASE!CreateRemoteThreadEx+0x0000000000000163
0x00000000776e57a6: KERNEL32!CreateThread+0x0000000000000036
0x000007fedaf3f0aa: clr!ClrCreateManagedInstance+0x000000000001ae0a
0x000007fedaf3efb8: clr!ClrCreateManagedInstance+0x000000000001ad18
0x000007fedaf3f5e3: clr!ClrCreateManagedInstance+0x000000000001b343
0x000007fedaf3f623: clr!ClrCreateManagedInstance+0x000000000001b383
0x000007fedaeb3b5e: clr!PreBindAssemblyEx+0x0000000000007e5e
0x000007fedae0a05f: clr!LogHelp_LogAssert+0x000000000000525f
0x000007fedae0837c: clr!LogHelp_LogAssert+0x000000000000357c
0x000007fedae08125: clr!LogHelp_LogAssert+0x0000000000003325
--------------------------------------
Handle = 0x00000000000032fc - OPEN
Thread ID = 0x0000000000004dbc, Process ID = 0x000000000000414c
0x0000000077859d0a: ntdll!ZwCreateEvent+0x000000000000000a
0x000007fefd372d15: KERNELBASE!CreateEventExW+0x0000000000000065
0x000007fedaf3db8a: clr!ClrCreateManagedInstance+0x00000000000198ea
0x000007fedaf3dd27: clr!ClrCreateManagedInstance+0x0000000000019a87
0x000007fedaf3f077: clr!ClrCreateManagedInstance+0x000000000001add7
0x000007fedaf3efb8: clr!ClrCreateManagedInstance+0x000000000001ad18
0x000007fedaf3f5e3: clr!ClrCreateManagedInstance+0x000000000001b343
0x000007fedaf3f623: clr!ClrCreateManagedInstance+0x000000000001b383
0x000007fedaeb3b5e: clr!PreBindAssemblyEx+0x0000000000007e5e
0x000007fedae0a05f: clr!LogHelp_LogAssert+0x000000000000525f
0x000007fedae0837c: clr!LogHelp_LogAssert+0x000000000000357c
0x000007fedae08125: clr!LogHelp_LogAssert+0x0000000000003325
0x000007fedaeb5abf: clr!PreBindAssemblyEx+0x0000000000009dbf
0x00000000776e571d: KERNEL32!BaseThreadInitThunk+0x000000000000000d
--------------------------------------
Handle = 0x00000000000032f8 - OPEN
Thread ID = 0x0000000000004dbc, Process ID = 0x000000000000414c
0x0000000077859d0a: ntdll!ZwCreateEvent+0x000000000000000az
0x000007fefd372d15: KERNELBASE!CreateEventExW+0x0000000000000065
0x000007fedaf3db8a: clr!ClrCreateManagedInstance+0x00000000000198ea
0x000007fedaf3dd19: clr!ClrCreateManagedInstance+0x0000000000019a79
0x000007fedaf3f077: clr!ClrCreateManagedInstance+0x000000000001add7
0x000007fedaf3efb8: clr!ClrCreateManagedInstance+0x000000000001ad18
0x000007fedaf3f5e3: clr!ClrCreateManagedInstance+0x000000000001b343
0x000007fedaf3f623: clr!ClrCreateManagedInstance+0x000000000001b383
0x000007fedaeb3b5e: clr!PreBindAssemblyEx+0x0000000000007e5e
0x000007fedae0a05f: clr!LogHelp_LogAssert+0x000000000000525f
0x000007fedae0837c: clr!LogHelp_LogAssert+0x000000000000357c
0x000007fedae08125: clr!LogHelp_LogAssert+0x0000000000003325
0x000007fedaeb5abf: clr!PreBindAssemblyEx+0x0000000000009dbf
0x00000000776e571d: KERNEL32!BaseThreadInitThunk+0x000000000000000d
Am using VS 2015 and .Net version is 4.5.2.
Is this an issue in .NET? Any help and or suggestions you may have would be greatly appreciated, Thanks
Arun Menon
|
|
|
|
|
Hello All.
I'm trying to create a function that can loop through a list of Windows::Forms::Controls (I know there's no loop below, I'm just keeping it simple for sake of testing) and perform a task. Right now I have a function which works properly:
void mCtrlWrap::IsVisible(bool TF, List<Windows::Forms::TextBox^>^ list)
{
if (TF == true)
{
list[0]->Visible = true;
list[0]->BackColor = Color::Azure;
}
else if (TF != true)
{
list[0]->Visible = false;
}
}
but i want to make the List parameter a template so that it take List<windows::forms::combobox^>^ as a parameter or List<windows::forms::label^>^, etc.
I've tried
template<typename T>
void mCtrlWrap::IsVisible(bool TF, System::Collections::Generic::List<T>^ list)
{
if (TF == true)
{
list[0]->Visible = true;
list[0]->BackColor = Color::Azure;
}
else if (TF != true)
{
list[0]->Visible = false;
}
}
which compiles just fine but i get linking errors:
1>MainScreen.obj : error LNK2020: unresolved token (06000001) mCtrlWrap::IsVisible<system::windows::forms::textbox ^="">
can someone please help me figure out what I'm doing wrong?
Thanks
Brennan
|
|
|
|
|
In C# you would handle this by casting each component to a Control object. I assume you can do the same in C++/CLI.
Also, why do you need the else if clause above? TF can only be true or false , if it is not true then you only need a simple else clause for the second block, thus:
if (TF == true) {
}
else
{
}
|
|
|
|
|
You are mixing C++ template and .NET generics. This is OK is you understand what are you doing.
In your specific case, this is classic C++ template problem. To call templated function C++ compiler must see the function implementation, and not only prototype. So, you can instantiate IsVisible function only in the same .cpp file. Or make it inline by moving the function implementation to .h file.
|
|
|
|
|
I used following link:-
ILocation::GetReportStatus | Microsoft Docs[^][^]
Got code for Geolocation:-
at line :-
CoCreateInstance(CLSID_Location, NULL, CLSCTX_INPROC, IID_PPV_ARGS(&pLocation));
I am getting handle = S_OK & showing message "Type information not available in locationApi.dll symbols."
Please help if any idea.
Thanks in advance.
|
|
|
|
|
Where are you getting that message?
|
|
|
|
|
In visual studio 2008, while debugging from my desktop & laptop both.
|
|
|
|
|
That is probably just a debug message. Does your application continue running?
|
|
|
|
|
No, It was not running.
I even checked in VS 2015.
When it fails, it is not able to get lat., long., etc.Nothing is coming.
|
|
|
|
|
It is impossible to guess what is happening. You will need to use your debugger to gather more information.
|
|
|
|
|
Ok let me gather more information in detail, then i will get back to you.
For now thank you for helping me.
Have a nice day.
|
|
|
|
|
[Marking as NEWS - this is not a question but this is an appropriate forum IMO]
If you develop in C++/CLI with Visual Studio 2017, beware that update 15.9.6 introduced a very bad codegen bug. C++/CLI apps will crash if you use /std:c++17 or /std:c++latest. The workaround is to drop back to C++14 language support.
Here's the issue if you care to vote.
Again, this is FYI as it has cost me multiple days of work diagnosing why our application suddenly stopped working.
John
|
|
|
|
|
Hi,
I am working on some examples of my own and now looking to include a new class for my Banking transactions.
Seems like I am doing something in the wrong place etc.
I typed in the new code ahead of the standard code created by Visual Studio (17) (I didn't add an item). The information I wanted to create appears in the right hand window CLASS VIEW but I get the errors.
using System.Windows.Forms;
public class transactiondata
{
public DateTime transDT;
public string transtext;
public double transRECD;
public double transPAID;
public string transFlag;
}
public transactiondata(DateTime transDT, string transtext, double transRECD, double transPAID, string transFlag)
{
this.transDT = transDT;
this.transtext = transtext;
this.transRECD = transRECD;
this.transPAID = transPAID;
this.transFlag = transFlag;
return;
}
namespace Santander01
{
public partial class Form1 : Form
{
public Form1()
CLASS VIEW
shows the class and items above
THE ERROR
1>------ Build started: Project: Santander01, Configuration: Debug Any CPU ------
1>C:\Users\HOME\Documents\Visual Studio 2017\Projects\Santander01\Santander01\Form1.cs(19,8,19,23): error CS0116: A namespace cannot directly contain members such as fields or methods
1>C:\Users\HOME\Documents\Visual Studio 2017\Projects\Santander01\Santander01\For
Any help appreciated
|
|
|
|
|
You have terminated the class definition too early; the constructor is not inside it. Move the closing brace from where it is now, to the line following the end of the constructor block.
|
|
|
|
|
C# questions should be posted in the C# forum[^].
You've posted this in the "Managed C++/CLI" forum, which is nothing to do with C#.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Maybe he though that in the CodeProject numbering system, C++/CLI = C# .
|
|
|
|
|
I am trying to build some simple examples as part of my learning process.
I have created a form which includes the dateTimePicker and tried several combinations which have failed. The output initially displays time as HH:MM:00 and only dis[plays correct time when I include
...AddHours(0)...
I'd like to format - say
"MMMM dd, yyyy - dddd"
My standard output is
20/02/2019 00:00:00
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
String ^myText = "1&2-END";
dateTimePicker2->CustomFormat = "MMMM dd, yyyy - dddd";
dateTimePicker2->Value = DateTime::Now.AddDays(+30).Date;
myText = myText + "\r\n" + dateTimePicker2->Value;
dateTimePicker2->Value = DateTime::Now.AddDays(+30).AddHours(0);
myText = myText + "\r\n" + dateTimePicker2->Value;
myText= myText + "\r\n" + "& 3 -END";
myTB2->Text = myText;
}
I am using Visual Studio 2017, C++/CLi, W10 Professional
Guess I am missing some declaration - I have in .cpp
#include "MyFirstForm.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace System;
using namespace System::Windows::Forms;
using namespace System::IO;
[STAThreadAttribute]
Any help appreciated.
Looks like great way to develop FORM & C++ based programs
|
|
|
|
|
|
Hi & many thanks for your response....however
I added the following:-
dateTimePicker2->Value = DateTime::Now.AddDays(1);
MessageBox::Show(dateTimePicker2.ToString());
myTB2->Text = myText;
and failed to complie with the following error - is this what you meant.
When I follow your link it refers to C# whereas I am working with C##.
Severity Code Description Project File Line Suppression State
Error C2228 left of '.ToString' must have class/struct/union Project1 c:\users\home\documents\visual studio 2017\projects\project1\project1\myfirstform.h 335
Error (active) E0153 expression must have class type Project1 C:\Users\HOME\Documents\Visual Studio 2017\Projects\Project1\Project1\MyFirstForm.h 336
|
|
|
|
|
dateTimePicker2->Value = DateTime::Now.AddDays(1);
MessageBox::Show(dateTimePicker2.ToString());
|
|
|
|
|
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"));
|
|
|
|