|
How to do it?
Piece of code in VC++ please or where to plug it in in proj settings and how to use it then?
It is about the article:
DirectX >> General
Capture Sample with DirectX and .NET By Blas5
The source code for his application to use directx.capture.dll and dshownet.dll is in VB and it uses imports DirectX.Capture
but I need it in VC++ to use something like using namespace.
9ine
|
|
|
|
|
Which version of VC++ are you using?
In VC++ 2005, take [References] from the [Project] menu and click on [Add new reference]. You need to put the Project name in focus in Solution Explorer to get the required menu items in the [Project] menu.
|
|
|
|
|
try this:
#using "directx.capture.dll"
|
|
|
|
|
I use VC 2003 and it is
#using "directx.capture.dll"
using namespace DirectX::Capture;
9ine
|
|
|
|
|
Hello!
I need to make a skip list in my application and I decided to take code from Robert Sedgewick's book "Algorithms in C++", but faced one serious problem: the insert function sometimes failes. I don't know why. Here is it:
const int lgNmax = 10;
template <class Item, class Key>
class SkipList
{
private:
struct node{
Item item;
node **next;
int sz;
node(Item x, int k)
{
item = x;
sz = k;
next = new node*[k];
for(int i = 0; i < k; i++)
next[i] = 0;
}
};
typedef node *link;
link head;
Item nullItem;
int lgN;
...
int _randX()
{
int i, j, t = rand();
for(i = 1, j = 2; i < lgNmax; i++, j += j)
if(t > RAND_MAX / j)
break;
if(i > lgN)
lgN = i;
return i;
}
void _insert(link t, link x, int k)
{
Key v = x->item.Key();
link tk = t->next[k];
if(!tk || v < tk->item.Key()){
if(k < x->sz){
x->next[k] = tk;
t->next[k] = x;
}
if(k == 0)
return;
_insert(t, x, k - 1);
return;
}
_insert(tk, x, k);
}
public:
SkipList()
{
head = new node(nullItem, lgNmax);
lgN = 0;
srand((unsigned int)time(NULL));
}
void Insert(Item v)
{
_insert(head, new node(v, _randX(), lgN);
}
...
};
And the problem is with the 'if(!tk || v < tk->item.Key()){' line (marked with comment). The problem is that the tk sometimes becomes 0xfdfdfdfd. I can't understand why and how to avoid this. It happens at the first iteration of _insert() when t = head. And this usually happens at 300th - 600th insertion. Could you help me to remove the bug?
Thank you in advance!
|
|
|
|
|
You should ask this in the Visual C++[^] forum. This is the C++/CLI forum.
|
|
|
|
|
Can you confirm you have set this line correctly?
It appears the 'node' contructor takes two argument, and the _insert takes three, but your parentheses are mismatched here?
_insert(head, new node(v, _randX(), lgN);
Did you mean
_insert( head, new node( v, _randX() ), lgN );
and making that change, does it work?
No shirt, no shoes, no brains, no service.
|
|
|
|
|
That was my mistake... And here is the real solution:
void _insert(link t, link x, int k)
{
Key v = x->item.Key();
if(k >= t->sz){
_insert(t, x, k - 1);
return;
}
link tk = t->next[k];
if(!tk || v < tk->item.Key()){
if(k < x->sz){
x->next[k] = tk;
t->next[k] = x;
}
if(k == 0)
return;
_insert(t, x, k - 1);
return;
}
_insert(tk, x, k);
}
|
|
|
|
|
There is a international exhibition center which has 40 floor, and 10 elevator.
Constrain condition
1. The movement rule of the elevator:
E0.E1: can reach any floor of the building
E2.E3: can reach 1 and 25~40 floor
E4.E5: can reach 1~25 floor
E6.E7: can reach 1 and the even number of 2~40 floor
E8.E9: can reach the odd number of 1~39 floor
2. The maximum weight that every elevator can support is K people (suggest: people number is range from 10 to 18)
3. Before the simulation, every elevator is randomly parked in random floor in accordance with its movement rule, empty inside.
4. After the simulation, N (N=0~1000) people arrive 1 floor of this international exhibition center in M minutes randomly, and begin the activity of embark.
5. The floor that every passenger wants to arrive is random at the first time, and he waits the coming of the elevator at proper parking place.
6. After every passenger arrive the specified floor by proper elevator, settle (rest for a while) 10~120sec randomly, and go on going another floor randomly, the rest may be deduced by analogy. After every passenger embark the elevator L times (every people has the different L value, when a passenger come into being, this value is randomly specified from 1 to 10),the L+1 times will be down to 1 floor and finish the activity. The simulations also finish.
7. The velocity of the elevator is S second per floor (S=1~5), every people getting up or down time is T second (T=2~10).
8. The direction of the elevator is judged by the demander who first request, the later demander is not allowed to change the current direction of elevator, unless it is the empty elevator which is still not requested.
9. When there is passenger in some floor push the requesting button, the nearest to the passenger and satisfy term 8 and fastest elevator is preferential.
10. Not allow the elevator surpass its supporting ability.
Developing result:
1. The event created cycle is 1 second; every time can create 0 or more events.
2. Pseudo-random number producer specifies every random event.
3. Design a interface that can understand easily, dynamically display carrying passenger and working situation of the elevator, dynamically display passenger settle situation of every floor and request embark situation; dynamically display the time from the beginning of the simulation to current time.
4. You should display the passenger and his requested floor. For example, 12-32 express the passenger whose identity is 12 want to go 32 floor.
5. Statistical list the working and idle time of every elevator; statistical list the waiting time that every people ask for embark elevator; display these times after the simulation.
6. K.N.M.S.T parameters should be input from command line.
|
|
|
|
|
anyone who doesn't want to provide help please don't disturb
|
|
|
|
|
you suck...
my last answer[^] is still applying...
and there's no need neither to cross post the forums to how an answer... you won't have any until the question is not satisfying...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20] | soon : [VisualCalc 3.0]
|
|
|
|
|
If you don't want to code this on your own, you could pay someone to do it, perhaps a classmate who's in need of money.
|
|
|
|
|
#ifndef M1
#define M1
// This is a copy of m1.h
// "EXPORTING STATIC AND NON-MEMBER FUNCTIONS"
// I have three questions that have me foxed. I am very new to c++.net but not c++.
// All code compiled CLR/pure 2005 beta
// A) Need to export Plain c++ functions (not "C" as need function overloading.)
// from a dll so they can be used in the managed exe and other managed dll's
// ( Class's are easy just make them public, but what to do about non
// member functions as you can't use public keyword.
// B) Would also like to export static memeber functions.
// C) On a similar vain I want to export static data
/* would like this to know how this can be made to work
both with and without setting the line below ie for
both gc and nongc class's
*/
//#define TRY_THIS_ALSO
namespace BL {
static void junk2();
#ifndef TRY_THIS_ALSO
public ref class foo {
#else
public class foo {
#endif
public:
int cnt;
};
#ifndef TRY_THIS_ALSO
public ref class bunmanaged {
#else
public class bunmanaged {
#endif
int i;
public:
static foo myStatic ;
bunmanaged(){}
static void junk();
};
};
#endif
//CLI standard
//http://download.microsoft.com/download/9/9/c/99c65bcd-ac66-482e-8dc1-0e14cd1670cd/C++-CLI%20Standard.pdf
//Seems to suggest I might be doomed as can't use public
/* this is a copy of matching m1.cpp
#include "stdafx.h"
#include "m1.h"
namespace BL {
void junk2() {
}
#ifdef TRY_THIS_ALSO
foo bunmanaged::myStatic ;
#endif
void bunmanaged::junk() {
}
};
*/
/* In my other managed class in other dll/exe I have
#using "../Debug/my3Lib.dll"
using namespace BL; //This seems to work so far as the fact that intelisense likes it
I tried many variations on the following.
#using "../Debug/my3Lib.dll"
[DllImport("../Debug/my3Lib.dll",EntryPoint = "BL::bunmanaged::junk()")]
void bunmanaged::junk();
...
public ref class myLibControl : public System::Windows::Forms::UserControl
{
public:
myLibControl(void) {
InitializeComponent();
BL::bunmanaged::myStatic.cnt = 3;
BL::junk();
BL::junk2();
*/
Thanks barry
|
|
|
|
|
The microsoft web site says.
Compiler Warning (level 1) C4272
Error Message
'function' : is marked __declspec(dllimport); must specify native calling convention when importing a function.
It is an error to export a function marked with the __clrcall calling convention, and the compiler issues this warning if you attempt to import a function marked __clrcall.
The following sample generates C4272:
Copy Code// C4272.cpp
// compile with: /c /W1 /clr
__declspec(dllimport) void __clrcall Test(); // C4272
__declspec(dllimport) void Test2(); // OK
|
|
|
|
|
Hi All
i wrote one ISAPI Extension.i have to test it for all possible requestlike chunked, with content-length and non-content length.
presently i want to test it for chunked request. is there any tool or techniques by which i can send chunked request. i think it's very difficult to generate a chunk request.
i anyone know how i can do that or have some code snippet then let me know.
Thanks in advance
|
|
|
|
|
How can I convet string to a desired integer??? Using C++
for example:
January=1
February=2
March=3
......
Hope you can help me
|
|
|
|
|
|
You also canuse :
Int32 January = Convert::ToInt32("1");
|
|
|
|
|
<font color=blue>enum</font> months {
January = 1,
February = 2,
March = 3,
<font color=green>
December = 12
};
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
Hello everyone!
OK, I'm not a bad person, I'm just curious about it, I won't do anything bad, but... How do you do all that memory-screwing, MBR-deleting, screen-locking, CPU-slowing, fill-memory-one-byte-at-a-time-in-one-line stuff in C++? Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
That's pretty funny.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
I'm getting a System.TypeLoadException when I try to access an unmanaged opaque struct.
I have an older, unmanaged API - in 'C' actually - and I am trying to access it from managed C++. The header for the api provides me with an opaque pointer to a struct:
typedef struct _table *TablePtr
so I make a call like this: TablePtr CreateTable();
The internals of the struct are hidden in a private header file.
I have this wrapped in managed C++ - so that my class makes this call in it's constructor:
#include "table_pub.h" // has the typedef for opaque TablePtr
private:
TablePtr mytable;
public:
TableClass(void)
{
mytable = CreateTable();
}
When I call this constructor, I get an exception:
An unhandled exception of type 'System.TypeLoadException' occurred in tester.exe
Additional information: Could not load type _table from assembly olf_mydll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
YET, if I include the PRIVATE header for TablePtr - containing the internal structure definition, it works and I don't get the exception. I don't really want to access the private header - can't guarantee that I'll even have that access going forward.
Is there something I can do to say that this unmanaged type is NOT to be loaded?
Thanks
Rich
|
|
|
|
|
In case anyone else is hitting this problem with forward references, I found a solution on another site - all the compiler wants is a definition for the struct - since we don't want to dereference it, all we need to provide is something like this:
#include "table_pub.h" // has the forward reference - typedef struce _table TablePtr;
// now define the struct in the simplest way:
struct _table {};
Rich
|
|
|
|
|
How to gradually add text to multiline EditBox and scrolling its contents to the last line without blinking of the box. (I've done it MFC app but dont know yet how to work with managed control). For a piece of code big thanks.
9ine
|
|
|
|