|
|
Thanks a lot, few more questions, and I would appreciate if you can help:
- if I add more variables other than x1 and x2 but I maintain same style in accessing and initializing them will it affect thread safety? will it affect performance? (probably). Do you know more performance friendly way to solve the problem my class solves?
|
|
|
|
|
1. if you add more variables in the same manner, yes
2. will it affect performance? don't worry about that, performance will be the same. And on the init()/deinit() - the "decrease" won't be noticeable.
3. Your class is fine
Best,
John
|
|
|
|
|
Thanks a lot!!!
So you are saying if I add more properties in same manner, it won't be problem?
|
|
|
|
|
Yup, that's exactly what I'm saying
Best,
John
|
|
|
|
|
|
you're welcome
Best,
John
|
|
|
|
|
Great job supporting this OP, John. I am voting your replies up. cheers, Bill
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
Thanks
|
|
|
|
|
I am voting your replies up.
me too
|
|
|
|
|
granted anyone using Parameters class WILL first check if it was inited or not using getter
|
|
|
|
|
does requirement to have public deinit make harder to make this class thread safe?
|
|
|
|
|
Hi,
I am having a Windows Ui for placing some text in Unighraphics-
So the problem is when i place a text i get "work in process" dialog(which is of Unigraphics), I want to close this but it doesnt,when i close the windows UI this dialog vanishes.
I want Windows ui but i dont want "work in process" dialog.
when i check task manager, i can see two applications , but both say same process in task manager ugraf.exe.
Please help I am using c#
|
|
|
|
|
|
Please do not post the same message in two forums.
If you have spent thousands of US $ to purchase Unigraphics NX from Siemens, you are certainly entitled to tech support from them.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
You're not going to get an answer to this question because you haven't conveyed any context information what-so-ever. We have no idea what you're doing, how you're doing it, what the code looks like and you haven't even provided a problem description that makes any sense.
Seriously, if you can't describe the problem you're trying to solve to us in sufficient detail, you have no hope of describing the solution to a computer.
|
|
|
|
|
I have C++ code which has calls like this
1) SystemTimeToFileTime(&st, &m_Time)
Before above call st is assembled by assigning values to its members manually - but only year, month, day, hour, minutes and seconds are assigned to it.
m_Time is instance variable of type FILETIME.
Afterwards there is a function like that:
2) dppDatetime_t RsDateTime::GetAsPrepaidTime() const
{
dppDatetime_t dt;
SYSTEMTIME st = GetLocalTimeAsSystem();
dt.Year = st.wYear;
dt.Month = st.wMonth;
dt.Day = st.wDay;
dt.Hour = st.wHour;
dt.Minute = st.wMinute;
dt.Second = st.wSecond;
return dt;
}
GetLocalTimeAsSystem defined as:
3) SYSTEMTIME RsDateTime::GetLocalTimeAsSystem() const
{
SYSTEMTIME st;
::FileTimeToSystemTime(&m_Time, &st);
return st;
}
I basically need to replicate all this functionality I mentioned in above 1), 2), 3) points in C#. I would really appreciate some help on how to go with this? How to achieve same result in C#?
Can't I implement what is done above using only DateTime structure in C#?
modified 30-Oct-15 4:46am.
|
|
|
|
|
I really don't understand what you want. C++ has a lot of ugly structures for dealing with time, and in c# you don't have to care - you have the very-easy-to-use DateTime class.
For getting the current time, just use
DateTime.Now
DateTime.UtcNow
Best,
John
|
|
|
|
|
I want to achieve steps 1 and 2 as in the question
|
|
|
|
|
they make no sense in c#
Best,
John
|
|
|
|
|
This is essentially the same question as the one below. If you need to use one of the Win32 calls and returned structures then you need to use PInvoke. I gave you the links already.
|
|
|
|
|
If you look at my question carefully you can see I think I don't need PInvoke and I can achieve all with DateTime. That is why I asked
|
|
|
|
|
Achieve what? Your question is not clear.
|
|
|
|
|
I want to achieve in C#, same what this code achieves in C++. Is this possible? How? Preferable would be without using PInvoke
void CVersion::GetVersion(DWORD *v1, DWORD *v2, DWORD *v3, DWORD *Build) const
{
char Path[1024] ;
DWORD Len1, Len2 ;
VS_FIXEDFILEINFO *FileVerInf ;
if(GetModuleFileName(m_hModule, Path, 1024))
{
if((Len1 = GetFileVersionInfoSize(Path, &Len2)) != 0)
{
BYTE *InfoBlob = NULL ;
try
{
LPSTR lpstrVffInfo ;
UINT uVersionLen ;
InfoBlob = new BYTE[Len1+255] ;
if(!InfoBlob) throw -1 ;
lpstrVffInfo = (LPSTR)InfoBlob ;
GetFileVersionInfo(Path, Len2, Len1, lpstrVffInfo) ;
BOOL bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
(LPSTR)"\\",
(LPVOID *)&FileVerInf,
(UINT *)&uVersionLen);
if(!bRetCode)
{
FileVerInf->dwFileVersionLS = 0 ;
FileVerInf->dwFileVersionMS = 0 ;
}
if(v1 != NULL) *v1 = (FileVerInf->dwFileVersionMS&0xffff0000)>>16 ;
if(v2 != NULL) *v2 = FileVerInf->dwFileVersionMS&0x0000ffff ;
if(v3 != NULL) *v3 = (FileVerInf->dwFileVersionLS&0xffff0000)>>16 ;
if(Build != NULL) *Build = FileVerInf->dwFileVersionLS&0x0000ffff ;
} catch (...) {;}
if(InfoBlob != NULL) delete[] InfoBlob ;
}
}
}
If it is not possible without Pinvoke, can you show me some sample how to do this with PInvoke?
|
|
|
|
|
If you do not want to use PInvoke directly you could use a C++ DLL to return the information in a suitable format. See also P/Invoke tutorial[^].
|
|
|
|