|
I am using Visual Studio.Net 2003
My mainThread creates a newThread and the newThread starts doing its thing. At some point the newThread suspends itself; at which point it enters the ThreadState of Suspended.
I am trying to abort the newTread from my mainThread. When i attempt this using a newThread->abort();
It throws a ThreadStateException, i beleive because the newThread is suspended.
At this point the ThreadState of newThread is (SuspendRequested, AbortRequested).
So in the ThreadStateException catch, i use a newThread->Resume();
This causes the threadState of newThread to be simply (AbortRequested).
The problem is that I can't figure out how to get the newThread to leave AbortRequested state and enter the Stopped state.
If I call the abort from within newThread, it enters the Stopped state without problem; why can't I abort the newThread from within mainThread?
any help would be appreciated,
Thanks,
Jody Blau
|
|
|
|
|
You know how you can do the GetMessage() loop in Win32 programs? Is there any way to get the same thing in a c++ .NET app?
|
|
|
|
|
hey there,
Is there any way to create a simple client/server program in a 16 bit (dos)
project?
I can only use this kind of mode (dos 16 bit) because the microchip i am trying to control remotely connected to the server only supports borland 5.02 DOS 16 BIT projects.
thank you for helping and any suggestions are heart-warmingly welcome!
porac69
|
|
|
|
|
I have a dll written using VC++ 6. I cannot change it. But, I need to use it in C#. I am trying to write a wrapper in MC++ and then access it.
This is what I am trying.
In C#
------
static void Main()
{
try
{
F6xBscWrap f6bscW;
f6bscW = new F6xBscWrap();
//f6bscW.Reset();
}
catch(Exception e)
{
string s = e.StackTrace.ToString();
}
Application.Run(new Form1());
}
----
F6xBscWrap is the wrapper written in Managed C++. But as soon as the constructor is called it gives me a
An unhandled exception of type 'System.StackOverflowException' occurred in wrapf6com.dll
and crashes.
The managed wrapper for the constructor is
----
F6xBscWrap::F6xBscWrap()
{
try
{
f6bsc = new F6XBasicCfg();
}
catch(System::StackOverflowException *e)
{
Object *s = e->StackTrace;
}
}
----
and the wrapper .h file is
----
public __gc class F6xBscWrap
{
private:
F6XBasicCfg __nogc* f6bsc;
public:
F6xBscWrap();
~F6xBscWrap();
void Reset(); // Reset to zero
};
----
Any and all help will be appreciated.
|
|
|
|
|
I need to add hotkeys to buttons on a form
e.g F2-F12
How to do that?
tia,
kriss
Gupta Team Developer 3.1
VC++ 2003
Oracle 8i
W2K-XP
|
|
|
|
|
forget it, i put in a MainMenu and add the quickies there.
Where the menues are for buttons only, i simply hide them.
thanks, ;);P (( Kriss
Gupta Team Developer 3.1
VC++ 2003
Oracle 8i
W2K-XP
|
|
|
|
|
I am currently having trouble in writing a permutation in lex order the function i am working bellow is needing to do this:
//return position of the smallest number between index start+1
//and size (inclusive) that is greater than v[start]
It however i dont believe works correctly. Can any one help me.
v is a vector that contains: abcd
i = the first value to the L < R
size is the v.size()
//call of function
giveMePositiontoSwap(v, i, size);
//function
int giveMePositiontoSwap(vector<valuetype> &v, int start, int size)
{
int smValue = size-1;
for(int i=start+1; i < size-1; i++)
{
//finds a value greater than v[start]
if(v[i] > v[start])
{
//finds smallest value within the index start+1 and size
if(v[i] < v[smValue])
smValue = i;
}
sortItems(v, i+1, size);
}
return smValue;
|
|
|
|
|
I've been programming via V6 and MFC for a number
of years; but I'm a newbee with C++ .Net (2003).
I have been using STL's vector and map as my common
containers. Now am reading books on Managed C++ and
Forms. There I read of the Managed C++ .NET container
set.
My questions:
-- Are the Managed C++ .NET containers any more
(or less) efficient than SLT containers?
-- I understand STL containers. Is there any
advantage to move to Managed C++ .NET containers?
-- I would like a second opinion on strong advice
that I advance my knowledge of templates, read
"Modern C++ Design", plus several others recommended.
(I understand I have fallen behind in my knowledge
of the templates; but I'm not sure I really need to
keep up.)
WedgeSoft
|
|
|
|
|
They are less efficient and do not offer the functionality that STL gives you.
John
|
|
|
|
|
hi i am an engineering student and really interested in programming.. i want to develop a c or c++ program(not visual c++) . my iodea goes like this .. suppose somebody runs th .exe file . then suddenly a notepad opens and some text starts gettin written on it ........... similraly some sound also starts playin ...... i know how to open notepad or winamp but i really dont know how to play songs or write text through c......... if anybody could really help me then i will be really grateful..... this program is just for fun purpose............
|
|
|
|
|
So you don't want to use Visual C++, but you're posting in the Managed C++ forum ?
Your program sounds like a nuisance to me.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
|
I have a form (name MyForm), where I want to know when the Arrow keys pressed
so I made this function but its not working for the arrow keys.
Its working great for all the others (shift, alt, caplock.....)
dont know what to do please help
in the constructor:
this->add_KeyDown(new KeyEventHandler(this, &MyForm::KeyDown));
the function:
void MyForm::KeyDown(Object *sender, KeyEventArgs *e)
{
switch(e->KeyCode)
{
case Keys::Down:
MessageBox::Show("Key Down was pressed");
s->Down(picGame->Handle);
}
}
I tried to step with the debugger, nothing happens when I press arrow keys
Its not getting in to the function
for all other keys it does.
|
|
|
|
|
Hai,
I just copied your code and its works!!!!
Sometimes the focus is not on your Form .
|
|
|
|
|
Youre right.
I tried it with an empty form and it worked.
I have on my form only a picturebox and a button, how can I keep the forms focus always.
I never need the focus on the other controls.
thanks.
|
|
|
|
|
hai,
Sorry i dont know how it solve!!!
Some where i found to override the ProcessmdKey method
but i didn't get too much ideas
If u solve the problem plz post it
by
ANish
|
|
|
|
|
Thanks
I will post if there will be any soloution.
Yuval
|
|
|
|
|
Can anyone help me?
I am getting this error..
h:\169\program 3\ManageData.cpp(62): error C2782: 'int ManageData::searchArray(T [],int,T)' : template parameter 'T' is ambiguous
with this call statement..
index = searchArray(studentArr, numStudents, entry );
that calls this function...
template<typename T><br />
int searchArray(T arr[], int size, T target)
grrrrrr, I can't get rid of this stupid error!
|
|
|
|
|
For about a week now i have been reading and reading but still can not make any sense about strings in C++ .Net.
Problem 1 is comparing strings, for example:
String* Str1 = "HELLO";
if (Str1 == "HELLO") // Also Tried using Compareto
{
TextBox1 -> Text = "Same";
Else
TextBox1 -> Text = "Not The Same"";
}
I have even put in breaks just to make sure that the strings are the same - which they are.
Problem 2, does left, right, mid still exsist?
Thanks,
Dave
|
|
|
|
|
You are comparing two objects not strings! This will work:
String* Str1 = S"Hello";
if (Str1->CompareTo(S"Hello") == 0)
...
However, the following will seem to work but you are actually comparing the same object to itself:
String* Str1 = S"Hello";
if (Str1 == S"Hello")
...
Str1 is actually pointing to S"Hello". S"Hello" really a String object.
S"Hello" actually means new String("Hello");
Thus S"Hello" or (Str1) does not equal the literal string "Hello" (without the S prefix).
Also, use the String object's method "SubString", for Left, Right and Mid.
|
|
|
|
|
Hai,
You can comapre the Strings using the static Compare method in the String class
ie
String* str=S"HELLO";
if(String::Compare(str,"HELLO")==0) //ie Same
{
TextBox1 -> Text = "Same";
}
else
{
TextBox1 -> Text = "Not The Same"";
}
SubString function done all the left, right and mid functionalities
by
Anish
|
|
|
|
|
One more little thought to add to the above:
You can not change a String object. Replace
only deletes the old and creates a new object.
Once created the String is fixed. So -- if in
a loop changing a sting; be careful of using
String.
WedgeSoft
|
|
|
|
|
Hey guys, I'm trying to get a callback function to work from my unmanaged C++ dll. Everytime I run my program I get System.NullReferenceException saying "Object reference not set to an instance of an object." in mscorlib. This error is thrown when the runtime tries to execute the callback function in my unmanaged C++ DLL.
What I'm trying to do is real simple and straightforward:
namespace ProtocolDll
{
__delegate void MY_CALLBACK();
[DllImport("test.dll")]
extern "C" void UnmanagedFunc(MY_CALLBACK __gc* myCallback);
public __gc class Wrapper
{
public:
void myCallback()
{
MY_CALLBACK* cb = new MY_CALLBACK(this,&Wrapper::CallMePlease);
UnmanagedFunc(cb); // Call the unmanaged dll function
}
void CallMePlease()
{
Int32 i=0;
i=i+1; // I put a breakpoint here but it never makes it
};
}
************************************
Here is my unmanaged C++ dll code:
typedef void (*MY_CALLBACK)();
EXPORT void UnmanagedFunc(MY_CALLBACK* pfnCallback);
void UnmanagedFunc(MY_CALLBACK* pfnCallback)
{
(*pfnCallback)();
}
Any idea what I am doing wrong? Thanks for any help... this is my last issue with this unmanaged dllimport stuff... this code is a bear to write.
david
|
|
|
|
|
greetings...
im using borland 5.01 and i am trying to interconnect 2 computers with eachother over the internet.
i have to do it with windows (not linux), and it must be DOS (standard).
well, I have only 2 obstacles in my way so far...
1-does anyone know what functions exist for me to connect to a pc, knowing its IP address?
2-does anyone know what functions exist for me to obtain a pc's IP address, knowing its name?
oh, and to use these functions, what libraries must be included and where can i get them?
Thanks
|
|
|
|
|
I'm trying to call a C dll function passing a structure that looks like this:
typedef struct
{
long lModuleID;
DWORD dwAddress;
long lType;
BOOL fComplete;
long lLength;
BYTE *pbyData;
WORD wTimeoutMS;
long lErrors;
} MEMACCESS_STRUCT_S;
I translate this into the following structure in my managed C++ code:
[StructLayout(LayoutKind::Sequential)]
public __gc class MEMACCESS_STRUCT_S
{
public:
Int32 devAddr;
Int32 memAddr; // DWORD (UInt32)
Int32 type;
Int16 complete; // BOOL -> TRUE=1, FALSE=0
Int32 length;
Byte data[];
Int16 timeout; // WORD (UInt16)
Int32 err;
};
Everything works great except the variable "data" that holds the byte array. I get garbage when I look at the values for the array. What am I doing wrong? Thank you so much for any help... I'm nearing the point of headbutting my monitor and throwing my mouse out the window over this one!
david
|
|
|
|