Similar Threads:
1.need help understanding this code snippet
got the following code snippet that i've modified off the internet to work -
but damn if i know how and i dont like that. im having trouble with the
following thread declaration that creates the thread, calls the ScanPorts
method in the ScanPorts class and somehow passes in the array list
scannedSystems. i'm stumped - how does it do all that on one line? thanks
all.
private ArrayList scannedSystems;
scannedSystems.Add(new ScanPorts(ipAddress, port);
Thread scanThread = new Thread ( new ThreadStart
(((ScanPorts)scannedSystems[0]).systemScan));
scanThread.Start();
public class ScanPorts
{
private string address = "";
private int scannedPort;
public ScanPorts(string ipAddress, int port)
{
string address = ipAddress;
int scannedPort = port;
}
public void systemScan()
{
TcpClient tcpClient = new TcpClient();
try
{
tcpClient.Connect(address, scannedPort);
}
catch{}
}
}
2.Need help in understanding C++ code
Hi,
I found the following c++ code, but I need help in understand what it
is trying to do:
if the caller does this
DPRINTF(D_MINI_FS, ("CHXMiniFileSystem()\n"));
what will happen according to the following macro?
extern void dprintf( const char *, ... )
#ifdef __GNUC__
__attribute__((format(printf,1,2)))
#endif /* __GNUC__ */
;
extern void dprintfx( const char *, ... )
#ifdef __GNUC__
__attribute__((format(printf,1,2)))
#endif /* __GNUC__ */
;
#ifdef DEVEL_DEBUG
#define DPRINTF(mask,x) if (debug_level() & (mask)) { \
dprintf("%s:%d ", __FILE__, __LINE__); dprintfx x; } else
#else
#define DPRINTF(mask,x) if (debug_level() & (mask)) dprintf x; else
#endif /* DEVEL_DEBUG */
3.New @ programming really need a tutor and im struggling and i need some help understanding
one of my assignments is create a class named numbers whose
Main()method holds two interger variables, assign values to the
variables. within the class, create two methods, Sum() and
Difference(),that compute the sum of the difference between the values
of the two variables, respectively. each method should perform the
computation and display the results. in turn call each of the two
methods from Main(), passing the values of the two interger valuesof
the two interger variables.
then
B
Add a method named Product() to the Numbers class. This method should
compute the multiplication product of the two intergers. but not
display the answer. instead it should return the answer to the calling
Main() program, which displays the answer.
sorry for the sloppy typing and if any help or ideas is available it
is greatly appreciated.
4.Need some help understanding abstract
I have a class that I need to adapt to various scenarios. Some
properties and methods will be needed in every case, while other's are
unique for one case. So I made a base class, and a set of other derived
classes for each scenario.
But I don't understand this fully. There are not only methods in my
original class. It has data too, in private fields.
public class OriginalClass
{
private string field1;
private string field2;
// Constructor
public OriginalClass(string field1, string field2)
{
this.field1 = field1;
this.field2 = field2;
}
public void ProcessData()
{
// Using field1 and field2 here.
}
}
Does this mean it's no use having fields in an abstract class? I wonder
if I have to write derived classes so that each method takes all the
data necessary as parameters? Like this:
public class BaseClass
{
// No private fields and no constructor
public void ProcessData(string field1, string field2)
{
// Using field1 and field2 here.
}
}
public class DerivedClass
{
private string field1;
private string field2;
public DerivedClass(string field1, string field2)
{
this.field1 = field1;
this.field2 = field2;
ProcessData(field1, field2);
}
}
Gustaf
5.Need help understanding how to call unmanaged dll
I bought a USB IR reciever and installed the driver. The developer
kit gives a DLL with the following information:
C++ Builder / Microsoft Visual C++:
#ifdef __cplusplus
extern "C" {
#endif
int __stdcall DoGetInfraCode(uchar * code, int extra, int *
codeLen);
#ifdef __cplusplus
}
#endif
So in my C# project I have done this:
public class IgorUSB
{
[DllImport("IgorUSB.dll")]
public static extern int DoGetInfraCode(ref byte[] code, int
extra, ref int codeLen);
}
Which I assume it the correct way to define the wrapper to the dll.
Next I added this to my Windows Form:
private void Form1_Load(object sender, EventArgs e)
{
byte[] code = new byte[12];
int extra = 0;
int len = 0;
IgorUSB.DoGetInfraCode(ref code, extra, ref len);
}
But I get the following error when I run it:
"LoaderLock was detected
Message: Attempting managed execution inside OS Loader lock. Do not
attempt to run managed code inside a DllMain or image initialization
function since doing so can cause the application to hang."
Does my code look correct? The only thing I can think of is the when
this DLL is loaded it pops up a message box. Could that be the
problem?
6. I just don't understand how enums work.....Help needed
7. Some Errors need help understanding
8. need your help in understanding COM events using ATL