|
I don't know much about what you are doing. However, I have had the same problem but it may or may not be related to yours. You may need to check the installed fonts. If the computer/printer cannot properly substitute your run-time font, a lot of times it just prints a blank page.
|
|
|
|
|
I should know... (the analysis function should tell me!)
Anyway that gave some related and unrelated idea... I'll try, thanks for the tip!
|
|
|
|
|
I'm trying to save the Time to the [char templog[256]]
it works perfectly on the developer pc. problem comes when running on client pc.
sprintf( templog, "\t%s ->Now Playing MP3::%s",<br />
DateTime::Now.ToString( L"T" ), advert );
output after saving to text file developer pc:
15:19:26 ->Now Playing MP3::C:\Media\MP3\Mike & The Mechanics - Word Of Mouth.mp3
output after saving to text file client pc:
È%¹y ->Now Playing MP3::C:\Media\MP3\Mike & The Mechanics - Word Of Mouth.mp3
both have .net 1.1 and .net 2.0 framework installed
both running Windows XP Home
both time & Date settings equal (including format settings)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
code written in visual c++ .net 2003 Std edition.
any hints or help would be great thx in advance
dewald@silversquare.co.za
|
|
|
|
|
Hi Saber,
unfortunately I can't tell you, what is actually causing that behavior but I would start investigating in the following order:
1. try to use
sprintf( templog, "\t%s ->Now Playing MP3::%s",
DateTime::Now.ToString( L"T", DateTimeFormatInfo.InvariantInfo), advert );
and check also for any Globalization issues?, CultureInfo... etc.
2. check your character set or any formatting / encoding
3. give swprintf(...) a try
Hope that helps. Anyway it would be great if you could publish your result.
best regards
Tobias
|
|
|
|
|
Thx for the advice,
char tempbuf[128];<br />
sprintf( templog, "\t%s ->Now Playing FullScreen::%s::%s", <br />
_strtime(tmpbuf));
some times its better to stick to the basics. I've even checked the value
on client pc with gamehack the date works (also in log file) but the time is
giving problems.
_strtime(tmpbuf); is quicker and eisier to use any way...
thanx again for helping...
|
|
|
|
|
I see a couple problems with your code. First of all, "DateTime::Now.ToString( L"T" )" returns a Unicode string and sprintf does not handle Unicode. Secondly, you need to marshal or "pin" the managed heap string. The managed heap string can move without warning.
-- modified at 23:15 Wednesday 29th March, 2006
|
|
|
|
|
I have an app that works the following way:
1.the main process is written in C#
2.the main process uses class witten in Managed C++
3.in classes wirtten in Managed C++, Unmanaged C libs are called
4.as well the main process communicate with other host via .NET remoting
The other day a got a socket exception says (this happens at a very low frequency):
"An operation was attempted on something that is not a socket"
I investegated a lot and come to know this will only happen when the TCP/IP stack is destroyed
(IP addresses are all fixed)
I don't think TCP/IP stack can be destroyed by codes in C#. In Managed C++, all object reference created on C#'s side were
<br />
delete objRefCreatedInCSharp;<br />
in Dispose(). I am told this was done to prevent memory leak.
My qusetion is
1. Is delete necessary to prevent memory leak?
2. Won't this delete destroy TCP/IP stack at a certain timing?
Thank you very much.
-- modified at 0:35 Wednesday 29th March, 2006
|
|
|
|
|
You only use "delete" when you want to manually mark an object ready for disposal by the GC. If you prematurely use delete, of course, your code will not run properly. Since you did not provide any code examples, it is difficult to determine what your problem is.
|
|
|
|
|
I've got two header files:
// This is file1.h
#include "file2.h"
__gc class Class1
{
....
};
// This is file2.h
#include "file2.h"
__gc class Class2
{
....
}
I want both files to "know" each other, but it becomes an endless loop when i try to #include
each other... Any idia ?
Thanks
|
|
|
|
|
Correction about the file2.h file:
#include "file1.h"
of-course
|
|
|
|
|
Fundamental to the header files is the preprocessor. In order to avoid Multi-Inclusion you need a to tell the preprocessor to only include the header under certain conditions.
For example,
file1.h
<br />
#ifndef __FILE_1_H__<br />
#define __FILE_1_H__<br />
...<br />
#endif<br />
Now with that said, you probably need to revisit your header file design because you should not have a situation where File1 is including File2 and visa versa. If there is common definitions or structures, put those in a separate header. Keep the module specific data in the header that applies to the .CPP or .C module. You application might then look like:
file1.h
<br />
#include "File1.h"<br />
#include "CommonData.h"<br />
...<br />
file2.h would be similar.
Good Luck
Mike Luster
CTI/IVR/Telephony SME
|
|
|
|
|
Hi Virtek,
cross including seems kinda up to date problem. I would suggest that you add #pragma once to both of your header files.
#pragma once
"Specifies that the file will be included (opened) only once by the compiler when compiling a source code file."
Furthermore those two threads might be interesting to you as well.
http://www.codeproject.com/script/comments/forums.asp?msg=1401063&forumid=3785#xx1401063xx
http://www.codeproject.com/script/comments/forums.asp?msg=1422933&forumid=3785#xx1422933xx
regards Tobias
|
|
|
|
|
Do you know why C apply .h & .c file concept.
Becoz in .h file you do all declaration & in .c file you define all function.
so what you do for both header file make .c/.cpp file(which you already done.). & include file1.h in file2.cpp & file2.h in file1.cpp.
so it is not endless loop.
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
Divyang Mithaiwala wrote: so it is not endless loop.
It is. Unless you add the folowing
#ifndef _FILE1_H_ // At the beginning of .h file
#define _FILE1_H_ // Win32 style for declaring .h file
#endif // at the end of .h file
|
|
|
|
|
Hello all,
I have a strucure as given below.
public ref struct PASSTHRU_MSG
{
unsigned long ulProtocolID;
unsigned long ulRxStatus;
unsigned long ulTxFlags;
unsigned long ulTimeStamp;
unsigned long ulDataSize;
unsigned long ulExtraDataIndex;
array<unsigned char=""> ^ucData;//[4128];
};
PASSTHRU_MSG ^passThruMsg = gcnew PASSTHRU_MSG;
In Unmanaged Code we used to access the passThruMsg object of this type as (unsigned char*).
There we did not encounter any problem.
But now in Managed Code I'm supposed to convert passThruMsg object to array<unsigned char="">^) or (String^).
But I'm unable to convert it to either of the above mentioned forms.
I'm getting Compilation warning, and a runtime crash.
So, now I'm thinking of filling the data contained in the
passThruMsg object to a (String^) or an
(array<unsigned char="">^).
The issue with (String^) is String::Copy() doesn't work if it encounters a null character.
Please give me an advice which one to use.
Thanks in advance.
Regards
Sunil
|
|
|
|
|
Hi Sunil,
you could try one of these structs
public ref struct PASSTHRU_MSG
{
unsigned long ulProtocolID;
unsigned long ulRxStatus;
unsigned long ulTxFlags;
unsigned long ulTimeStamp;
unsigned long ulDataSize;
unsigned long ulExtraDataIndex;
static array <unsigned char>^ ucData = gcnew array <unsigned char>(4128);
};
or
public ref struct PASSTHRU_MSG
{
PASSTHRU_MSG()
{
ucData = gcnew array <unsigned char>(DATA_SIZE);
}
unsigned long ulProtocolID;
unsigned long ulRxStatus;
unsigned long ulTxFlags;
unsigned long ulTimeStamp;
unsigned long ulDataSize;
unsigned long ulExtraDataIndex;
array <unsigned char>^ ucData;
private:
literal int DATA_SIZE = 4128;
};
regards Tobias
|
|
|
|
|
Hey, I'm new to C++ and I'm having a problem with two classes. I have one class Tray that uses IconWindow, however TrayIcon also uses Tray. Below is the import statements for Tray.h
#pragma once
#include <windows.h>
#include <shellapi.h>
#include "TrayIcon.h"
and the import statements for TrayIcon.h
#pragma once
#include <windows.h>
#include <commctrl.h>
#include "Tray.h"
However, this does not compile as they both rely on the other to be compiled first.
I'd apreciate any thoughts on if I am correct and how it could be fixed.
Many Thanks
theonewithtom
|
|
|
|
|
Hi
If I understood you right then this could be a solution for your problem:
http://www.codeproject.com/script/comments/forums.asp?msg=1401063&forumid=3785#xx1401063xx
regards Tobias
|
|
|
|
|
Thankyou for your response. At first the code appeared to compile, however, I seem to be unable to call any functions of my second class. My code is now:
ClassA.h
#include "classB.h"
public __gc class A {
...
}
ClassB.h
public __gc class A;
public __gc class B
{
A a = new A();
...
}
When I compile I get an error saying 'no appropriate default constructor available'.
Any Suggestions?
Many Thanks
theonewithtom
|
|
|
|
|
you shoud use a default constructor.
public __gc class B
{
public:
B()
{
A a = new A();
}
B(Int32 i)
{
A a = new A();
}
~B(){}
}
|
|
|
|
|
Sorry I probably didn't phrase my question propperly. Class A is already declared in ClassA.h with it's header etc, however, I want to use it in ClassB.
I think I'm asking the same question as 'Simple question about header files'
http://www.thecodeproject.com/script/comments/forums.asp?forumid=3785&select=1423769#xx1424478xx[^]
<br />
ClassA.h<br />
<br />
#include "classB.h"<br />
<br />
public __gc class A {<br />
...<br />
}<br />
<br />
ClassB.h<br />
<br />
public __gc class A;<br />
<br />
public __gc class B<br />
{<br />
A a = new A();<br />
...<br />
}<br />
Many Thanks
theonewithtom
-- modified at 6:29 Tuesday 28th March, 2006
|
|
|
|
|
In class B use
#include "classA.h"
in class A use
#ifndef _CLASS_A_H_ // Win32 definition style instead #progma once
#define _CLASS_A_H_ // use this definition style if you want to include
public __gc class A {
...
};
#endif
ps: Don't forget to add ";" at the end of class
|
|
|
|
|
I'm not sure if you already figured this out, but you can use a forward declaration of a class like you can with functions/methods. Ex.
class myclass2; //forward declaration of a class.
class myclass1
{
myclass2 m_SecondClass;
....
};
class myclass2
{
myclass1 m_FirstClass
};
DWyvern
|
|
|
|
|
Whitch .NET framework are you using. If you use plain C++, then this thread supposted to be in Visual C++/MFC Forum.
I don't use Forward decleration. I sometimes declare a global class.
|
|
|
|
|
I have a c# app which references a managed c++ class dll which is wrapping an unmanaged win32 dll using the method described here[^]. I have set the c# app's properties to allow unmanaged code debugging (VS2005), but I am still unable to step into the win32 dll code. Everything is in the one visual studio solution. I have created a pre-build event for the c# app to copy the win32 dll to the c# apps debug folder (Id rather not have to do this, but it seems necessary).
Can someone please help me figure out why i cant debug the dll?
|
|
|
|