|
Again, use the System Convert functions. You do not need to know Excel's representation, but it is fairly easy to figure out with google or changing the format of dates in excel and looking at the numbers.
|
|
|
|
|
I my side I do not know what functions to use TO CHANGE DATE TO characters, the cell format do not change something in Excel. Can you show me how to do it please
|
|
|
|
|
|
Hi there,
I have an application that has a function that receives the state change of some sockets and it is supposed to send the state change to another class of the application and notifies the state change like:
if ((param1 == 0)&& (Param2 ==0)) // if socket 0 is down
{
Sockinfo[3] = ((Sockinfo[3] & 0xFE )& 0xFF );
}
else if ((param1 == 0)&& (Param2 ==1)) // if socket 0 is up
{
Sockinfo[3] = ((Sockinfo[3] | 0x01 )& 0xFF );
}
//here I make an special message to send to another class of the application
but as sometimes the socket state changes very fast like it goes down and up in 1-2 sec, I don't want to make the notify message and send it up. I want to wait 10-15 sec and see if the state changed back again for that socket.
So if the socket goes down and stays down for 10 sec, I send the message out, if it went down but in less than 10 sec came back up, I don't send the message out.
is there any easy way to do that?
I appreciate any help
Best regards,
Chan
|
|
|
|
|
Hi,
You have to construct a simple mechanism, I suggest you add a timer and implement these two rules:
1. when the state changes, check the timer; if it is running, stop it. If the new state requires delayed action, start or restart the timer with a period equal to the wait period you want.
2. when the timer fires, check the state and if it still is what it was, launch the delayed action.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I want to design a UI like Adobe After Effects's TimeLine Panel as below bitmap:
The TimeLIne bitmap:http://pixinfo.com/img/sz/Adobe_After_Effects_6.5/AfterEffects6.5_02_od.jpg
The TimeLine Panel has two parts.
Left part seems to be ListView with Icon and Text,but it has hierarchy like TreeView.
Right part has a TrackBar-like time bar and a list shows the animation range(click the item of list to drag-drop the curve of translation,scaling,rotation).
How magicial the TimeLine is!! Does somebody havw any idea about the TimeList design? Or How to design the same control like the TimeLine?
|
|
|
|
|
akira32 wrote: Or How to design the same control like the TimeLine?
That control looks so complicated. You need to split that control into several small controls like slider, the point etc. Build each one separately and combine to get the whole control. In many places you may need to draw the control yourself.
Best wishes,
Navaneeth
|
|
|
|
|
I use Application::Idle to calculate FPS, but it seems to be unsuitable. Becuase the Application::Idle does not like the CWinApp::Idle in MFC.
Application::Idle event is not called in every frame. Could somebody know how to calculate FPS in Visual C++ CLR project?
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Form1^ form1=gcnew Form1();
Application::Idle += gcnew System::EventHandler(form1,&Form1::Form1_Idle);
Application::Run(form1);
return 0;
}
public: System::Void Form1_Idle(System::Object^ sender, System::EventArgs^ e)
{
DWORD currentTime=GetTickCount();
DWORD deltaTime=currentTime-m_PlayCurrentTime;
m_PlayCurrentTime=currentTime;
m_FPS->FrameCnt++;
m_FPS->TimeElapsed+=deltaTime;
if (m_FPS->TimeElapsed >= 1000)
{
m_FPS->CalculateFPS();
m_FPS->TimeElapsed -= 1000;
m_FPS->FrameCnt = 0;
FPStoolStripStatusLabel->Text=L"FPS=" + m_FPS->dFPS.ToString();
}
}
|
|
|
|
|
akira32 wrote: Could somebody know how to calculate FPS in Visual C++ CLR
FPS of what? What frames?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
FPS is frame per second.
Sorry! m_FPS is customized strcut as below:
ref struct sFPS
{
sFPS()
{
Init();
}
void Init()
{
FrameCnt=0;
TimeElapsed=0;
dFPS=0;
}
void CalculateFPS()
{
dFPS = (Double)FrameCnt / (TimeElapsed/1000.0f);
}
DWORD FrameCnt;
DWORD TimeElapsed;
Double dFPS;
};
In MFC project, I can use the CWinApp::Idle to count the frame number for FPS. But in CLR project. Application::Idle is not always called(must have some windows messages be triggerred), so I cannot use it to calculate FPS if the mouse does not focus on the winform. I want to find a event that will be called at any time.
modified on Tuesday, November 24, 2009 12:14 AM
|
|
|
|
|
akira32 wrote: FPS is frame per second.
Right. But I asked "FPS of what? What frames?"
Video?
akira32 wrote: I want to find a event that will be called at any time
A Timer[^] maybe?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Not for video. I use for DirectX.
|
|
|
|
|
I guess I'm missing what you're trying to do.
It seems to me a FPS calculation should be done when each frame
(or multiple of frames) is rendered, not during an idle event,
unless the idle event is the only time a new frame is rendered.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
Is there any function or API, which give me the name of opened .exe or file name and path(by right click->Open or by double clicking) from any drive or desktop.
thanks
|
|
|
|
|
Look at tlhelp32.h and shellapi.h and the Process32Next function
|
|
|
|
|
Could somebody know the even for the scrolling of middle mouse scroll?
I want to update the client region when user scrolls the middle mouse scroll.
|
|
|
|
|
|
Hello Sir
How to Import C# DLL in C++ Application .please replay me
Thanks!!
Raju !!!
|
|
|
|
|
Yea its working fine ...
Raju !!!
|
|
|
|
|
I define a class MyObject. I want to use PropertyGrid to browse and modify the attributes of myObject (MyObject object).
Can I reach this goal? If the answer is "Yes". Could sombody tell me how to do?
ref class MyObject
{
public:
int x;
int y;
int rx;
int ry;
};
private: System::Void FormProperty_Load(System::Object^ sender, System::EventArgs^ e)
{
MyObject^ myObject=gcnew MyObject();
propertyGrid1->SelectedObject = myObject;
}
|
|
|
|
|
I had used public property to solve this problem. But... I meet another problem.
If SelectedObject is a nested object like basicobject, how to show the parameters of basiceffect in PropertyGrid?
public ref class BasicEffect
{
public:
BasicEffect(void)
{
}
virtual ~BasicEffect()
{
}
public:
[Browsable(true)]
property System::Boolean loop
{
bool get()
{
return _loop;
}
void set(System::Boolean value)
{
_loop=value;
}
}
private: System::Boolean _loop;
};
public ref class UIObject
{
public:
UIObject(void){_basiceffect=gcnew BasicEffect()};
virtual ~UIObject(void){};
public:
[Browsable(true)]
property int x
{
int get()
{
return _x;
}
void set(int value)
{
_x=value;
}
}
public:
[Browsable(true)]
property BasicEffect^ basiceffect2
{
BasicEffect^ get()
{
return _basiceffect2;
}
void set(BasicEffect^ value)
{
_basiceffect2=value;
}
}
private: int _x;
private: BasicEffect^ _basiceffect2;
};
modified on Thursday, November 19, 2009 3:32 AM
|
|
|
|
|
first please download the PDFLibNet.dll from here: http://www.codeproject.com/KB/files/xpdf_csharp/PDFViewer.zip[^]
it's ok like this:
<br />
Assembly a = Assembly.LoadFile("PDFLibNet.dll");<br />
but exception like this:
byte[] b = File.ReadAllBytes("PDFLibNet.dll");<br />
Assembly a = Assembly.Load(b);<br />
throwing FileLoadException, telling me it could not verify the code or could not pass policy check. .net thinks that it is not a valid assembly.
I found a solution here: http://nonodes.spunow.co.uk/2009/04/assemblyload-c-cli-assembly-gives.html[^] telling me to build the C++ assembly with /clr:safe, but is there any other way out?
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
modified on Tuesday, November 17, 2009 10:16 PM
|
|
|
|
|
I want to modify the AutoScrollMinSize of Form1 by the code as below:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
this->AutoScrollMinSize.Width=1000;
this->AutoScrollMinSize.Height=1000;
}
But it still not be active. Could somebody know how to modify the AutoScrollMinSize of Form1?
PS:already set Form1's AutoScroll as True.
modified on Tuesday, November 17, 2009 3:24 AM
|
|
|
|
|
a Size is a struct, hence a value type; you can't just modify part of it to modify the object. Assign a new Size with the width AND height you want.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Size is a struct, so when you directly modify its properties, you are actually modifying a copy of it. (Actually modifying two copies of it in your code, one for width and another for height ).
Use something like this:
this->AutoScrollMinSize = gcnew Size(1000,1000);
|
|
|
|